Commit Graph

26053 Commits

Author SHA1 Message Date
phosit d686708c92 Use fmt::format for LOGMESSAGERENDER
The format string can be checked at compile time. It will be easier to
transition to `std::format`.
2026-10-05 20:29:25 +02:00
phosit 43cb3100b6 Use fmt::format for LOGMESSAGE
The format string can be checked at compile time. It will be easier to
transition to `std::format`.
2026-10-05 20:29:25 +02:00
phosit b2496aa9ca Improve translated strings
Remove too much white space; fix "a" vs "an" mistakes...
2026-10-05 17:45:32 +02:00
Stanislas Daniel Claude Dolcini 282cd1eb60 Scan JS for literal audio paths
Audio files referenced directly in GUI/simulation JS strings
(e.g. g_FlareSound, soundfile entries, Ambient tracks) were not
tracked. Add a js_audio_regex scan alongside the existing sprite
scan for both gui/ and simulation/ JS files.
2026-10-03 23:13:47 +02:00
Stanislas Daniel Claude Dolcini 6856ca3349 Fix checkrefs ruff lint/format issues 2026-10-03 23:13:35 +02:00
Stanislas Daniel Claude Dolcini 4bc1938ddc Track many more dynamically-constructed UI texture paths
Several categories of session UI textures were falsely reported as
unused because checkrefs only parsed XML/JSON data files and missed
texture references buried in JavaScript runtime logic.

Entity templates:
- Parse <Identity><Rank> to track session/icons/ranks/{rank}.png
- Parse <Minimap><Icon> to track session/icons/minimap/{icon}.png

