1
0
forked from mirrors/0ad
Commit Graph

24631 Commits

Author SHA1 Message Date
Ralph Sennhauser 387ea927ac Add util.sh shell library
A shell utilities function library starting with a first utility
function for getting the number of online CPUs.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-30 18:05:56 +02:00
phosit 2d206708cd Start Atlas by closing the root page
Theere is now an  `Engine.startAtlas` property that will start Atlas
when it's returned from the root page. The `Engine.RestartInAtlas`
function is removed.
2025-03-26 13:07:57 +01:00
Itms c2d3595777 Remove LCC compiler defines 2025-03-25 12:30:01 +01:00
Itms 8f43dd53fc Remove ICC code paths 2025-03-25 12:29:51 +01:00
Itms 3f3bb8300e Remove ICC compiler support
The ICC compiler has not been used to our knowledge to build the game in
a decade, and is nowadays just a part of LLVM.

Fixes #2994
2025-03-25 12:22:04 +01:00
Stanislas Dolcini a8d7a3312c Pull LFS from forks as well. 2025-03-23 23:20:24 +01:00
Ralph Sennhauser a09b2cc242 Disable deprecation warning for old boost
There are a few version of boost which deprecated global placeholders
but do not yet support std placeholders. Simply suppress warning for
those cases.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-23 14:38:43 +01:00
Ralph Sennhauser 7494602de5 Avoid maybe uninitialized warning with gcc
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-23 14:38:43 +01:00
Ralph Sennhauser 9ef1bff6aa Disable dangling-pointer warning whith gcc-12
This is only an issue with gcc-12 to gcc-14, supress the warning on the
CI.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-23 14:38:42 +01:00
Ralph Sennhauser a2fdc3427e Remove unused Dockerfiles
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-23 14:38:42 +01:00
Ralph Sennhauser 84f626d2b5 Use Debian 12 in Linux pipeline
Use the single Debian 12 container image and inject CC, CXX and LDFLAGS
instead.

Further do the lfs checkout on the agent instead of inside the container
avoiding full rebuilds due to version mismatch.

Then split the debug and release builds using separate workspaces and
record warnings by build preventing gcc warnings leaking into clang
warnings.

Based on zero warning policy and incremental builds using a reference
build doesn't make sense. Removing that we can also drop an additional
generic workspace.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-23 14:38:42 +01:00
Ralph Sennhauser 0481f13fff Add Debian 12 Dockerfile
Debian 12 (bookworm) will soon be oldstable.

Most importantly this version comes with cmake-3.25, which will allow us
to use SDL3, cpp-httplib, fcollada fork and possibly others in the
future.

This also comes with gcc-12 and clang-14 by default, both implementing
almost all of c++17 and most of c++20.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-23 14:38:42 +01:00
Ralph Sennhauser 038decb12e Add Dockerfile to editorconfig
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-23 14:38:42 +01:00
Stan f3948fb9db Add more badges to the UI. 2025-03-22 14:11:24 +01:00
Dunedan e755ef7155 Improve performance and output of entvalidate.py
The most notable changes are:

- improved performance thanks to using `lxml` instead of `xmllint` for
  validating the templates
- improved performance by parallelizing the validation across multiple
  threads
- more meaningful output for detected validation errors
- easier to call from other scripts (like checkrefs.py)
2025-03-18 12:57:01 +01:00
Dunedan f68a8c2532 Verify the lobby certificate by default
When TLS for XMPP connections to the multiplayer lobby got implemented,
there was a bug in gloox [1] preventing the certificate verification to
succeed. This bug got fixed in gloox 1.0.22 five years ago, so it's safe
to enable certificate verification by default now.

[1]: https://web.archive.org/web/20200522184941/https://bugs.camaya.net/ticket/?id=280
2025-03-18 08:58:45 +01:00
phosit 771e33f462 Fix g_MainMenuItems "onPress"
Since 40762c257d there is a callback passed to the "onPress" function of
the `g_MainMenuItems`. If the "onPress" function is a bound
`Engine.OpenChildPage` with only the filename bound to it, the callback
becomes the second argument.
The second argument is cloned to pass it to the child page. Cloning the
callback crashed the engine.
2025-03-17 18:47:43 +01:00
Dunedan f4baf8944c Fix the import of datetime.UTC in bundle script 2025-03-17 13:39:38 +01:00
Ralph Sennhauser f10526284f Don't map unknown scancodes to hotkeys
Users may generate key presses that don't map to a distinct SDL scancode
and will be mapped SDL_SCANCODE_UNKNOWN instead. Using the same ID for
unmapped hotkeys means any such key press will execute unset hotkeys. As
luck would have it in #7644 this leads to calling "Custom exit to
desktop" if the hotkey is unbound as is the default.

