Commit Graph

25036 Commits

Author SHA1 Message Date
Ralph Sennhauser ad3f6e3119 Dissolve external_libraries/openal.h
This header was used to overcome macos openal vs openal-soft header name
difference, for the migration to openal 1.1 and to pass arguments to the
linker on windows in the past. None of this is used anymore so dissolve
the header.

Also fix related headers so one can run include-what-you-use on the
changed files.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-08 19:33:36 +02:00
phosit 9822a22573 Replace ScriptException::Raise in Engine functions
Now exceptions can be thrown. The function throwing exceptions becomes
cleaner and doesn't require a `ScriptRequest` anymore.
2025-07-08 19:11:49 +02:00
phosit 616fa4a006 Handle C++ exceptions in Engine functions
`JSNatives` passed to SpiderMonkey must not throw exceptions. Most
callbacks are wrapped in `ScriptFunction::ToJSNative`.
This commit adds exception handling to `ScriptFunction::ToJSNative` so
that exceptions thrown in the wrapped callbacks are catched and rethrown
as JavaScript `Error`s.
2025-07-08 19:11:49 +02:00
phosit eeeba977ea Don't crash if rl-interface port is already in use
Replace `ENSURE` with recoverable error handling. Introduce a new error
type so that it's distinguishable from other errors.

When such an error occurs the program exits with `EXIT_FAILURE`.

Fixes: #7475
2025-07-07 21:38:52 +02:00
Ralph Sennhauser 5e4b49f65f Fix some includes in source/renderer
Make include-what-you-use happy with some files in source/renderer and
fix what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-07 17:45:54 +02:00
trompetin17 251f599ad2 Expand summary GUI resource columns
Mods can add more resources than the summary screen’s fixed layout
handled, which crashed with:

ERROR: JavaScript error: gui/summary/layout.js:269 headerGUI is null

This patch doubles the column templates (9 → 18) and updates the
iteration logic so extra headers no longer resolve to null. It removes
the need for copy-paste XML edits when mods grow the resource list.

Known limitations
-----------------
* Column count is still static; a future change should generate the
  layout from g_Resources at run-time.
* UI tested at 1080p and 4 K; very small resolutions might require a
  horizontal scroll solution.
2025-07-06 22:33:25 -05:00
Ralph Sennhauser ed4e2587c2 Fix includes in source/maths
Make include-what-you-use happy with files in source/maths and fix what
needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-06 18:24:31 +02:00
obelix 9970706deb Fixes typo in gerousia.xml 2025-07-06 05:57:43 +02:00
obelix bf25c463c5 Correction of the tooltip in gerousia.xml
Add 'and heroes' to the tooltip as this building trains three of them.
2025-07-06 05:57:43 +02:00
wowgetoffyourcellphone af84640a0c Update cape_long_gaul.xml
Fixes the cape not animating while the Gallic skirmisher attacks.
Also has a small formatting improvement.

Fixes #7970
2025-07-05 18:57:15 +02:00
Ralph Sennhauser 461ff6c20c Fix most headers in gui
Make include-what-you-use happy with most of the files in source/gui and
fix what needs to be fixed after including missing compile flags.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-05 12:42:34 +02:00
Ralph Sennhauser 2b5830e82a Add support for specifying pkg-config via env
For cross compiling there is a need to specify an alternative binary for
pkg-config. It's customary to use the environment variable PKG_CONFIG for
this.

Ref: #8135
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-05 09:20:37 +02:00
trompetin17 11a108d00c GameSettingsController: clear stale “Removed” flag
If a human player is set to “Removed” in Game Setup, leaves to the
main menu, and re-enters, they are auto-assigned back to the same
slot but still flagged as removed, triggering an instant defeat when
the match starts.

GameSettingsController::onLoad already reconciles **playerAI** against
current player assignments, but the analogous check for the new
**playerRemoved** setting was missing. The flag therefore survived
persisted-settings reloads.

This mirrors the existing AI-conflict logic and resets the flag
whenever a human player occupies the slot.

Bug reported by *elexis*.
2025-07-03 20:41:39 -05:00
phosit 1ca4dc08fd Enable eslint rule 'no-duplicate-imports'
Enable rule 'no-duplicate-imports' [1] before we use modules heavily.
There where no violations.

[1] https://eslint.org/docs/latest/rules/no-duplicate-imports
2025-07-03 19:19:30 +02:00
Ralph Sennhauser 8227e76845 Restore includes for suppressing warnings on vs2017
Commit d888b10931 remove those headers which have the side effect of
suppressing some warnings on Windows using vs2017. Keep those headers
around for till vs2019+.

