Commit graph

24995 commits

Author SHA1 Message Date
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
Ralph Sennhauser
4720033ef9
Don't use premake for setting Wextra on Unix
Move -Wall to where the other warnings are enabled so everything is in
one place.

Fixes: #5329
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-21 19:24:12 +02:00
Ralph Sennhauser
24a5b72020
Cleanup compiler warnings declarations
Remove '-Wno-switch' and '-Wno-invalid-offsetof' as they do no longer
suppress any existing warnings. Also group warning disablers together.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-21 19:24:12 +02:00
Ralph Sennhauser
f2b2222284
Fix msvc truncation warning
The CI warns but doesn't fail, explicitly cast to float and while at it
use constant for PI/2.

```
source\graphics\cameracontroller.cpp(303): warning C4305: 'argument': truncation from 'double' to 'float'
```

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-21 08:27:45 +02:00
trompetin17
0ebcc45237
Refactor GetNextChunk for clarity and safety
Replaces the for(;;) loop in GetNextChunk with a clearer while
(bytesRead < size) loop for better readability and intent.

Other improvements:
- Uses constexpr for constant audio format parameters
- Replaces C-style cast with reinterpret_cast
- Ensures consistent use of static_cast for type conversions
- Improves comment formatting

This refactor maintains the original logic while aligning with modern
C++ best practices.
2025-06-20 10:49:23 -05:00
trompetin17
0396d67d26
Apply consistent naming to member variables in ogg.cpp
Renames local variables in the class to follow the member naming
convention using the m_ prefix (e.g., m_Adapter, m_VF, m_FileEOF).
2025-06-20 10:49:16 -05:00
trompetin17
6b9652050c
Use std::copy_n in VorbisBufferAdapter::Read
Replaces a raw memcpy call with std::copy_n in VorbisBufferAdapter::Read
for improved type safety and readability. This ensures cleaner buffer
copying using standard C++ algorithms, avoiding manual pointer
arithmetic on void*.

The change is functionally equivalent but aligns better with modern
C++17 practices.
2025-06-20 09:04:09 -05:00
trompetin17
1d20adc3b9
Ensure brace initialization for member variables in Ogg classes
This commit updates the Ogg-related classes to use uniform brace
initialization ({}) for member variables where applicable. Brace
initialization improves clarity and prevents potential narrowing
conversions or unintended behavior caused by default constructor
ambiguity.

This change improves consistency and aligns with modern C++ best
practices, especially in C++11 and later where brace initialization is
recommended for safer initialization semantics.
2025-06-20 09:04:01 -05:00
trompetin17
2ae95d3c49
Refactor OggStreamImpl to use exceptions for error handling
Introduce a new `Open` method in `OggStreamImpl` that encapsulates the
logic for opening Ogg Vorbis files. This method replaces the previous
`Open` method and utilizes `std::runtime_error` for error reporting
instead of returning error codes. The constructor has been updated to
call this new method, ensuring files are opened upon instantiation. The
changes streamline the code and improve error handling.
2025-06-20 08:51:39 -05:00
trompetin17
336ff333ed
Remove unused OpenOggStream method
OpenOggStream was previously used to stream Ogg files directly from the
file system. It operated on raw file paths (OsPath) and assumed
uncompressed, unarchived files, which made it unsuitable for working
with files inside archives or VFS layers.

However, its usage has been fully replaced by OpenOggNonstream, which:
- Reads the entire file into memory (non-streaming),
- Works with virtual file systems (VFS),
- Supports both archived and compressed assets,

Is already used consistently across debug and release builds.

There are no remaining references to OpenOggStream in the codebase, so
this commit removes the unused function and its associated logic.
2025-06-20 08:41:39 -05:00
Itms
406565f3c4
New appdata entry for A27.1
Fixes #7986
2025-06-20 11:48:53 +02:00
Ralph Sennhauser
4c165dd208
Update some includes for iwyu part 1
First batch of fixes to please include-what-you-use.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-20 09:01:19 +02:00
phosit
1652e82021 Use std::unique_ptr for CSimulation2Impl
Using a `std::unique_ptr` it's explicit that the data is owned by the
`CSimulation2`.
2025-06-19 22:12:52 +02:00
phosit
2d43ca6462 Make rmgen2 modules
As rmgen2 depends on rmgen it has to be converted to modules before
that.
rmgen2 contains some globals which don't have to be exposed.

Refs: #8081
2025-06-19 19:07:08 +02:00
phosit
93666d8628 Remove ignore_result
`std::ignore` serves the same purpose and is C++ standard.
2025-06-19 19:05:56 +02:00
trompetin17
5b8cb7f34b
Support std::optional in FromJSVal
This commit introduces support for std::optional<T> in
Script::FromJSVal. When a JavaScript value is undefined or null, the
resulting optional is set to std::nullopt; otherwise, the value is
converted and wrapped.