So simply use a code for unused hotkeys that doesn't map to any SDL
scancodes.

Fixes: #7644
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-15 20:33:03 +01:00
Sanctorum Thomas 75f414c665 Clear filter when closing Map Browser 2025-03-15 09:27:29 +01:00
Vantha 78900842b1 Improve the "UDP port 20595" connection error dialog
Add a unique disconnect reason for timeouts of connection attempts.
Rewrite the displayed error message and provide a link directly to the FAQ entry.
(The old message was very misleading and only brought players on the
wrong track during troubleshooting)
2025-03-13 15:34:20 +01:00
phosit 40762c257d Quit Engine by closing the root page
When the root page gets closed the engine quits instead or crashing.
The root pages are changed to use that mechanism to quit the engine.
This removes the need of `Engine.Exit` for the GUI.
2025-03-12 12:07:37 +01:00
Ralph Sennhauser 71f78eb2ce Use JOBS var instead of hardcoding on Windows
Don't hardcode the number of parallel jobs in Windows based pipelines
but allow setting the desired number in the environment.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-09 11:14:16 +01:00
Ralph Sennhauser 2a0817d930 Add JOBS support to Unix build pipelines
Allow the number of concurrent build jobs in Unix build pipelines be
specified in the environment via the JOBS variable.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-09 11:14:16 +01:00
phosit df5fee6103 Rename PushGuiPage to OpenChildPage
There is no `PopGuiPage` anymore. For symmetry there should also be no
`PushGuiPage`.
2025-03-09 10:39:20 +01:00
phosit d0ab2cb783 Remove Engine.PopGuiPage
Remove the old now unused interface.
2025-03-09 10:39:20 +01:00
phosit 094a7c2268 Return a promise from most page-inits
Adopt the new interface by all pages which close themself. (Not thous
using `Engine.SwitchGuiPage`.)
2025-03-09 10:39:20 +01:00
phosit 4f62e9f6f0 Change the GuiManager tests to use promises
Adopt the new interface by the tests: as an example and to show that
it's sound.
2025-03-09 10:39:20 +01:00
phosit d3bc5bc802 Enable page-inits to return a Promise
Allows to return the page-completion-value instead of passing it to an
`Engine` function.

Closes: #7000
2025-03-09 10:39:20 +01:00
Vantha 5741f77c6e Add a 'team population' gamesetting
Remove the world population setting from the game setup.
Add a dropdown for choosing the "Population Cap Type".
(-> containing Player Population, World Population, Team Population)

Use a single "Population Cap" dropdown adapting to the pop cap types.
Move all population data into a single .json file.

New system component "PopulationCapManager" for distributing pop caps.

