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(gameengine): seatless observer no longer crashes on quit

Olcay Seygan5b212ab973d6
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp
index f30461070..32c19da14 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp
@@ -1025,6 +1025,11 @@ Bool GameInfo::isMultiPlayer(void)
Bool GameInfo::isSandbox(void)
{
Int localSlotNum = getLocalSlotNum();
+ // -observer with -takeover watches the match from no seat at all: nobody here plays, so there is
+ // no team to be against and no result to record. The score screen asked this on Alt-F4 out of
+ // such a match and read slot -1.
+ if (localSlotNum < 0)
+ return TRUE;
Int localTeam = getConstSlot(localSlotNum)->getTeamNumber();
for (Int i=0; i<MAX_SLOTS; ++i)
{