This change allows components to cleanly handle optional script values
without needing manual null checks or exception handling in C++.

As a direct application of this feature, the Identity component now uses
std::optional<std::wstring> for the return value of GetCiv(). This
resolves a bug where formation templates (e.g., those inheriting from
template_formation.xml) do not explicitly define a civ. After commit
03f7903fec, the code assumed GetCiv() would always return a valid
string, leading to undefined behavior when it was missing.

With this update:
- GetCiv() returning undefined results in an empty optional.
- The Identity component defaults to an empty civilization string ("")
  when the civ is not defined.
- This avoids crashes or actor parsing errors for civ-less templates and
  improves robustness in script-C++ interaction.

Closes: #8107
Fixes: #8091
2025-06-19 08:52:24 -05:00
trompetin17
007b4f5db7
Improve error logging for failed JS-to-C++ script conversions
Previously, if a JavaScript function returned a value that failed to
convert to the requested C++ type (e.g., from JS undefined to
std::wstring), the ScriptInterface would fail silently, making debugging
difficult.

This commit improves the error reporting in the script system by logging
the name of the JavaScript function being called when a type conversion
failure occurs. This makes it easier to trace and fix issues arising
from script-side inconsistencies or missing return values.

The improved logging is particularly useful for debugging errors such as
undefined civ values from GetCiv() when used via m_Script.Call<T>().
2025-06-19 08:52:23 -05:00
Itms
aaccd6ba97
Explictly set the LFS remote URL for all forks
As the Gitea LFS server does not abstract access to LFS remotes
(see https://github.com/go-gitea/gitea/issues/17715), it is necessary to
explicitly set the main repository as LFS storage, including for forks.
2025-06-19 12:53:26 +02:00
Ralph Sennhauser
ddb738b17d
Remove empty cpp file vfs_path.cpp
Once upon time there was content but no more, so remove it.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-19 09:03:38 +02:00
Ralph Sennhauser
0108ff51f4
Fix no-pch build after b34f4b79aa
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-18 21:12:33 +02:00
phosit
11b92f784f Decrease interval of hotload check on mac
There are 8 hotloads in the tests. When each takes 1 second that adds 8
seconds to the tests. Decrease the interval value to an acceptable
number.
2025-06-18 14:42:13 +02:00
Stan
85bb494c17 Catch more file changes on mac 2025-06-18 14:42:13 +02:00
Stan
6a0dfa6dc1 Test whether some files are reloaded more directly
Add a way to tell whether `ReloadChangedFiles` actually catched events
by returning `INFO::SKIPPED` when it didn't.
Unlike GUI apps, you have to explicitely tell macOS to punp events in
console apps thus add a loop in the tests.
2025-06-18 14:42:13 +02:00
Stan
2a47bbf096 Use a mutex to syncronize g_QueuedDirs
`g_QueuedDirs is accessed by multiple threads. It has to be syncronized.
2025-06-18 14:42:13 +02:00
Stan
8b58d8865c Don't use ".." to get the data-directory
`sys_ExecutablePathname().Parent()/".."/"data";` was causing realpath to
pail on macOS, because ".." doesn't match any directory.
2025-06-18 14:42:13 +02:00
phosit
0698243dd1 Don't skip tests on mac
The tests where accidetally skipped on mac because it's treated as BSD.
2025-06-18 14:42:13 +02:00
phosit
d9795d29fe Remove the name of some unused arguments
Remove some usage of the `UNUSED` macro. Remove only those cases where
the names can be deduced from their type.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-unused
2025-06-18 12:49:59 +02:00
trompetin17
084b141ecc
Fix MatchSettingsDialog after b34f4b79aa
Reported by wow on irc:
ERROR: JavaScript error:
gui/session/match_settings/MatchSettingsDialog.js line 55 undefined has
no properties
rebuild@gui/session/match_settings/MatchSettingsDialog.js:55:3
init@gui/session/session.js:320:3
reallyStartGame@gui/loading/loading.js:22:9  ERROR: GUI page
'page_session.xml': Failed to call init() function
2025-06-17 23:27:18 -05:00
Ralph Sennhauser
657be906fe
Cleanup use of boost::filesystem
Suppressing boost warnings is already covered by how we include
libraries if there are actually still any of them relevant.

Then the v2 vs v3 stuff is obsolete as boost ships with filesystem v4
this days.

Lastly injecting a namespace alias via pch header is questionable, so
just don't.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-17 21:56:04 +02:00