Resolves: #6918
2025-03-06 13:25:43 +01:00
Dunedan c448973398 Remove a bunch of unused scripts
Some of them were simply unused, while others got replaced by Python
scripts.
2025-03-03 20:57:49 +01:00
Dunedan 03cb24d400 Move xmlvalidator code to entity directory
The xmlvalidator logic is only used by the checkrefs.py script, so this
moves it to the same directory to have it co-located and avoid having to
modify sys.path to import it.
2025-03-03 17:45:08 +01:00
Dunedan 118ea18a58 Enable a few more ruff rules 2025-03-03 14:18:40 +01:00
Dunedan 3c57fdb4a9 Fix ruff linting for scripts in source/tools/dist/
By default ruff excludes all files in directories named "dist" from
linting (https://docs.astral.sh/ruff/settings/#exclude). This caused the
Python scripts in `source/tools/dist/` to not get linted. This commit
fixes that and adjusts their style to fit our ruff rules.
2025-03-03 12:45:33 +01:00
Itms b831b1f559 Fix Jenkins pipelines on Linux agent
The Linux agent now runs Docker in rootless mode for additional
security. Operations inside containers must be run as root to match the
underprivileged user running Docker.
2025-03-01 22:08:50 +01:00
Ralph Sennhauser 6738fdbab7 Remove root check in update-workspace.sh
If you run as root then created files will be owned by root, this is
expected behaviour and not messing with permissions as stated in the
error message.

Running in a container the root user may map to the user starting the
container while all other users would need mapping to be able to work
with a bind mounted a checkout.

Further Debian patches out the root check to be able to build on their
builder.

Given the above remove the check.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-03-01 18:36:44 +01:00
Vantha 13dd7c0bb7 Remove empty and invalid sprite assignments
(They were overwritten by the code anyway)
2025-02-26 16:20:27 +01:00
Vantha 0177b97c69 Complete the GUI XML checks in checkrefs.py
Add checks for sprites, styles, scrollbars, tooltips, and colors.
And too for entire objects referenced by the "use_object" attribute.
(even though that is currently unused)
2025-02-26 16:20:27 +01:00
Vantha 734f8e1192 Add an "OnAttackDetected" trigger 2025-02-26 11:56:52 +01:00
Stan 288f125178 Add three options to the autostart CLI.
- a speed option
- a placement option
- a map visibility option
2025-02-24 22:45:23 +01:00
phosit 40fe7df654 Silence dangling pointer warning for JS::Rooted
With much help by @sera.
2025-02-24 21:30:56 +01:00
Dunedan 18d7746c84 Fix adding port forwardings using UPnP
The UPnP implementation included a combination of two subtle bugs, which
resulted in failure to create port forwardings every time after the
first one.

When using UPnP, the internet gateway to create the port forwardings at
needs to discovered. As that takes a while, the its root descriptor URL
was supposed to be cached after successful discovery in the user config
in "network.upnprootdescurl". However, instead of caching the root
descriptor URL, the control URL got cached. That caused following
requests to the root descriptor URL to fail, as they ended up at the
control URL instead. As such requests might also fail when the network
topology changed, the code was supposed to fall back to discovering the
internet gateway again when the cached one didn't work. However, due to
the inner workings of miniupnpc the request using the cached root
descriptor URL didn't result in an error, so the new discovery was never
triggered. As the wrong value was persisted in the user config there was
also no way to get out of this situation again.

This commit fixes both of these bugs.

As far as I can tell these bugs existed since the introduction of the
caching of the root descriptor URL in 0ba25e9968, which means creating
port forwardings using UPnP has been broken since Alpha 15.
2025-02-24 08:23:07 +01:00
Dunedan 5696f063f5 Reduce time to discover the internet gateway
When adding a port forwarding via UPnP, pyrogenesis first needs to
discover the internet gateway to create the forwarding at. To do so, it
utilizes miniupnpc to send an SSDP request and waits 10 seconds until it
processes the responses and continues to add the port forwarding.
As that happens asynchronously it means if players hosting games rely on
UPnP for port forwarding and if their pyrogenesis instance doesn't have
the address of their internet gateway cached, it takes more than 10
seconds after starting to host a game, before players can join. However,
waiting for 10 seconds is completely unnecessary, because the internet
gateway responds immediately to the SSDP request. Therefore, this commit
reduces the time to wait for responses from 10 seconds to 2 seconds,
which is the timeout miniupnpc uses internally as well, when discovering
internet gateways.
2025-02-23 04:41:43 +01:00
Dunedan fcd3fc2aa3 Create port forwarding for correct port with UPnP
Up to know the UPnP logic ignored the port a user was hosting a game on
and always added a port forwarding for the default port UDP 20595. This
commit fixes that, so a port forwarding is added for the actual port a
game is hosted on.
2025-02-22 20:26:30 +01:00
Dunedan 75d343293f Remove "useLongStrings" logic
As it turns out we don't need that special logic for handling the "long"
locale properly and everything continues to work as before without it.

The only difference is that the number format not being the one from
en_us anymore when using the "long" locale, but the one of the
system-wide configured language, which should be an even better user
experience than before.
2025-02-22 18:18:42 +01:00
Lancelot de Ferrière c475cc2265 Cleaner debug serializer output
The debug serializer currently outputs data even for components where `Serialize = null`.
This leads to useless data being output, especially in OOS debug states which makes diffing more annoying.

Noted in #7634
2025-02-21 18:20:56 +01:00
Vantha aec5bf42da Layout and code improvements on the welcome screen
Move the lines from the .txt to the .xml .
Add separate objects for each paragraph and icon.
Position the icons depending on the paragraph length in the current
language.

This eliminates potential for breakage during translation.

Fixes #7484
2025-02-20 11:15:57 +01:00
Ralph Sennhauser 9a43c43a33 Avoid gcc warning in json_spirit
Gcc-14 triggers a warning for substitute_esc_chars in
json_spirit_reader_template.h if optimizations are enabled.

../../../source/third_party/jsonspirit/json_spirit_reader_template.h:138:62:
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/char_traits.h:427:56: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775808 or more bytes at offsets 0 and 0 may overlap up to 9223372036854775809 bytes at offset -1 [-Wrestrict]
  427 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));

for with lto enabled

/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/char_traits.h:427:56: warning: ‘__builtin_memcpy’ specified bound between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
  427 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));

This looks like another incarnation of bugs like:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100366

Add quirk to avoid the warning

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-02-19 21:52:50 +01:00
Ralph Sennhauser 8baff65e95 Bump Windows libs for premake5 beta4
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-02-18 17:42:42 +01:00
Ralph Sennhauser df38d4e899 Use new premake lto api if available
Premake v5.0.0-beta4 replaces the LinkTimeOptimization flag with a
function linktimeoptimization, use it if available to avoid deprecation
warning.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-02-18 17:42:42 +01:00