No description
Find a file
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
.gitea Fix pre-commit workflow to work with Ubuntu 24.04 2025-05-26 16:42:05 +02:00
binaries Fix MatchSettingsDialog after b34f4b79aa 2025-06-17 23:27:18 -05:00
build Remove ignore LNK4098 2025-06-17 11:26:06 -05:00
docs Fix trailing whitespace and add pre-commit hook 2025-06-15 20:08:48 +02:00
libraries Update SVN revision to 28262 in get-windows-libs.bat 2025-06-17 11:26:02 -05:00
source Support std::optional in FromJSVal 2025-06-19 08:52:24 -05:00
.editorconfig Add a Jenkinsfile linter 2025-05-08 19:50:21 +02:00
.gitattributes Move maps XML files out of LFS 2025-06-11 10:33:57 +02:00
.gitignore Add eslint pre-commit hook 2025-05-30 17:30:25 +02:00
.groovylintrc.json Add a Jenkinsfile linter 2025-05-08 19:50:21 +02:00
.lfsconfig Explictly set the LFS remote URL for all forks 2025-06-19 12:53:26 +02:00
.markdownlint.yaml Add a markdownlint pre-commit hook 2024-08-27 10:06:31 +02:00
.pre-commit-config.yaml Fix trailing whitespace and add pre-commit hook 2025-06-15 20:08:48 +02:00
.shellcheckrc Add util.sh shell library 2025-03-30 18:05:56 +02:00
.yamllint.yaml Add yamllint to pre-commit 2024-09-08 13:08:11 +02:00
eslint.config.mjs Enable eslint rule 'no-sparse-arrays' 2025-06-17 19:21:19 +02:00
LICENSE.md Fix trailing whitespace and add pre-commit hook 2025-06-15 20:08:48 +02:00
license_dbghelp.txt Convert license_dbghelp.txt to UTF-8 2024-08-31 17:04:05 +02:00
license_gpl-2.0.txt
license_lgpl-2.1.txt Fix trailing whitespace and add pre-commit hook 2025-06-15 20:08:48 +02:00
license_mit.txt
package.json Use stylistic for deprecated eslint rules 2025-06-10 21:23:23 +02:00
README.md Add more badges to the UI. 2025-03-22 14:11:24 +01:00
ruff.toml Update the pre-commit hooks 2025-05-26 17:19:03 +02:00

0 A.D. Introductory Information

FreeBSD Build Status Linux Build Status macOS Build Status Windows Build Status

Game References Checks Status Pre-commit Checks Status

Bi-Weekly Bundles Status Technical Docs Status Nightly Build Status

0 A.D. (pronounced "zero ey-dee") is a free, open-source, cross-platform real-time strategy game of ancient warfare.

This is currently an incomplete, under-development version of the game. We're always interested in getting more people involved, to help bring the game towards completion and to share the interesting experience of developing a project of this scope.

There are several ways to contact us and find more information:

Running precompiled binaries on Windows

A precompiled, ready-to-play development version of the game is available from a checkout of the nightly-build SVN repository. If you are using the git repository, you have to follow the steps below.

In a checkout of the nightly-build SVN repository, open the "binaries\system" folder.

  • To launch the game: Run pyrogenesis.exe
  • To launch the map editor: Run Atlas.bat or "pyrogenesis.exe -editor"

Compiling the game from source code

The instructions for compiling the game on Windows, Linux and OS X are at BuildInstructions.

Reporting problems

Bugs should be reported on Gitea. For information on reporting problems and finding logs, see ReportingErrors.

Contributing Code

If you want to help out programming for the game, have a look at GettingStartedProgrammers or contact us on #0ad-dev on irc.quakenet.org

Contributing Artwork

If you want to make artwork for the game, have a look at For Artists or visit the forums.

Translating

You can help translating the game at https://www.transifex.com/projects/p/0ad for more information, see Localization