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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameengine): crash report names a missing locomotor or science
Olcay Seygan99864ee5b0c0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 14b8d1348..db019c495 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -319,7 +319,7 @@ found and fixed, EA's own, not port damage.**- A mod no longer crashes the match in its first second when Turkiye (Experimental) sits in a seat. Turkiye's buildings are made from America's, and under a mod without the American base they come from Turkiye had no command center to start with. Such a mod now leaves Turkiye out of the army list and out of every Random draw.- Generals' Challenge leaves out a general the mod cannot field. A mod's Challenge list can name a general whose campaign, maps, opponents or army are missing from its files, and picking him crashed the game as the battle started. His portrait stays off the screen now.- A mission saved under a different mod, or under game data that has changed since, says it cannot be loaded instead of crashing the game.-- An INI file that stops the game at startup names itself. The crash report gives the file and the line it stopped on, with what it found there, where it used to say only "Uncaught Exception during initialization." A file saved with a UTF-8 byte order mark, which some editors add, loads; the mark used to hide the first block's name and the whole file was refused.+- An INI file that stops the game at startup names itself. The crash report gives the file and the line it stopped on, with what it found there, where it used to say only "Uncaught Exception during initialization." A unit that names a locomotor or a science the mod never defines gets that name in the report too. A file saved with a UTF-8 byte order mark, which some editors add, loads; the mark used to hide the first block's name and the whole file was refused.- A mod that keeps command buttons or command sets among its unit files gets a crash report naming the file and where those blocks belong. The game used to go down reading them with nothing to say.- Under `-modfactions` a mod's own lists named after a keyword, such as `OCL:` or `FX:`, are found. The name behind the keyword went without the mod's mark, so the game looked for a list of that name outside the mod.- A mod's helicopter that has nothing to fly with in the state it is shot down in falls and spins to the ground like any other, instead of crashing the game.diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cppindex 2ba0cf0e3..4c95be4ec 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp@@ -33,6 +33,7 @@#include "Common/INI.h"#include "Common/Player.h"#include "Common/Science.h"+#include "Common/StackDump.h" // g_LastErrorDump#include <algorithm>@@ -396,7 +397,9 @@ ScienceType ScienceStore::friend_lookupScience(const char* scienceName) constScienceType st = (ScienceType)nkt;if (!isValidScience(st)){- DEBUG_CRASH(("Science name %s not known! (Did you define it in Science.ini?)",scienceName));+ // as retail, a stop; the crash report names the science, which the INI error line does not+ g_LastErrorDump.format("Science '%s' is named but no Science block defines it\n", scienceName);+ DEBUG_LOG(("%s", g_LastErrorDump.str()));throw INI_INVALID_DATA;}return st;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cppindex 1a990623e..1fbd1b584 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp@@ -47,6 +47,7 @@#include "Common/TunnelTracker.h"#include "Common/Upgrade.h"#include "Common/PerfTimer.h"+#include "Common/StackDump.h" // g_LastErrorDump#include "Common/UnitTimings.h"#include "Common/Xfer.h"#include "Common/XferCRC.h"@@ -239,7 +240,9 @@ static void AIUpdate_traceMove( const Object *obj, const Coord3D& framePos, BoolAIUpdateModuleData *self = tt->friend_getAIModuleInfo();if (!self){- DEBUG_CRASH( ("Attempted to specify a locomotor for object %s without an AIUpdate block.", tt->getName().str() ) );+ g_LastErrorDump.format("[LINE: %d in '%s'] %s names a locomotor before any AI module\n",+ ini->getLineNum(), ini->getFilename().str(), tt->getName().str());+ DEBUG_LOG(("%s", g_LastErrorDump.str()));throw INI_INVALID_DATA;}@@ -248,7 +251,9 @@ static void AIUpdate_traceMove( const Object *obj, const Coord3D& framePos, Bool{if (ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES){- DEBUG_CRASH(("re-specifying a LocomotorSet is no longer allowed\n"));+ g_LastErrorDump.format("[LINE: %d in '%s'] %s states locomotor set %s twice\n",+ ini->getLineNum(), ini->getFilename().str(), tt->getName().str(), TheLocomotorSetNames[set]);+ DEBUG_LOG(("%s", g_LastErrorDump.str()));throw INI_INVALID_DATA;}}@@ -269,7 +274,10 @@ static void AIUpdate_traceMove( const Object *obj, const Coord3D& framePos, Bool}if (!lt){- DEBUG_CRASH(("Locomotor %s not found!\n",locoName));+ // as retail, a stop; the crash report names the locomotor, which the INI error line does not+ g_LastErrorDump.format("[LINE: %d in '%s'] %s names locomotor '%s', which no Locomotor block defines\n",+ ini->getLineNum(), ini->getFilename().str(), tt->getName().str(), locoName);+ DEBUG_LOG(("%s", g_LastErrorDump.str()));throw INI_INVALID_DATA;}self->m_locomotorTemplates[set].push_back(lt);