Commit Graph

1526 Commits

Author SHA1 Message Date
Ralph Sennhauser 99bbc24265 Remove global g_xres and x_yres
Instead query g_VideoMode where needed. As both g_xres and g_yres aren't
global anymore remove static from UpdateRenderer. While at it use more
desicriptive names: GetXRes -> GetWindowWidth, GetYRes ->
GetWindowHeight.

This reduces the amount of variables tracking width and height by one
each.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-08 11:35:46 +02:00
Ralph Sennhauser 3b9ec75e28 Split out View main menu in Atlas
On suggestion by @nifa add a View menu.

Initially move wireframe, smooth framerate and reset camera actions
there.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-08 08:53:02 +02:00
Ralph Sennhauser bc0e043696 Don't allow rotation in atlas bird view
except for rotation around the y axis. This makes the behaviour
consistent with the main game.

Ref: #8931
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-29 20:12:31 +02:00
Vladislav Belov 0538e95793 Makes GameView::GetCamera constant 2026-06-28 17:57:26 +02:00
Vladislav Belov e0d131854d Makes GameView returning reference on camera 2026-06-28 17:57:16 +02:00
Ralph Sennhauser 0bfd703eda Drop XInitThreads workaround
GTK used by wxWidgets on Unix calls it when creating an X11 window as
does SDL. As such this is no longer needed and we avoid a direct
dependency on X11.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-28 09:49:25 +02:00
Vladislav Belov 45cb592f22 Adds ability to enable smooth framerate in Atlas 2026-06-21 11:30:27 +02:00
Ralph Sennhauser f9af0e571a Mark ownership using unique_ptr in Atlas sections
And remove unused destructors.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-21 09:16:11 +02:00
vyordan ec8b420abc Move Script* classes to Script namespace
- Rename ScriptEngine, ScriptContext, ScriptInterface, ScriptRequest to
  Script::Engine, Script::Context, Script::Interface, Script::Request
- Remove 'Script' prefix from filenames:
  ScriptContext.* → Context.*
  ScriptInterface.* → Interface.*
  ScriptRequest.* → Request.*
  ScriptEngine.* → Engine.*
  ScriptConversions.* → Conversions.*
  ScriptExceptions.* → Exceptions.*
  ScriptForward.* → ForwardDeclarations.*
  ScriptStats.* → Stats.*
- Update all includes, forward declarations, and friend classes
- Use namespace Script { ... } in .cpp definitions to avoid repetitive
  Script:: prefix (keeping global callbacks outside)
- Rename internal implementation structs:
  ScriptInterface_impl → Interface_impl
  ScriptFunction → Function
- Update copyright year to 2026 in all touched files
- Suppress pre-existing cppcheck warnings (uninitvar, nullPointer, unknown
  macro) by adding them to suppressions-list.txt (these are not caused
  by this refactor)

Fixes #7516
2026-06-20 17:43:00 +02:00
Ralph Sennhauser 310c4bf028 Add staticbox padding style in Atlas
GTK static box doesn't have padding, so add a style variable to allow
adding a custom padding.

Replace implicit padding with explicit padding where needed.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-20 14:38:42 +02:00
phosit 3af4287f6d Change the return type of event-handler
The return value is more strongly typed.
2026-06-19 20:53:52 +02:00
phosit 47e8a17a41 New input handling system
The new system allows to register all function objects as Input::Handler
not only function pointers.
To not get dangling references a handler is unsubscribed on it's
destruction.
The order in with the handlers are executed has to be specified by the
slot-argument, instead of the reverse order of registration.
2026-06-19 20:53:51 +02:00
Ralph Sennhauser 02d9a083aa Restore visiblity on sim reset in Atlas
The LOS override for all players isn't serialized as such we have to
restore it when resetting a game.

Fixes: #8926
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-19 19:55:42 +02:00
Ralph Sennhauser 628713859f Don't send default setting to engine
Sending default setting on first view of a section/tool to the engine
triggers the "you have changes" mechanism. Sending them just in case
isn't needed unless there is a bug in a different place.

Drop this preemptive measure.

Fixes: #3029
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-19 19:25:09 +02:00
Ralph Sennhauser ca3bacf6c1 Update Atlas sidebar layout
Replace the wxBoxSizer with a wxFlexGridSizer so the gaps between main
elements, typically wxStaticBoxSizer, remain uniform across the tools.

Add a style variable to control the wxFlexGridSizer on platform basis.

Also replace the obsolete wxScrolledWindow by inheriting from
wxScrolled<wxPanel> instead.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-17 18:58:02 +02:00
Ralph Sennhauser fab4a132e1 Fix camera reset under bird view in Atlas
Resetting camera while in bird view should reset birdview flag.

