Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameclient): a second weather override no longer loops the chain

Olcay Seygana775f4a438ca
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 78503f593..fc07a4c49 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1653,7 +1653,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
- Crash fixes: ordering an upgrade with a Supply Drop Zone, a GLA Hole or a captured Oil Derrick selected, a map that shows a counter it never set, a camera shake at a waypoint that is not there, and closing a menu while it animates. A map message with a percent sign in it shows as written.
- Stopped sounds really stop. A destroyed unit's engine loop and a turret's turning loop no longer play on, and the Idle Worker tooltip shows its key.
- A damaged map sends you back to the menu with a box naming it as damaged, instead of closing the game. A map file is whatever its maker handed you, and the reader trusted every count in it: a height map claiming four billion cells, a trigger with a negative number of points or a tile class pointing past its table either crashed the game or read on into the next part of the file, where every machine found different garbage. Each count is checked against what the file can hold now, and a map that fails is left out of the list or refused at the start, the same way on every machine in the match.
-- A custom map's rules last for that match only. A map.ini could rewrite a weapon, a sound, a particle effect, an FX list, the water or the snow, and the next match on another map played with the change still in it, so two players who had played different maps before were running different rules. Every store a map may touch puts the game's own values back when the match ends, and a block a map has no business changing (the mouse, the multiplayer colours, the campaigns) is skipped with the rest of the file still loading. A map.ini that raised a unit's price showed it on the button and charged the old one; it charges what the button says now. Values no sane map uses, a build time of a hundred years or a snowstorm a million flakes wide, are refused one line at a time.
+- A custom map's rules last for that match only. A map.ini could rewrite a weapon, a sound, a particle effect, an FX list, the water or the snow, and the next match on another map played with the change still in it, so two players who had played different maps before were running different rules. Every store a map may touch puts the game's own values back when the match ends, and a block a map has no business changing (the mouse, the multiplayer colours, the campaigns) is skipped with the rest of the file still loading. A map.ini that raised a unit's price showed it on the button and charged the old one; it charges what the button says now. Values no sane map uses, a build time of a hundred years or a snowstorm a million flakes wide, are refused one line at a time. A map that set the weather twice, in its map.ini and its solo.ini, froze the game while it loaded; it loads now.
## Units take corners wide, and drive round a jam instead of into it
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Snow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Snow.cpp
index 701e28235..6940caec3 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Snow.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Snow.cpp
@@ -140,6 +140,10 @@ void INI::parseWeatherDefinition( INI *ini )
WeatherSetting* ws = (WeatherSetting*) (TheWeatherSetting.getNonOverloadedPointer());
WeatherSetting* wsOverride = newInstance(WeatherSetting);
*wsOverride = *ws;
+ // the copy took the base's next-override pointer too; hung off the end of a chain that already
+ // has one (map.ini and solo.ini both with a Weather block) it pointed back into the chain, and
+ // every walk of it spun for ever
+ wsOverride->setNextOverride(NULL);
// Mark that it is an override.
wsOverride->markAsOverride();