Commit Graph

25023 Commits

Author SHA1 Message Date
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
trompetin17 b42a2b9adb Apply correct use of TextSize APIs in GUI
Updates GUI code to apply the correct usage of `guiObject.getTextSize()`
and `guiObject.GetPreferedTextSize()`.

- `guiObject.getPreferedTextSize()` is now used when the goal is to compute the
  bounding box of a text string to dynamically resize or layout a GUI
  object accordingly. It simulates how the text would be rendered,
  accounting for markup and layout rules.

- `guiObject.getTextSize()` remains in use when text is being measured
  within a fixed-size GUI element (e.g., a button or label). It respects
  internal constraints like buffer zone and maxWidth, and is typically
  used to align other elements based on its visual appearance.

These changes ensure more accurate text sizing and consistent layout
behavior across GUI components.
2025-06-26 17:11:24 -05:00
trompetin17 19e82ebceb Add getPreferredTextSize to calculate unconstrained text width
Introduces (CButton|CText).getPreferredTextSize, a new method for estimating
the natural width of a caption if the object had no width constraints.

Unlike .getTextSize, which reports the size after applying current
layout constraints (e.g., fixed width or anchors), getPreferredTextSize
answers the question: "How wide would this object need to be to display
the caption on a single line?"

This is particularly useful for modders and layout logic that wants to
dynamically size elements *before* assigning a fixed width or anchoring.
2025-06-26 16:58:32 -05:00
Ralph Sennhauser 7eaea3d181 Update headers in collada
Make include-what-you-use happy with files in source/collada and
fix what needs to be fixed after. Also switch quote with bracket include
where appropriate.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-26 20:05:53 +02:00
phosit 891908b801 Remove UNUSED
The `UNUSED` macro is used to mark a variable as unused but with a name.
Those usages are replaced with comments so that `UNUSED` can be removed.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-unused
2025-06-26 17:25:05 +02:00
phosit dd26f3a802 Restrict param type of FSM events
Previously the param type was `void*` now the type has to be specified
as template parameter of the `CFsm`.
With this commit some casts can be removed.
2025-06-26 16:42:04 +02:00
Ralph Sennhauser 7f67bab7c8 Fix -Wrange-loop-construct in ModIo.cpp
Gcc 15 generates the following warning:

../../../source/ps/ModIo.cpp: In static member function ‘static bool ModIo::ParseModsResponse(const ScriptInterface&, const std::string&, std::vector<ModIoModData>&, const PKStruct&, std::string&)’:
../../../source/ps/ModIo.cpp:738:41: warning: loop variable ‘prop’ of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct]
  738 |                 COPY_STRINGS_ELSE_CONTINUE("", el, "name", "name_id", "summary")
      |                                         ^~~~
../../../source/ps/ModIo.cpp:738:41: note: use non-reference type ‘const std::string’ {aka ‘const std::__cxx11::basic_string<char>’} to make the copy explicit or ‘const char* const&’ to prevent copying
../../../source/ps/ModIo.cpp:749:41: warning: loop variable ‘prop’ of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct]
  749 |                 COPY_STRINGS_ELSE_CONTINUE("", modFile, "version", "filesize");
      |                                         ^~~~
../../../source/ps/ModIo.cpp:749:41: note: use non-reference type ‘const std::string’ {aka ‘const std::__cxx11::basic_string<char>’} to make the copy explicit or ‘const char* const&’ to prevent copying
../../../source/ps/ModIo.cpp:756:41: warning: loop variable ‘prop’ of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct]
  756 |                 COPY_STRINGS_ELSE_CONTINUE("filehash_", filehash, "md5");
      |                                         ^~~~
../../../source/ps/ModIo.cpp:756:41: note: use non-reference type ‘const std::string’ {aka ‘const std::__cxx11::basic_string<char>’} to make the copy explicit or ‘const char* const&’ to prevent copying
../../../source/ps/ModIo.cpp:762:41: warning: loop variable ‘prop’ of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct]
  762 |                 COPY_STRINGS_ELSE_CONTINUE("", download, "binary_url");
      |                                         ^~~~
../../../source/ps/ModIo.cpp:762:41: note: use non-reference type ‘const std::string’ {aka ‘const std::__cxx11::basic_string<char>’} to make the copy explicit or ‘const char* const&’ to prevent copying

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-26 12:39:48 +02:00
Stan dc04f3f432 Fix autofixable eslint warnings for eqeqeq
Ref: #7812
Pull Request: #8129
2025-06-26 11:03:19 +02:00
phosit 0fcc4f5fc5 Split the main-menu into modules
Ref: #8081
2025-06-26 10:50:21 +02:00
phosit dd9ba2fd26 Make the splashscreen a module
Ref: #8081
2025-06-26 10:50:21 +02:00
phosit 77b1addb45 Enable modules in the GUI
Doesn't actually change a GUI-page to use modules. Adopting a GUI-page
now only requires JS and XML changes.

Ref: #8081
2025-06-26 10:50:21 +02:00
phosit b8348bec55 Store the ScriptInterface& in ModuleLoader::Result
During hotloading the `ScriptRequest` was constructed from a
`JSContext*`. That requires that already an other `ScriptRequest` is
active. Which isn't always the case.
Now The `ScriptRequest` is constructed from a `ScriptInterface&`.

Storing a `ScriptInterface&` in the `ModuleLoader::Result` allows to
remove the `m_Result` as it is retrieved from the `ScriptInterface`.
2025-06-26 10:50:21 +02:00
Ralph Sennhauser 25c53cb0ac Enable eslint style rule 'keyword-spacing'
After Stan suggesting change in a review comment just enable the rule
'keyword-spacing' [1] and fix violations so this is no longer a topic in
spirit of #7812.

[1] https://eslint.style/rules/keyword-spacing

Ref: #7245
Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-25 14:34:12 +02:00
Ralph Sennhauser b6e66a5d43 Update headers in lobby
Some gloox headers need workarounds to be included, so mark the header
"lib/external_libraries/gloox.h" as source for all gloox symbols and
collect all headers we use under it.

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

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-25 14:00:44 +02:00