Commit Graph

9432 Commits

Author SHA1 Message Date
phosit 73d043fde5 Remove CStr::Pad
It was only used once. It can be replaced by fmt.
2026-08-28 09:50:01 +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 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
phosit d8bb617962 Remove CStr::Find(int, char)
It was only a wrapper around `std::string::find`. It is unused.
2026-08-23 17:47:02 +02:00
phosit 5071b27bb1 Remove CStr::Find(char)
It was only a wrapper around `std::string::find`. It is only used once.
2026-08-23 17:47:02 +02:00
phosit 982ede2a55 Remove CStr::Find(CStr)
It was only a wrapper around `std::string::find`. In some places it's
now better to use `std::string::starts_with`.
2026-08-23 17:46:52 +02:00
phosit 45ea0432a2 Remove CStr::FromDouble
In most places `fmt::format` is used because it's locale indidendant.
For the user reporter the locale dependant form of `fmt::format` is used
because it's shown to the user.
2026-08-23 12:01:33 +02:00
joeybadz 2add365a4f Add camera view config options
Adds a variety of settings for the camera: scroll speed, zoom speed, smoothness, etc.

Fixes #4638
2026-08-19 04:19:45 +02:00
Fabio Pedretti 811ef65126 Fix: Correct control group iteration in ResolveFoundationCollisions
In `CCmpObstruction::ResolveFoundationCollisions`, the nested loop
intended to assign a persistent control group to colliding normal
entities was incorrectly iterating over `normalEnts` instead of
`persistentEnts`.

This caused the function to attempt to clobber default control groups
with other non-persistent groups, completely bypassing the intended
`ControlPersist` logic.

This patch fixes the inner loop to correctly iterate over
`persistentEnts`, ensuring foundations properly inherit persistent
control groups.

Fixes: 9ae084519f
2026-08-16 13:30:42 +02:00
Atrik 1b07b799ec Add test for queries with visibility checks 2026-08-12 22:40:59 +02:00
Atrik 38b33b0484 Enable attacks on foes visible through shared LOS
Adds baseRange parameter to parabolic queries for combined
2D + parabolic detection. StandGround and Chase stances now
use attack range (parabolic) with vision as baseRange, allowing
units to attack enemies visible through friendly vision.
Buildings benefit as well via BuildingAI.
2026-08-12 22:40:59 +02:00
Atrik fc3c0d7876 Prevent targeting unreachable turreted entities
Introduce CanEverReachTarget in the Attack component to check whether
a target is geometrically reachable at all, accounting for height
offsets and turreted units inside buildings.

For non-parabolic attacks (e.g. melee), a simple 3D distance check
from the closest approach point is used.

For parabolic attacks (e.g. ranged), the parabolic range formula
is used to determine if the height difference is surmountable
from the closest horizontal distance to the target.

Add GetClosestApproachDistanceToTurretPoint to TurretHolder
to estimate the minimum horizontal distance to a turret point,
using its local offset and the holder's obstruction size.
Passable buildings are not considered obstacles.

Fixes units on the ground trying to attack unreachable units on walls
or towers when the projectile's arc cannot reach the required height.
2026-08-12 22:40:59 +02:00
Atrik 2bc895bf0d Rename cmp to rangeManager for clarity 2026-08-12 22:40:59 +02:00
Atrik 3c215aff47 Add some tests for GetEffectiveParabolicRange 2026-08-12 22:40:59 +02:00
Atrik 121d428ebb Fix terrain elevation not affecting attack range
The parabolic range formula in GetEffectiveParabolicRange was only
computating height differences from manual HeightOffset values,
completely ignoring actual terrain elevation.
This meant units on hills received no tactical advantage
despite the UI stat tooltip correctly showing extended ranges.

Fixes #8889
2026-08-12 22:40:59 +02:00
Ralph Sennhauser df72c1aad1 Support scroll-rotate in Atlas
Split mouse wheel scroll handling into horizontal and vertical. Keep
vertical scroll for zooming and use horizontal to rotate around the y
axis replicating the behaviour of the main game.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-08-10 09:00:07 +02:00
Stan f90804c78f Add macOS hint for game mode. 2026-08-07 14:09:25 +02:00
phosit d6bdf51d83 Remove CStr::FromInt64$
For the usecase it's better to use `fmt::format`.
2026-08-06 18:03:05 +02:00
phosit ae936e8177 Remove CStr::FromUInt
There is `std::to_string` which does the same. For most uses it's better
to use `fmt::format`.
2026-08-06 18:03:05 +02:00
phosit 06e199b12a Remove CStr::FromInt
There is `std::to_string` which does the same. For most uses it's better
to use `fmt::format`.
2026-08-06 18:03:05 +02:00
Vladislav Belov c4e7364802 Removes unused BuildColor4ub from ModelRenderer
We don't need to calculate shading on CPU since we always use shaders.

