phosit
a0b92764df
Leave g_Game uninitialized when CNetClient throws
...
When it failed to connect to a host `g_Game` was still initialized.
Retrying that crashed the program.
2026-10-17 09:24:00 +02:00
phosit
581503fb82
Fix generating Mediterranean
...
Removing this `printDuration` was forgotten in a80446eb59 .
2026-10-07 16:53:06 +02:00
phosit
ccd7481e5c
Use const char* to print OpenGL messages
...
GCC warns about a stringop-overread. There is no need to convert it to
an `std::string` and back.
2026-10-05 20:29:26 +02:00
phosit
369a7e7e5d
Use fmt::format for LOGERROR
...
The format string can be checked at compile time. It will be easier to
transition to `std::format`.
2026-10-05 20:29:26 +02:00
phosit
ba158aa3ff
Use fmt::format for LOGWARNING
...
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
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
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
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
phosit
5715f5b63d
Open the page returned from the join dialog
...
Fixes : #9243
2026-09-30 10:42:37 +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
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
phosit
a56456495c
Remove debug_printf filtering
...
The filter was rarely used. The implementation was overly complex and
might have filtered out strings that should have been printed.
Tags like "FILES|" have been removed.
For the loader a macro `LOADER_LOG` has been introduced.
2026-09-19 08:52:27 +02:00
phosit
1fc267080d
Deduplicate BuildTextureRGBA functions
...
All of them contain the same loop.
2026-09-17 09:35:39 +02:00
phosit
926d230c6c
Remove classes inheriting TerrainTextureOverlay
...
Those classes only exposed one function. It's better to use
`std::function` for that, because it's not intrusive.
2026-09-17 09:35:39 +02:00
phosit
7a0aead3cd
Remove unused TerrainTextureOverlay parameter
2026-09-17 09:35:38 +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
phosit
3b967ab40c
Fix format-string in ComponentManager
...
Introduced in 9822a22573 by switching to `fmt::format`.
2026-09-07 20:42:30 +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
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
phosit
7892a4f40f
Fix "I will return" button
...
When temporarly leaving a multiplayer game the "I will return" button
didn't work. This was because there was no valid `closeSession`.
Since it requires accessing `this` the function can't be an arrow
function anymore.
Introduced in 2520c45220
Fixes : #9086
2026-08-20 21:35:18 +02:00
phosit
6ffc251114
Make timedconfirmation.js a module
...
Refs: #8081
2026-08-14 12:41:45 +02:00
phosit
0f939b8abf
Make termsdialog.js a module
...
Refs: #8081
2026-08-14 12:41:45 +02:00
phosit
bf0c3af75a
Make mod/gui/pregame/mainmenu.js a module
...
Refs: #8081
2026-08-14 12:41:45 +02:00
phosit
497efe5a99
Make msgbox.js a module
...
Refs: #8081
2026-08-14 12:41:45 +02:00
phosit
609efa7e32
Make modmod/help/help.js a module
...
Refs: #8081
2026-08-14 12:41:44 +02:00
phosit
9adb3e7889
Make modmod.js a module
...
Actions in xml files only has access to the global scope, not the module
scope. So define them in the js file.
Refs: #8081
2026-08-14 12:41:44 +02:00
phosit
2c4f7d85b6
Make modio.js a module
...
Actions in xml files only has access to the global scope, not the module
scope. So define them in the js file.
Refs: #8081
2026-08-14 12:41:44 +02:00
phosit
8918cfb0a7
Make incompatible_mods.js a module
...
Refs: #8081
2026-08-14 12:41:44 +02:00
phosit
756b9b68c5
Expand the tooltip for population cap
2026-08-12 17:17:04 +02:00
phosit
9f6a309434
Readd description for gatherers to the tooltip
...
It was removed in dee2b73c7d since it wasn't noticed that it referred to
the number in the top panel. Adding the number should make this more
clear. The color is only applied to the number instead of the whole line
so that it's harder to mistake it with just some fancy formatting.
Fixes : #7851
2026-08-12 17:17:04 +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
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
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
phosit
a80446eb59
Use the profiler to profile map generation
...
Instead of writing the duration to the console it uses
`Engine.ProfileStart` and `Engine.ProfileStop` to profile map
generation.
Refs: #5263
2026-07-25 10:47:49 +02:00
phosit
4122f0bfb3
Use atomic instead of COMPILER_FENCE for Profiler2
2026-07-24 17:22:44 +02:00
phosit
8b1e78ae1e
Use JS classes for the AI
...
Fixes : #6285
2026-07-23 15:15:59 +02:00
phosit
09671b49a2
Use JS classes for QueuePlan
...
Classes derifed from `QueuePlan` used manual inherintance.
Refs: #6285
2026-07-23 15:12:50 +02:00
phosit
327e70ea82
Use JS classes for Template and Entity
...
`Template` and `Entity` used a costum form of inheritance.
Refs: #6285
2026-07-23 15:12:50 +02:00
phosit
f9de339f85
Use JS classes for Terain-Analysis and InfoMap
...
`TerrainAnalysis` and `Accessibility` used a costum form of inheritance.
Refs: #6285
2026-07-23 15:12:50 +02:00
phosit
ea1026a1cc
Define the terrain states in a dedicated file
2026-07-23 15:12:49 +02:00
phosit
9598c6c2e1
Only clone this.position when it's an object
...
Refs: #8951
2026-07-19 13:01:04 +02:00
phosit
e6f75f2c33
Fix displaying errors of map generation scripts
...
Displaying the error lead to a freeze.
Introduced in d842a134f9 .
2026-07-19 11:17:35 +02:00
phosit
b89ab85415
Export functions from startingStrategy.js
...
The functions were defined on the `Headquarters` prototype. But not all
functions are needed outside of "startingStrategy.js". Also doing it
this way, "startingStrategy.js" and "headquarters.js" had to mutually
import each other.
2026-07-14 10:40:42 +02:00
phosit
ad08462626
Remove the first isResourceExhausted
...
This function is overwritten later.
This redundancy has been introduced in 4e664dd712 before only the
second existed.
2026-07-13 21:15:48 +02:00
phosit
2c44b5301c
Only clone this.targetPos when it's an object
...
When writing 55f2d356ff , I didn't know that `clone` only handles
objects. Now there is an extra path for `undefined`.
Fixes : #8951
2026-07-08 17:00:59 +02:00
phosit
e82f8ac5ac
Log instead of crash on compile error in the gui
...
Refs: #8195
2026-06-21 20:05:39 +02:00
phosit
b0af0971e3
Don't crash on compile error of hotloads
...
Hotload functions aren't expected to throw an error. Instead return the
error to the function who is waiting for the module.
2026-06-21 20:05:39 +02:00
phosit
364d50e184
Move the gameView input handler to CGameView
...
`game_view_handler` isn't global anymore. That makes the interface
simpler and might make the compilation and the runtime faster.
2026-06-19 20:53:52 +02:00
phosit
3bf8e92ed4
Move the profileViewer handler to CProfileViewer
...
`CProfileViewer::InputThunk` isn't global anymore. That makes the
interface simpler and might make the compilation and the runtime faster.
2026-06-19 20:53:52 +02:00
phosit
80d5fd7a52
Move the gui input handler to CGUIManager
...
`gui_handler` isn't global anymore. That makes the interface simpler and
might make the compilation and the runtime faster.
2026-06-19 20:53:52 +02:00
phosit
b2a8f94a20
Move the console input handler to CConsole
...
`conInputHandler` isn't global anymore. That makes the interface simpler
and might make the compilation and the runtime faster.
2026-06-19 20:53:52 +02:00
phosit
596c0c2ddd
Split screenshot from main input handler
...
This enables the screenshot hotkeys in atlas.
2026-06-19 20:53:52 +02:00
phosit
464d40ab61
Split window from main event handler
...
Two globals can be removed.
2026-06-19 20:53:52 +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
phosit
2f2cbb96bf
Remove this.isDeserialized from BaseAI
...
`this.isDeserialized` is only required for AIs which `Deserialize`
function depends on the game state.
2026-06-14 17:52:54 +02:00
phosit
a4b580991b
Move this.turn to PetraBot
...
The `BaseAI` shouldn't make assumptions whether the AI runs every turn.
2026-06-14 17:52:54 +02:00
phosit
babe9e5c18
Remove this.events from AIs
...
`this.events` is only valid during one turn. When it is used in the next
turnn it might be outdated. So it makes no sense to keep it alive untill
the next turn.
2026-06-14 17:52:54 +02:00
phosit
cbce748b8c
Remove moduleName from Petras data.json
...
It was accidentally re-introduced in 88dc947b6a .
2026-06-14 13:21:26 +02:00
phosit
01bd743b30
Correct LoadModal to continue a saved campaign
...
The `closePageCallback` isn't forwarted to the function calling it. Now
it's possible again to continue a saved campaign.
The error was introduced in 76b6725272 .
2026-05-21 21:29:56 +02:00
phosit
34ab0f3938
Disconnect before deleting the session
...
The session was deleted from `m_Sessions` before disconnecting. Since
e7a583adc0 that also deleted the session.
2026-05-17 17:20:37 +02:00
phosit
a95579a046
Fix UI when connecting to a server fails
...
When the connection fails, it wasn't possible to close the progress
window.
Now `PollNetworkClient` also resolves the previous promise.
2026-05-17 17:20:37 +02:00
phosit
3549cc1e6c
Remove the hint that ai-rejoin isn't supported
2026-05-10 14:18:52 +02:00
phosit
b3552ebccb
Clone the position in attackPlan
2026-05-10 14:18:52 +02:00
phosit
e2466e9bd5
Consistently sort the ai-queues
...
When the returned value of the compare function is `0` the order is
preserved. Before the sort, the order between joining clients and
non-joining clients differ.
Additionally sorting by name should make the order consintent.
2026-05-10 14:18:51 +02:00
phosit
6d31e6de89
Serialize the isIdleConfirmed for the AI
...
The AI only noticed for changes to `isIdleConfirmed`. That is done to
avoid recursions and don't send to many messages. But when the AI is
deserialized it get's `isIdle` from the simulation. Leading to an OOS.
2026-05-10 14:18:51 +02:00
phosit
be03605eac
Update unitCollection in attackPlan
2026-05-10 14:18:51 +02:00
phosit
86289a89fd
Clone the bonuses
...
Sometimes the same object was serialized.
2026-05-10 14:18:51 +02:00
phosit
53a67e560f
Sort templateModifications after inserting
...
The insertion order might not be consistent when clients join.
2026-05-10 14:18:51 +02:00
phosit
b572fed672
Consistently sort the build order
...
When the returned value of the compare function is `0` the order is
preserved. Before the sort, the order between joining clients and
non-joining clients differ.
Now everything important (which is used later on) is included in the
comparison. If still `0` is returned it's not importent which element is
taken.
Another solution would be to have one array per category.
2026-05-10 14:18:51 +02:00
phosit
c4dd0040ee
Never serialize an event when it's not owned
2026-05-10 14:18:51 +02:00
phosit
2f86d4a2f8
Don't write entity-metadata when deserializing
...
The metadata where written every the turn of deserialization. When on
the non rejoining client it was only written when that AI makes a turn
and handles the events.
2026-05-10 14:18:51 +02:00
phosit
55f2d356ff
Clone targetPos in attackPlan
...
On a rejoined client the data isn't the same anymore. But it's equal.
Likely this is because the data isn't aquired at the same turn.
This could also be solved more generally by copying all data which is
pushed to the AI. Or by using the same serializer for AI as for the rest
of the simulation.
2026-05-10 14:18:51 +02:00
phosit
3ddf101a06
Inform the AI about builders when initializing
...
This wasn't a problem since there are no builders on a fresh match but
now when deserializing there might be builders.
2026-05-10 14:18:50 +02:00
phosit
9aea56e4a2
Also serialize unitCollUpdateArray in AttackPlan
...
It needs to be serialized so it's known which units to update next.
2026-05-10 14:18:50 +02:00
phosit
f35595610a
Sort entitycollections when adding entities
...
On joining clients entitycollections are always sorted. To stay in sync
non-joining clients also have to sort entitycollections.
2026-05-10 14:18:50 +02:00
phosit
130ea06ce8
Don't add queues when deserializing AttackPlans
...
When deserializing the queues are already there. It was an error to try
to add a queue since sometimes there must not be a queue.
2026-05-10 14:18:50 +02:00