Data-driven JSON files:
- Add add_resources(): scan simulation/data/resources/*.json for
  resource 'code' fields -> session/icons/resources/{code}.png
- Add add_status_effects(): scan simulation/data/status_effects/*.json
  for 'icon' fields -> session/icons/status_effects/{icon}.png

Technology files:
- In add_techs(): detect phase_*.json base techs (e.g. phase_city.json)
  and add session/panel_phase_emblems_{phase}.png as a dep

JS scanning (extended):
- Extend the GUI JS literal-path regex to also recognise:
  - 'texture:' sprite modifier prefix
  - full 'art/textures/ui/...' literal paths
  - bare 'session/...' paths used as runtime sprite components
- Also scan simulation/components, simulation/helpers and globalscripts
  JS files (registered as roots) with the same regex so textures
  referenced from simulation code are tracked
- Add _add_unit_action_icon_deps(): parse unit_actions.js for
  'icon': 'X.png' properties -> session/icons/X
- Add _add_status_bar_icon_deps(): parse StatusBars.js AddBar() calls
  for bar type strings -> session/icons/{type}_bg/fg.png
- Add _add_stance_icon_deps(): parse g_Stances in UnitAI.js for
  selectable stance keys -> session/icons/stances/{stance}.png
2026-10-03 22:55:40 +02:00
Stanislas Daniel Claude Dolcini 0a8369c0b8 Scan JS for literal sprite paths, track civ background circles
Two sources of false-positive unused-file warnings:

1. Literal stretched:/cropped: sprite paths in GUI JS files (e.g.
   bell_level0.png, cancel.png, minimap flare textures) were never
   tracked because JS is not parsed for texture deps. Add a regex scan
   of gui/*.js for complete literal sprite paths ending in a known
   texture extension, filtering out dynamic string concatenations
   (+ / ${...}).

2. Per-civ background circle textures (bkg/background_circle_<code>.png)
   are constructed at runtime in MiniMapPanel.js via a template literal
   using the player civ code. Add a dep from each civ JSON to its
   corresponding background circle texture.
2026-10-03 22:55:22 +02:00
Stanislas Daniel Claude Dolcini d8e040f84b Handle <icon> elements in GUI setup XML
Icons defined in setup XML files (e.g. lobby/icons/public.xml) have
sprite attributes that reference UI textures, but the setup parser only
handled <scrollbar>, <tooltip> and <color> tags. This caused textures
like lobby/public.png to be falsely reported as unused by -u.
2026-10-03 22:54:55 +02:00
Stanislas Daniel Claude Dolcini 9419eb55e6 Add JSON registry for C++-hardcoded asset paths
Some engine assets are loaded directly by C++ renderer code with no
corresponding reference in any XML template, actor, or data file that
checkrefs.py can statically trace. Files in mod layers that override
these paths were incorrectly reported as unused.

Introduce source/tools/entity/cpp_hardcoded_assets.json to maintain
the list of such VFS paths alongside their C++ source location and a
description. checkrefs.py reads this JSON via add_cpp_hardcoded_assets()
and marks every matching file in all loaded mod layers as a known-used
root, so mod overrides are no longer flagged.

Initial entries:
  art/textures/terrain/types/water/coastalWave.png
  art/textures/terrain/types/water/foam.png
Both are loaded unconditionally by WaterManager::LoadWaterTextures().

Fixes 2 false-positive unused-file warnings for mod/ water textures.
2026-10-03 22:54:48 +02:00
Stanislas Daniel Claude Dolcini 49aeda6767 Track terrain alphamap PNG files loaded by C++
TerrainTextureManager::LoadAlphaMap() hardcodes 14 PNG filenames and
loads them from art/textures/terrain/alphamaps/<type>/ where <type>
comes from the terrain XML <alphamap> element (defaulting to
"standard"). checkrefs add_terrains() parsed <textures> and
<material> but never read <alphamap> and had no knowledge of the
filenames loaded by C++.

Changes:
- Read <alphamap> from each terrain XML (default "standard") and
  add all 14 hardcoded PNG filenames as deps of the terrain file.
- Always register the "standard" set as roots since C++ loads it
  unconditionally as a fallback, even when no terrain specifies it.

The filenames are kept in sync with the fnames[] array in
source/graphics/TerrainTextureManager.cpp.

Fixes 14 false-positive unused-file warnings for the standard/
alphamap set.
2026-10-03 22:54:42 +02:00
Stanislas Daniel Claude Dolcini d65e51c38b Track LineTexture from Selectable/Overlay/Outline
The entity parser handled LineTexture/LineTextureMask under
Heal/RangeOverlay and MainTexture/MainTextureMask under
Selectable/Overlay/Texture, but had no handling for the
Selectable/Overlay/Outline/{LineTexture,LineTextureMask} path
used by the outline selection ring renderer.

These textures are referenced in e.g. mixins/trading_post.xml and
any other template that sets a custom outline selection style.

Fixes 2 false-positive unused-file warnings:
  art/textures/selection/outline_border_02.png
  art/textures/selection/outline_border_02_mask.png
2026-10-03 22:54:37 +02:00
Stanislas Daniel Claude Dolcini e5c1b68481 Fix <sprites> parser to read <image> child elements
The sprites XML parser iterated sprite.attrib.items() — the attributes
of the <sprite> tag itself — and checked if el == "image". Since
<image texture="..."> elements are children of <sprite>, not its
attributes, this check could never be true. No texture dependency was
ever extracted from any sprites definition file.

Fix by iterating sprite.findall("image") and sprite.findall("effect")
to correctly traverse child elements, and read attributes from those
elements directly.

Fixes 99 false-positive unused-file warnings across global/border/,
global/button/, global/modern/, global/watermark/, loading/,
pregame/, session/, and tipdisplay/ UI texture directories.
2026-10-03 22:54:30 +02:00
Stanislas Daniel Claude Dolcini 806225a5d4 Track default music tracks from music.js and cheats
checkrefs.py only traced music files referenced in civ JSON Music[]
arrays. Two additional sources were missed:

- gui/common/music.js DEFAULT_*_TRACKS prototype arrays define fallback
  playlists used when a civ has no music entries. All .ogg filenames
  found in that file are now added as deps of the music.js root.
- simulation/data/cheats/*.json files can reference audio files via
  Data.DefaultParameter (e.g. retroMe.json -> 0_8Bit_Bonus_Track.ogg).
  These are now tracked as deps of each cheat root.

Fixes 10 false-positive unused-file warnings.
2026-10-03 22:54:15 +02:00
phosit abf9d5ce00 Fix typos and word doubling in translation strings
Fix strings affecting translations: actually translated strings and
translation context.
2026-10-03 09:39:07 +02:00
Fabio Pedretti 5877ed59bf rms: remove misleading "Placing docks" log calls inside maps
The same "Placing docks" log call is already used inside placeDocks
function, which is called just after these log calls.
Remove as it is useless and confusing.
2026-10-02 21:55:04 +02:00
phosit a0b7b249ee Add back the space between playername and index
The space has been mistakenly removed in ae936e8177.
2026-10-02 21:32:45 +02:00
Dunedan fe8f7e4de0 Consolidate ToS and ToU into a single document
Since they got introduced, there were separate documents for the Terms
of Service and Terms of Use for the multiplayer lobby. However, these
documents were rather short and it wasn't immediately clear, what the
difference between them is.

To simplify the process of reading and acknowledging the terms of the
multiplayer lobby, this consolidates the former Terms of Service and
Terms of Use in a single document. This results in players having to
read two documents (Terms of Service and Privacy Policy) instead of
three when registering for the multiplayer lobby. This makes the
registration process smoother and will in the best case result in more
players actively reading the documents.
2026-10-02 19:25:11 +02:00
Vantha f903a20486 Hide scrollbars if they don't have any effect
Scrolling up and down might not do anything (not even a little bit) not
only if the max pos is 0, but also if it's smaller than 1. It depends on
the parent's position and whether or how the rendered rounds positions
of the scroll content. E.g. text positions are rounded up.
It's preferable to hide the scrollbar if it's between 0 and 1, cutting of
1 single pixel in unfortunate cases is better than rendering a useless
scrollbar.
2026-10-02 12:39:04 +02:00
Ralph Sennhauser cfb8ee9225 Fix ModeTToPerms
Needs bitwise AND instead of OR, else irrespective of filemode requested
all permissions are given in CreateDirectories.

Fixes: 43e7dbc6da
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-09-30 17:03:11 +02:00
Vantha d412813f25 Fix crash due to uninitialised LOS framebuffer
The issue was introduced by fd976456d7 and made appearant by
67c96094f0.
If a cinema path was played right at the start of a game, then the
smooth LOS rendering option was disabled before `InterpolateLOS` was
called for the first time, so in turn when `ConstructTextures` was
called for the first time, it didn't fill the `m_SmoothFrameBuffers`
and `m_SmoothTextures`. And when smooth LOS was enabled again (by the
cinema path ending), `ConstructTexture` wasn't called again by
`RecomputeTexture` since `m_Texture` already existed. This means that
the `m_SmoothTextures` and `m_SmoothFramebuffers` remained unfilled,
which then caused a crash when they were accessed and used in
`InterpolateLOS`.
Since creating the shader and filling `m_SmoothTextures` and
m_SmoothFramebuffer` isn't expensive, the simplest solution is to always
do that no matter if smooth LOS is enabled or not.
2026-09-30 17:00:18 +02:00
phosit 5715f5b63d Open the page returned from the join dialog
Fixes: #9243
2026-09-30 10:42:37 +02:00
Ralph Sennhauser dfa16d185f Use absolute path in CreateDirectories
This allows to create nonextising relative paths, this is useful for
example for `HOME=tmp ./binaries/system/pyrogenesis` running pyrogenesis
with a default config.

Fixes: 43e7dbc6da
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-09-29 13:41:53 +02:00
eZamus 767a676685 Rename teamslocked to teamlocked in Petra AI
Refs: #9180
2026-09-29 09:50:58 +02:00
Vantha 159d3390b2 Fix CinemaOverlay hiding too late
This patch fixes the issue that the CinemaOverlay was hiding one turn
after the cinema paths stopped playing.
That was happening because `CinemaOverlay.OnSimulationUpdate` was called
before `OnSimulationUpdate` in session.js, so it read last turn's sim
state. Making it a simulation update handler ensures the sim state is
up-to-date once it's called.
2026-09-28 15:19:33 +02:00
Vantha a55ffa8ba8 Complete the cinema path timescale implementation
This patch fixes the previously broken implementation of the timescale
property of cinema paths, now cinema paths with timescale 0.5, for
example, play twice as fast.
Unlike the comment stated, negative timescales weren't actually
supported, which is now enforced.
For demonstration, the timescale of the demo map's path is changed to
0.85.
2026-09-28 15:19:33 +02:00
Vantha 7dfdfbeaef Remove m_PathQueueDuration and m_QueuePlayingElapsedTime
Both aren't actually necessary for the functionality, so removing them
just simplifies the script.
2026-09-28 15:19:33 +02:00
Vantha f87e149141 Remove unused m_QueueEndedElapsedTime
Oversight of d882ab74a1
2026-09-28 15:19:33 +02:00
Vantha 7c32cf81d4 Serialize CCmpRangeManager::m_LosRevealWholeMapForAll
Oversight of c7247936bf
2026-09-28 15:19:33 +02:00
Vantha 3b50a02f17 Don't call StartPlayingQueue after deserializing
There is no point in calling `CCmpCinemaManager::StartPlayingQueue`
again after deserializing, `m_WasMapRevealed` is (de)serialized anyway
and that call always overwrote it to false, which caused OOS.
2026-09-28 15:19:33 +02:00
Vantha 9923d0d508 Fix OOS issue in CCmpCinemaManager::UpdateActivePath
`UpdateActivePath`, which is called each frame during rendering, mustn't
call `StopPlayingQueue`, since that impacts the serialized simulation
state.
And it is safe to assume `!m_PathQueue.empty()` if
`m_IsPlayingPathQueue`
2026-09-28 15:19:33 +02:00
Vantha d269faf336 Send CinemaQueueEnded message at the proper time
Only send the CinemaQueueEnded message at the end of
`CCmpCinemaManager::StopPlayingQueue`, after resetting everything.
The other components would expect the queue to actually have ended
(`CCmpCinemaManager::IsPlayingQueue` to be returning false) when
receiving the message.
2026-09-28 15:19:33 +02:00
Vantha 2de7bfcce5 Remove unused OverrideVisible flags
They were forgotten to be removed in 5a4e8e1896
2026-09-28 15:19:33 +02:00
Aaron Muir Hamilton e2eb02fa59 Refresh the replay list after deleting replays.
Before this, starting a replay after a deletion loaded and ran the
replay in the background without dismissing the replay list, and
starting another one crashed on an assertion.

Fixes #9246
2026-09-27 19:37:01 +02:00
eZamux 08194a1d56 Show packing/unpacking time in tooltip
Fixes #8929
2026-09-25 14:49:46 +02:00
phosit a056f0f516 Store the distribution in the particle-var
A distribution is statefull it might store some unused entropy so that
the rng might be called less ofthen.
So this commit might increase the object size and improve performance.
2026-09-25 11:48:36 +02:00
trompetin17 0ed48b3a1f Add viewer entity template and update entity naming in ActorViewer
After #7164, entities in the ActorViewer are loaded through the
preview filter, which disables shadows by design. As a result, the
shadow toggle no longer has any visible effect.

Adds a dedicated viewer.xml template so the ActorViewer no longer
inherits the preview filter's shadow behaviour, keeping preview.xml
untouched for the entities that legitimately need shadows off.

Refs #7164
Reported by: Vladislav
2026-09-24 09:10:47 -05:00
Dunedan ab7d3b8c00 Non-breakable space between icons and values
Make the space between resource icons and values in tooltips
non-breakable, to avoid them getting split across two lines of text.

Fixes #9164
2026-09-24 12:24:38 +02:00
Atrik 0adb53e30b Add notifications when a player capture a relic
Fixes #8683
2026-09-24 12:20:01 +02:00
Atrik 46db652641 Ensure buildings always own territory they are on
Territory influence weights could cause other players' territories to
overlap with buildings, leading to incorrect territory ownership and
buildings decaying even when they should be within their own territory.

This fix ensures that all tiles occupied by a building's footprint are
always owned by the building's owner, regardless of influence weights
from nearby structures.
2026-09-23 14:04:41 +02:00
Vladislav Belov b75edb9b3f Replaces HostHasSSE by SDL_HasSSE
SDL also includes fixes for E2K:
https://github.com/libsdl-org/SDL/commit/67f0b9b86dd16c38b8d4c6e16cceaa166d31a83e
2026-09-22 21:57:57 +02:00
phosit 7b188fb71c Remove lib/types.h
This file is now almost empty.
It was included in some files which didn't required it.
2026-09-21 18:12:08 +02:00
phosit 281e8cd862 Remove uint
It's better to use the native types.
2026-09-21 18:11:47 +02:00
phosit ae7801c9c7 Remove u64
It's better to use types from the standard library.
2026-09-21 18:11:38 +02:00
phosit 6a0c8c1a5a Remove u32
It's better to use types from the standard library.
2026-09-21 18:11:31 +02:00
phosit 500606e587 Remove u16
It's better to use types from the standard library.
2026-09-21 18:11:22 +02:00
phosit 00ee825374 Remove u8
It's better to use types from the standard library.
2026-09-21 18:11:14 +02:00
phosit a4f5cbc23e Remove i64
It's better to use types from the standard library.
2026-09-21 18:10:59 +02:00
phosit 3e7263f0db Remove i32
It's better to use types from the standard library.
2026-09-21 18:10:39 +02:00
phosit b7c310535d Remove i16
It's better to use types from the standard library.
2026-09-21 18:10:26 +02:00
phosit 6ccc54ad6c Remove i8
It's better to use types from the standard library.
2026-09-21 18:10:08 +02:00