Refs: a9c27b412b
2026-08-06 11:32:02 +02:00
Vladislav Belov 867bdf318b Fixes missing material reference in ModelRenderer
Missed in 18a16aa135
2026-08-06 10:31:16 +02:00
Vladislav Belov e64a138f92 Fixes outdated state on disabling GPU skinning 2026-08-04 23:06:12 +02:00
Vladislav Belov 4a7b7e7df1 Removes smart pointers from ModelRenderer
We don't need to use pointers because we know lifetimes of all
renderers. And its list statically defined. A new renderer should follow
DOD and use a separate submission list with a separate inplace renderer.
2026-08-04 23:06:10 +02:00
Vladislav Belov fa90ddc8b6 Refactors ModelRenderer and makes it closer to DOD
Separates submitted models and moder renderer and makes relations
explicit. Now it's clear that we don't need separate ModelRenderer and
ModelVertexRenderer.
2026-08-04 23:06:09 +02:00
Vladislav Belov 764a420797 Merges ModelRenderer and ShaderModelRenderer
We use only shaders to render models so we don't need a separate class.

BatchModelRenderer was renamed in 6bc33fe8bd.
m_Renderer became unused in 0346ba1b18.
2026-08-04 23:06:07 +02:00
Vladislav Belov 8a2bb10827 Renames ShaderModelRenderer instances 2026-08-04 23:06:06 +02:00
Vladislav Belov af9d102126 Removes legacy logic of reused ModelRendererPtr
It became unused in 4a69e9117e.
2026-08-04 23:06:04 +02:00
Ralph Sennhauser 822092fcb4 Fix set camera tooltip in Atlas player section
Refs: fe192fe58f
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-08-04 17:22:21 +02:00
Ralph Sennhauser 6e79dc2f70 Use dynamic events for Cinema Section
Replace static events with dynamic events and name delete path function
more aptly.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-08-04 17:04:22 +02:00
phosit 7aa756f6a4 Remove line numbers from cppcheck supression list
They have to be changed to ofthen when code gets moved.
2026-08-02 14:03:28 +02:00
phosit e712601602 PreInitGame and InitGame in the Loader
This makes the frame before the simulation starts less stuttery. Doing
it in the Loader also allows to make the progressbar more acurate.
2026-08-02 14:03:28 +02:00
Dunedan 865ca4cd55 Update the pre-commit hooks 2026-08-01 16:19:18 +02:00
vyordan 71be79791f Use turn_id_t (int32_t) for turn-count across simulation, network and replay
CSimulation2 used , CSimulation2Impl mixed /, and
CTurnManager used  for the same turn-count concept, forcing a
static_cast<int64_t> at the one place these types already met
(rejoin-test comparison).

Add  (alias for std::int32_t) in SimulationCommand.h and use
it consistently for every turn counter in CSimulation2/Impl,
CTurnManager and its subclasses (CLocalTurnManager,
CReplayTurnManager), CNetServerTurnManager/CNetClientTurnManager, and
the network wire format (m_Turn in CEndCommandBatchMessage,
CSimulationMessage, CSyncCheckMessage, CSyncErrorMessage, and
m_CurrentTurn in CLoadedGameMessage).

Turn *duration* fields (m_TurnLength, m_CommandDelay,
DEFAULT_TURN_LENGTH, COMMAND_DELAY_SP/MP, SetTurnLength,
GetSavedTurnLength return type) are left as u32 — they're milliseconds,
not a counter, and out of scope here.

Remaining turn_id_t vs size_t comparisons use std::cmp_equal or
explicit casts, matching the existing pattern in Simulation2.cpp.

Fixes #8718
2026-07-31 10:34:20 +02:00
Ralph Sennhauser 49c887b7ca Don't nest Paths in Common settings
Doesn't make sense to have the Paths StaticBox inside the Common
settings StaticBox so make it a top-level item as well.

While at it dissolve nested constructors to make the creation of the
widgets more readable.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-30 18:43:24 +02:00
phosit c7953026dd Use switchPage in autostart
Autostart used `OpenChildPage` to open the loading page. Because it's
started as child page the program doesn't end when closing it.
2026-07-30 12:36:51 +02:00
Ralph Sennhauser 0340cc9abd Make NUSpline public members protected
Add a getter for MaxDistance and make members protected and inline
initialization.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-29 18:44:03 +02:00
Ralph Sennhauser aeeda05433 Prefix NUSpline member variables
To follow coding convention rename the vector Node to m_Nodes,
MaxDistance to m_MaxDistance and NodeCount to m_NodeCount.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-29 18:44:03 +02:00
Atrik b6d9d87ba9 Add a test for ExploreCircle 2026-07-29 18:02:37 +02:00
Atrik 839226d542 Support revealing a small area of the map 2026-07-29 18:02:37 +02:00
Vladislav Belov 4125e5b645 Adds sRGB support to GLES 2026-07-29 01:29:11 +02:00
Vladislav Belov f781181899 Adds sRGB support for proper lighting
Currently we're incorrectly using sRGB colors as raw inputs for lighting
instead of conversion to linear space. For proper PBR we need linear
values.
2026-07-29 01:29:09 +02:00
Vladislav Belov e2f5b20922 Fixes GL internal format of textures in compute
In compute shaders load/store operations requires sized formats.
2026-07-28 23:32:23 +02:00
Ralph Sennhauser cf7b8aab39 Preserve Cinema Path selection
Commit 81c57e8a28 added support for adding and removing paths.
Reloading path list stores the current selection but it's unused, assume
the idea was to restore it again.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-25 17:18:16 +02:00