Fixes: 9388692a47
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-16 19:20:53 +02:00
Ralph Sennhauser 6b4ecbdc40 Create dedicated stylesheet for Atlas
This is meant as a central place to tweak layout per platform.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-15 21:27:42 +02:00
Ralph Sennhauser 1ab55e7f2e Remove leftover code from wxCollapsiblePane use
There is a workaround for an old bug with the use of wxCollapsiblePane.
As the widget itself is no longer in use, just remove the now dead code.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-13 18:34:09 +02:00
Ralph Sennhauser b4fe426963 Replace notebook with choicebook
The terrain selection notebook is painful to navigate with a large
amount of tabs. Further the control is broken on macOS. As such replace
the wxNotebook with a wxChoicebook.

Fixes: #8705
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-13 16:57:32 +02:00
Ralph Sennhauser 8cb4f5e4a3 Fix negative content width GTK warnings in Atlas
Interdependent content width in terrain selection panel results in GTK
throwing warnings. Don't expand the grid cell content.

Also wrap the grid to keep spacing consistent and not variable for the
terrain buttons.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-13 13:38:44 +02:00
Ralph Sennhauser 9388692a47 Add bird view to Atlas
Fixes: #2657
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-12 21:54:01 +02:00
Ralph Sennhauser fa9584fdc0 Fix some Atlas header includes
iwyu 0.26 now want's full declaration of TYPE in case of
std::vector<TYPE>, which is good as it allows the header to be
self standing.

There are some other changes suggested in part of the headers not being
updated when they should have been and some due to changes in iwyu
itself.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-12 21:22:36 +02:00
Ralph Sennhauser 7f4377c086 Treat <wx/defs.h> as private header
Add the header to iwyu mappings as private as the wx documentation
doesn't suggest otherwise.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-12 21:22:36 +02:00
Vladislav Belov 4d83aa28e5 Uses SwapChain instead of direct Device calls 2026-06-08 18:27:06 +02:00
Ralph Sennhauser 0599848330 Cleanup Atlas SectionLayout
Don't declare empty constructor and destructor, avoid c-style cast and
remove TODO about a bug that can't be reproduced any longer.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-07 09:36:57 +02:00
Ralph Sennhauser e3afa15966 Cleanup Atlas section headers
Make not otherwise used functions private and use override as
appropriate.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-07 09:36:57 +02:00
Ralph Sennhauser cf5501a35b Support numpad with player hotkey in ActorViewer
KEY_DOWN means we need to check for the "down" values instead of "char"
value which differer for numpad.

Ref: #501
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-05 16:22:28 +02:00
Ralph Sennhauser fcbc3d3f71 Limit max PlayerID in Atlas hotkeys
9 isn't a valid playerID, setting this value causes a JS error
and corrupting the viewport.

Further limit selectable max playerID to what the mapSettings say.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-05 16:22:28 +02:00
Ralph Sennhauser 0c0552a428 Replace M_PI with C++ numbers
C++20 added π (pi) to the standard, replace the C macro globally.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-04 20:29:48 +02:00
Ralph Sennhauser 4379194255 Fix sidepanel layout in Atlas
In many places there are missing gaps/borders and where there are there
are almost random values used (2/3/4/5/8/10/15).

Add missing and standardize on using gaps 5 and 10 pixel only.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-03 19:17:28 +02:00
Ralph Sennhauser a0bb103390 Unwrap SDL_Event
Since C++11 a C typedef'ed union can be forward declared, so the wrapper
is no longer needed.

While at it switch signatures to refs and convert C style casts.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-05-20 19:44:52 +02:00
wowgetoffyourcellphone 5268cb62a6 Persians -> Achaemenids
Persians -> Achaemenids
Pers -> Achae

Addressing Checkrefs

Internal Achaemenid and Persian references