Add additional suppressions where needed for spidermonkey headers.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-02 17:40:27 +02:00
Ralph Sennhauser 61326cfca6 Fix some headers in gui
Make include-what-you-use happy with a part of the files in source/gui
and fix what needs to be fixed after including missing compile flags.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-02 13:20:13 +02:00
Ralph Sennhauser 707abee34d Don't export HOSTTYPE in update-workspace.sh
Exporting HOSTTYPE prevents cross compilation as HOSTTYPE is used to
override target host arch instead of detecting it from chosen compiler.
This then results in the wrong arch specific source files to be
included. So just don't set it by default and let it to the user to set
it if he so chooses.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-02 12:58:46 +02:00
Ralph Sennhauser 904957c50f Allow --fix in copyright linter wrapper
Sometimes doing it manually is cumbersome.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-02 12:45:58 +02:00
Ralph Sennhauser 0f39dcf2c3 Fix white-space error in 8b5bcf05d7
The workflow was run before the addition of white-space error check, so
the trailing white-space made it in.

This commit unblocks the CI.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-02 11:56:09 +02:00
Langbart 8b5bcf05d7 fix: adjusts the tooltip for the fire ship
ref: https://gitea.wildfiregames.com/0ad/0ad/pulls/7510#issuecomment-110923
2025-07-02 07:23:03 +02:00
Langbart 86077bc97f fix: remove 'Heroes' in the spart/syssiton tooltip
ref: https://gitea.wildfiregames.com/0ad/0ad/pulls/7510#issuecomment-114268
2025-07-02 07:23:03 +02:00
Langbart 1aae83f20a fix: wrongly owned entities on the skirmishes/isthmus_of_corinth_2p map
ref #6688
2025-07-02 07:23:03 +02:00
Langbart 091e865243 fix: remove redundant splash tooltip
ref 22b72a362b
2025-07-02 07:23:03 +02:00
Langbart 1f074862cd fix: remove unsupported modifications in ram_garrison.json
ref: #6884
2025-07-02 07:23:03 +02:00
Langbart 26a3f4e8aa fix: increase kennel vision
Default vision of 4 is too low when standing in FOW.
2025-07-02 07:23:03 +02:00
Langbart 1e72caa0f6 fix: increase vision for onager
Increase vision range to avoid continuous firing for most structures.
Ref: #6708

Rename onager template to 'siege_onager_unpacked' to follow existing
naming conventions.
2025-07-02 07:23:03 +02:00
Langbart 1f32412e8d docs: update entity classes and categories
checked for missing, redundant and duplicates classes, Removed 'Fire' no tech uses it and classification value is zero
2025-07-02 07:23:03 +02:00
Langbart 834fff776c fix: delist promoted entities on training panel
promoted entities dont need to be listed if the subset unit is present
2025-07-02 07:23:03 +02:00
Langbart db57e58fd5 fix: add missing civ tags to templates
ref: #7438
2025-07-02 07:23:03 +02:00
Vantha 9c8c8bc42a Enable normal-map-specific compression for skins and terrains
Normal maps contain redundant color information and the engine supports
compression algorithms (like DXT5n) optimized for that.
It has previously only been enabled for the water normal maps.

Pull Request: #8114
2025-07-01 13:42:53 +02:00
Dunedan 31d7e4c97f Improve styling of the header of the profiler2 UI
This improves the styling of the header of the profiler2 UI, by applying
the following changes:

- change the spinner animation to actually look like a spinner
- ensure open reports don't overflow the nav bar
- reduce the size of the server port input field
- add some paddings to make everything look more pleasing
2025-07-01 09:56:28 +02:00
Dunedan 07845b0ff5 Apply graph smoothing changes immediately
`onchange()` triggers only when an element looses focus. For the graph
smoothing in the profiler2 UI we want to have the smoothing applied
immediately when modifying the slider, so let's use `oninput()` instead.
2025-07-01 09:35:18 +02:00
Ralph Sennhauser 863b0b90b7 Update headers in i18n
Remove external_libraries headers for icu and tinygettext, as they
neither add any workarounds needed and as quite a few other libraries
don't have such a header either. As for the warnings suppressed, this is
no longer needed as they were fixed and with vs2019 added support for
-isystem or equivalent would make this useless eitherway.

Further make include-what-you-use happy with files in source/118n and
fix what needs to be fixed after.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-01 09:01:00 +02:00
Ralph Sennhauser a606fbf1a5 Fix headers for XML/XMB
Declare "lib/posix/posix.h" as source for <strings.h>

