Commit Graph

25989 Commits

Author SHA1 Message Date
Atrik 810d92bf8b Fix auras taking effect in building previews
Auras.CanApply called Visibility's GetPreview(), which doesn't exist,
so auras were applying in preview. Introduced in eb2ff98883.

Add GetPreview() to Visibility.

Fixes #9225
2026-09-16 10:39:26 +02:00
Atrik 0322d039f6 Fix player data not updating on diplomacy change
f39e71cca0 moved the player data refresh after a diplomacy change
into a diplomacy colors change handler, which only runs when
diplomacy colors are enabled. With them disabled, the diplomacy
dialog's stance buttons didn't reflect the new stances.

Refresh the player data directly in the diplomacy notification
handler, before the diplomacy colors are recomputed, and remove
the now redundant diplomacy colors handler registration.
2026-09-14 11:35:19 +02:00
7wells 779021c9dc Fix nondeterministic CinemaManager serialization
Fixes #8867
2026-09-14 11:06:34 +02:00
Linkid fe144f1dc6 Use homogeneous name for Watering Holes
To follow other maps name syntax (`<name> (<number of players>)`), "players" is
removed from the name on the Watering Holes map to keep only the number.
2026-09-13 21:58:34 +02:00
Atrik 950d86336e Fix sortEntitiesAlongLine mutating its lineEnd 2026-09-13 12:15:38 +02:00
Atrik 191549e51c Fix crossed unit-to-target pairing
sortEntitiesForEngagement projects both attackers and targets from
the same origin (avgAttackers) onto the same vector,
so reversing the target array was incorrect.
2026-09-13 12:15:38 +02:00
obelix c3ace13b54 Rename delian_league.json to athen_delian_league.json
Fixes #9217
2026-09-11 23:09:33 +02:00
Lancelot de Ferrière 6a46e74443 Vertex pathfinder: skip vertices with worse g cost
This reduces the number of expensive visibility checks we run,
leading to 5-10% better performance on average.
2026-09-11 15:22:37 +02:00
obelix e407363e13 Fix a reference in the in-game Manual
Reported by forum user Thalatta.

Fixes #9208
2026-09-11 10:23:05 +02:00
Vladislav Belov 58e2c59466 Adds Load with unique_ptr to VFS
Also replaces some usages of Load with shared_ptr by unique_ptr.
2026-09-10 16:39:29 +02:00
Vladislav Belov aecd2b4245 Uses span for vfs instead of passing shared_ptr 2026-09-10 16:39:24 +02:00
Vladislav Belov 1b4397d2ae Adds final to VFS 2026-09-10 16:39:18 +02:00
Vladislav Belov 571047a64a Adds explicit check for VFS create alignment 2026-09-10 16:39:14 +02:00
Vladislav Belov 4ae50fd4a4 Reduces memory peak during window resize 2026-09-10 15:38:55 +02:00
Vladislav Belov 63e05d3c65 Removes unused updateFlags from GPU skinning 2026-09-10 15:27:18 +02:00
Vladislav Belov 100a13343a Uses default group for vertex buffer for skinning 2026-09-10 15:27:14 +02:00
Vladislav Belov e933d18a36 Moves tracking of requiring update models to upper
We need to track models to update in a single place. SceneRenderer in
that case. It allows us to make ModelVertexRenderer implementations more
straightforward.
2026-09-10 15:27:09 +02:00
Vladislav Belov a374411279 Separates preparing for rendering of CPU skinned
Only CPU skinned models require preparing for rendering to mark vertex
buffer chunks as needed.
2026-09-10 15:27:04 +02:00
Vladislav Belov 39c0dc69e4 Uses std::filesystem to get a file_size 2026-09-10 13:58:28 +02:00
Vantha 1cc3020049 Call buildFirstBase correctly
`this.buildFirstBase` doesn't exist so this caused errors since 8b1e78ae1e
2026-09-10 11:27:27 +02:00
phosit 89ea0ee4af Remove COMPILER_FENCE
Replace it by `std::atomic_signal_fence(std::memory_order::seq_cst)`.
2026-09-08 17:12:28 +02:00
phosit 7bcee2ea0e Remove XERO_ITER_EL 2026-09-08 10:32:51 +02:00
phosit f8ea2c0d49 Remove XERO_ITER_ATTR 2026-09-08 10:32:51 +02:00
trompetin17 c69ded6f30 Fix font fallback for regional locale variants
Add short locale (e.g. "zh") as intermediate fallback between the full
locale (e.g. "zh_HK") and the global default fonts.

Previously, regional variants without explicit font config entries would
skip directly to global Latin fonts, causing CJK characters to display
as "xxxxx".

Reported at:
https://wildfiregames.com/forum/topic/141392-0ad-alpah-28-only-show-some-english-words-correctly-most-words-are-xxxxx
2026-09-07 15:24:25 -05:00
phosit 3b967ab40c Fix format-string in ComponentManager
Introduced in 9822a22573 by switching to `fmt::format`.
2026-09-07 20:42:30 +02:00
Vladislav Belov 551071c5a4 Replaces shared_ptr by span for LoadFile and Store 2026-09-05 12:33:46 +02:00
Ralph Sennhauser 2e13192479 Fix deleting last node in spline
The last node needs to have distance "0" to next node. Do the inverse of
when adding nodes.

Also add some basic tests covering this bug.

