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
..
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2023-12-03 00:30:12 +00:00
2025-06-18 12:49:59 +02:00
2023-12-03 00:30:12 +00:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-05-24 14:34:09 +02:00
2025-06-18 12:49:59 +02:00
2025-06-10 23:01:09 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2023-12-03 00:30:12 +00:00
2025-05-04 11:22:31 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-18 12:49:59 +02:00
2025-06-15 07:43:08 +02:00
2025-06-18 12:49:59 +02:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2025-06-18 12:49:59 +02:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2025-06-19 08:52:24 -05:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2025-06-18 12:49:59 +02:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2025-05-24 14:34:09 +02:00
2025-05-24 14:34:09 +02:00
2025-05-28 23:05:36 +02:00
2025-05-28 23:05:36 +02:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2025-06-10 23:01:09 +02:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2024-12-30 22:23:05 +01:00
2024-12-30 22:23:05 +01:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2025-01-02 16:59:13 +01:00
2025-01-02 16:59:13 +01:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00
2023-12-03 00:30:12 +00:00