Make include-what-you-use happy with files in source/ps/{XMB,XML} and
fix what needs to be fixed after including missing compile flags.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-01 07:44:06 +02:00
Ralph Sennhauser 758d901883 more objecttype 2025-06-30 21:18:16 +02:00
Ralph Sennhauser af582b09aa fixup! Fix headers for gui/ObjectTypes 2025-06-30 21:09:46 +02:00
Ralph Sennhauser 00f9d887b1 fixup! Fix headers for gui/ObjectTypes 2025-06-30 21:07:53 +02:00
Ralph Sennhauser 49863da3b4 Fix headers for gui/ObjectTypes
Make include-what-you-use happy with files in source/gui/ObjectTypes and
fix what needs to be fixed after.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-30 20:38:16 +02:00
Ralph Sennhauser d888b10931 Fix headers for gui/ObjectBases
Make include-what-you-use happy with files in source/gui/ObjectBases and
fix what needs to be fixed after.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-30 19:56:41 +02:00
trompetin17 571b536e1f Log GUISize/GetTextSize deprecations once
Replace repeated LOGWARNING calls with ONCE(LOGWARNING) in
JSInterface_CGUISize.cpp and JSInterface_Main.cpp.

Why – The old behaviour printed a warning every time the deprecated
API was used, cluttering the log and annoying modders. We still want to
nudge them toward the new APIs (object.size = {...} and
guiObject.GetPreferedTextSize/getTextSize), but a single reminder is
enough.

What changed

CGUISimpleSetting<CGUISize>::DoFromJSVal now wraps the deprecation
message in ONCE(...).

Engine.GetTextSize warning is likewise wrapped.

Impact – Functionality is unchanged; only the frequency of the
warnings is throttled to one per session, making the transition less
intrusive and more user-friendly.
2025-06-29 09:12:21 -05:00
Ralph Sennhauser d8af7b9416 Improve reporting of build environment for premake
Various environment variables may have an impact on what premake will
do, properly report them in the output and consolidate others.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-29 13:58:14 +02:00
Ralph Sennhauser 3a38fcb17c Update lfsconfig comment
Use a colon instead of a backslash to seperate domain from repo. The
backslash only works for pushing and for pulling lfs will complain about
"batch request: missing protocol"

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-29 08:31:50 +02:00
rene 3c457457cd Add tip about lost resources when gathering
Illustration by: Vantha
Feedback by: Vantha, Langbart
Fixes #7652.
2025-06-28 10:39:52 +02:00
trompetin17 3db465587f Fix chat input size assignment typo
Fixes a typo introduced in fd847c2a23 where the code
incorrectly modified chatSubmitButton.size instead of
chatInput.size, effectively collapsing the input field's
width to zero.

This change ensures the chat input field resizes correctly
based on the button's position.

Thanks to Langbarg for noticing the issue.

Refs: #8138
2025-06-27 08:38:38 -05:00
trompetin17 22d3a52b38 Fix chat wrapping by replacing Object.assign
Fixes a bug where chat overlay text wrapping changed
unexpectedly when earlier messages expired.

The issue was caused by Object.assign modifying the size
object in place, which did not trigger proper recalculation
for getTextSize in subsequent frames.

Replacing it with direct assignment ensures the size object
is recompute, allowing correct layout behavior.

Bisected to: fd847c2a23

Thanks to Langbarg for identifying the root cause.

Ref: #8043
Fixes: #8138
2025-06-27 08:38:37 -05:00
Vantha bef29e4af5 Add some new tips 2025-06-27 15:34:44 +02:00
Ralph Sennhauser aabb5854aa Add note for ssh users to .lfsconfig
Users using ssh are suddenly asked for a username and password for lfs,
add a note as to why that is and how to avoid it to the .lfsconfig in
hope they will see it.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-27 15:23:30 +02:00
Dunedan e6c479e956 Show report statistics for single reports as well 2025-06-27 10:04:11 +02:00
Dunedan 7e531ec6fe Add minimum, sum and percentile columns to reports 2025-06-27 10:03:38 +02:00
trompetin17 e845da025a Add deprecation warning to GetTextSize API
Adds a runtime warning to `Engine.GetTextSize` indicating that the API
is deprecated and will be removed in a future version.

This API does not simulate GUI rendering accurately, as it treats markup
tags like [color], [font], or [icon] as visible characters. This leads
to incorrect size measurements in modern GUI layouts.

New recommended alternatives:
- Use `Engine.GetGUITextSize(...)` for accurate measurement of raw text
  blocks, fully simulating GUI rendering.
- Use `guiObject.getTextSize()` when working within a specific GUI
  object, as it accounts for maxWidth, padding (bufferZone), and object
  constraints.

A warning is now emitted at runtime to guide developers toward these
updated APIs.
2025-06-26 17:11:24 -05:00