Fixes: #4659
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-09-03 10:49:52 +02:00
eZamus e5e22c1deb Spectate Mode: Display Gaia's emblem
Fixes #7592
2026-09-02 10:41:56 +02:00
Fabio Pedretti 54bbef308a Pathfinder: Remove unused ICmpPosition lookup in DistributeAround()
cmpPosition was declared but never read anywhere in the function,
likely left over from an earlier refactor — each unit's own position
is already fetched correctly inside the loop via unitPos. CmpPtr
construction is a pure lookup with no side effects, so removing the
unused instance doesn't change behaviour.
2026-09-01 10:54:32 +02:00
Fabio Pedretti 4dfdfc12b2 Fix: Prevent out-of-bounds memory access in CheckBuildingPlacement
In `CCmpPathfinder::CheckBuildingPlacement`, the boundary check for the
vertical grid dimension (`j > m_TerrainOnlyGrid->m_H`) allowed `j` to equal
`m_TerrainOnlyGrid->m_H`. Since grid indices are 0-based (valid row indices
range from `0` to `m_H - 1`), this boundary condition allowed the loop to
execute with an out-of-bounds row index, leading to an invalid memory
read (`m_TerrainOnlyGrid->get(i, j)`) and potential segfaults.

This patch changes the comparison operator to `j >= m_TerrainOnlyGrid->m_H`,
ensuring that spans extending to or past the grid height bound are properly
flagged as out-of-bounds.
2026-09-01 10:54:32 +02:00
Fabio Pedretti e4e50d7711 MapReader: Reject maps with out-of-range terrain tile texture index
m_Tex1Index is unvalidated (raw .pmp bytes / RMS script) and was used
to index m_TerrainTextures with no bounds check.
2026-08-29 16:19:08 +02:00
phosit d37db2ba07 Remove CStr::ReverseFind
It was only used once. In this case a normal `std::string::find` can be
used.
2026-08-28 09:50:01 +02:00
phosit 89c7aa47ce Remove CStr functions related to std::u16string
It wasn't used. The conversion to `std::u16string` wasn't even defined.
2026-08-28 09:50:01 +02:00
phosit 73d043fde5 Remove CStr::Pad
It was only used once. It can be replaced by fmt.
2026-08-28 09:50:01 +02:00
ShadowOfHassen aa86258751 Added ruins 2026-08-27 11:07:53 +02:00
ShadowOfHassen 14f9c9aaff Add treasure history entries 2026-08-27 11:07:53 +02:00
ShadowOfHassen a6b1318164 Add generic text attribute to credit json parser 2026-08-27 11:07:53 +02:00
Lancelot de Ferrière 2cc0cf457a Fix the callers of GetEffectiveAttackRange's out-of-reach range
Follows db23584fc3 - the caller of GetEffectiveAttackRange's didn't
really use the NEVER_IN_RANGE result properly.
The C++ engine does not handle Infinity (treated as 0).
This also changes MoveToTargetAttackRange to explicitly try to get
closer if the parabolic range is not in range, but it seems like a flat
range could - on the assumption that once we get closer, the terrain
height difference is lower.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière 56f94a6d4d Prevent div by zero in GetMaxReachableParabolicHeight
Introduced by fc3c0d7876.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière 2c699c29cc Fix integer overflow in GetMaxReachableParabolicHeight
range.GetInternalValue() is an i32; multiplying it by 2 before the cast
to i64 could overflow instead of widening, corrupting the divisor. Cast
to i64 first.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière ce119cd461 Fix towers firing at targets they cannot reach
Since 38b33b0484, the range check happened in CanAttack, however the
check there is too permissive.
This meant it was possible for towers to attack certain targets outside
their actual range, depending on the query results and unit AI focus
fire.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière d60e36c74a Remove unused BuildingAI.CheckTargetVisible
FireArrows now checks range/visibility via CanAttack directly (see next
commit), leaving this method unused.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière 63b0f05b43 UnitAI: keep chasing on forced orders.
Following 38b33b0484, units on aggressive stance no longer chase beyond
their own vision, including on player-forced orders. This fixes that
regression.
(Note that approaching and chasing are a bit inconsistent).
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière cb6f46db71 UnitAI: Simplify GetQueryRange and fix issues
38b33b0484 partly rewrote GetQueryRange but ended up with two
bugs/regressions:
- in standGround, melee units used an effective max-range of 0 instead
  of their melee attack max range
- units that have a min-range did not see units within their min-range
  (even though they can move).

This fixes these issues and rewrite the function in a simpler fashion
for readability.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière 3cbcb69e7f Fix Gaia units never finding anything to attack
38b33b0484 added a visibility filter to TestEntityQuery, active whenever
a query sets preferMirages - which UnitAI's attack range query does.
However, those filters do not work for Gaia, and so the query never
returned anything.
2026-08-26 10:55:27 +02:00
Fabio Pedretti 4d721fdab2 RangeManager: Fix off-by-one bounds check in GetLosRevealWholeMap() 2026-08-25 17:47:49 +02:00
Fabio Pedretti 3836f4ea8e Lobby: Fix XmppClient.h include guard typo 2026-08-24 21:36:09 +02:00
Fabio Pedretti d5af8a97c1 Lobby: Remove dead if(true)/else in GuiPollNewMessages()
This is dead since 6fbf036ae4
2026-08-24 21:36:09 +02:00
phosit 058cdf78d9 Remove CStr::Right
It was only a wrapper around `std::string::substr`. The interface
matches the usecase more. In some places it's better to use
`std::string::ends_with`.
2026-08-24 14:05:00 +02:00
phosit 60824e77b9 Remove CStr::Left
It was only a wrapper around `std::string::substr`. In some places it's
better to use `std::string::starts_with`.
2026-08-24 13:34:37 +02:00