Reported by @Stan`

Update unit_tables.py
2026-05-02 02:50:39 +02:00
joeybadz 77a53121e0 Handle module attributes in checkrefs
Prevents GUI modules from being incorrectly reported as unused files

Fixes #8147
2026-04-20 21:09:25 +02:00
Atrik 0171a58f26 Handle empty Auras reference in checkrefs 2026-04-17 12:32:08 +02:00
Vantha d882ab74a1 Revamp CinemaManager component
Clean up the the implementation, improve the naming, and
add some more documentation as well as more in-depth tests.
2026-03-03 11:25:52 +01:00
Vantha c7247936bf Introduce separate LosRevealWholeMapForAll flag
It was previously stored at the end of the array of per-player flags and
set by calling SetLosRevealWholeMap with the player ID -1. However, ever
since the introduction of observer mode in 883f307b40, -1 is the player
ID of observers everywhere else including for GetLosRevealWhole:
GetLosRevealWhole(-1) always returns true in order to reveal the map to
observers, however, the cinema manager, for example, called it meaning
to find out whether the whole map is revealed to all players.
To fix this and avoid confusion about this in the future, this patch
splits this flag from the per-player flag array and introduces new
functions to set and retrieve it.
2026-03-03 11:25:52 +01:00
Vantha 21a61721a7 LosRevealAll -> LosRevealWholeMap
This name is more descriptive.
And the plan is to split off the extra player value of the vector into
an own flag in the future, and LosRevealAllForAll would have been a poor
name for that.
2026-03-03 11:25:52 +01:00
phosit df18e22277 Remove Script::CreateArray
It's better to construct a js-array from a `JS::RootedValueVector`.
Because it is more strongly typed and the index doesn't has to be
specified when appending an element.
Some usages are replaced with `JS::RootedValueArray`.

Fixes: #8702
2026-02-08 19:27:50 +01:00
Vladislav Belov 70c15abadb Fixes Atlas Terrain panel in dark mode 2026-02-06 15:21:15 +01:00
Vladislav Belov cce01f4d6c Fixes compilation after #8621
Fixes #8685
2026-01-25 16:29:16 +01:00
Chrzanof 5daae13525 Pass device command context by reference in DebugRenderer
Improve the DebugRenderer API by passing the IDeviceCommandContext
as a reference instead of calling g_Renderer.

Fixes: #6650
2026-01-24 11:54:01 +01:00
phosit 153dfe7ef1 Don't use g_GUI in TurnManager
The turn-manager shouldn't know about the gui.
2026-01-23 21:05:14 +01:00
Dunedan 93ce94655d Use @stylistic/brace-style for eslint
Up to now `eslint-plugin-brace-rules` was used to enforce a common brace
style for JavaScript code. This plugin was however updated the last time
over 9 years ago and will be incompatible with ESLint v10, as that
[removes `context.getSourceCode()`][1], the plugin relies on.

To keep the eslint config working with ESLint v10, this replaces
`eslint-plugin-brace-rules` with the [`@stylistic/brace-style`][2] rule
from `@stylistic/eslint-plugin`, a package we already use.

While `@stylistic/brace-style` doesn't offer an option to format braces
in exactly the same way as before, the "allman" style seems to be the
one closest to the existing code.

[1]: https://eslint.org/blog/2025/11/eslint-v10.0.0-alpha.0-released/#removed-deprecated-rule-context-members
[2]: https://eslint.style/rules/brace-style
2026-01-12 21:33:52 +01:00
Cayleb-Ordo 4536190ab4 Update Icon handling of ActorEditor
Previously on non Windows Platforms the Programm would not get its
icon, as the *.rc is not used on e.g. Linux.
Use an xpm File for non Windows Platforms. Use the convenience macro
from wxWidgets to load the icon in a single call.

The icon was converted using GIMP 3.0.6. To avoid `-Wwrite-strings` the
static char* was converted to a const char*.
2026-01-08 11:12:24 +01:00
phosit ba2351611c Remove LoadScripts from CSimualation2
`LoadScripts` and `LoadDefaultScripts` have to be called imediately
after the `CSimulation2` constructor.

By doing the necesarry work in the constructor and removing
`LoadScripts` and `LoadDefaultScripts` the interface of `CSimulation2`
is simplified.
2026-01-01 17:27:54 +01:00
Itms 771bf0ba08 Fix NSIS auto-uninstall
The NSIS script incorrectly passes the default installation dir as
argument for the auto-uninstaller of previous installs.

This is supposed to avoid moving the uninstaller to a temp file, but it
is unclear why that was done, as this leaves the uninstaller behind.

More importantly, now that we have changed the default installation
directory, the auto-uninstall tries to remove the previous install from
the new location, which does nothing and leaves behind several GB on the
disk.
2025-12-28 16:26:41 +01:00
phosit b67faf35c3 Switch main branch to Release 29 2025-12-18 18:16:11 +01:00
phosit 1917d034fd Introduce a namespace in Loader
All functions had a `LDR_` prefix. The prefix is removed.
Functions and globals which are only used in Loader.cpp are now
contained in an anonymous namespace.
2025-12-13 18:58:17 +01:00
Dunedan 0086f005d4 Add Vietnamese as supported language
As 0 A.D. supports full unicode now and Vietnamese language coverage is
at a good level, let's include Vietnamese as supported language.
2025-11-29 15:59:07 +01:00
Dunedan ed1bd1d75b Re-add Catalan as supported language
While Catalan got removed for Alpha 27 because of low coverage, its
coverage is now good enough again to get re-added as supported language.
2025-11-29 09:20:24 +01:00