Skip to content

Commit 307dfcb

Browse files
committed
diag(logic): Probe the skirmish side and team records
The AI's default team is copied out of the skirmish team records in Player::initFromDict, and ParseTeamsDataChunk silently drops any team whose owner is not already a skirmish side. Log every team the .scb offers with the owner it names and whether that owner matched, report when SkirmishScripts.scb fails to open at all (which would leave the records empty, since they are cleared just before the parse), and dump what survived prepareForMP_or_Skirmish. Also of note: every file in this failure path is identical to the vibecode port, which does not show the bug - VictoryConditions.cpp, PlayerList.cpp, Dict.cpp and Scripts.cpp match exactly, DataChunk.cpp reads the same widths, and SidesList.cpp differs only by a branch that is unreachable for this map. So this is not a fix that was lost in the re-port.
1 parent 1d89b48 commit 307dfcb

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545

4646
#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine
4747

48+
#ifndef _WIN32
49+
// TheSuperHackers @info TEMPORARY DIAGNOSTIC - see the skirmish probes below.
50+
#include <cstdio>
51+
#endif
52+
4853
#include "Common/DataChunk.h"
4954
#include "Common/GameState.h"
5055
#include "Common/PlayerTemplate.h"
@@ -464,6 +469,12 @@ static Bool ParseTeamsDataChunk(DataChunkInput &file, DataChunkInfo *info, void
464469
Dict teamDict = file.readDict();
465470
AsciiString teamName = teamDict.getAsciiString(TheKey_teamName);
466471
AsciiString player = teamDict.getAsciiString(TheKey_teamOwner);
472+
#ifndef _WIN32
473+
// TheSuperHackers @info TEMPORARY DIAGNOSTIC - teams whose owner is not already a
474+
// skirmish side are dropped silently here, which would leave the AI without a default team.
475+
std::fprintf(stderr, "[GGC_SK] scbTeam name='%s' owner='%s' matched=%d\n",
476+
teamName.str(), player.str(), sides->findSkirmishSideInfo(player) ? 1 : 0);
477+
#endif
467478
if (sides->findSkirmishSideInfo(player)) {
468479
// player exists, so just add it.
469480
sides->addSkirmishTeam(&teamDict);
@@ -568,9 +579,36 @@ void SidesList::prepareForMP_or_Skirmish()
568579
static_readPlayerNames[i].clear();
569580
}
570581
}
582+
#ifndef _WIN32
583+
else
584+
{
585+
// TheSuperHackers @info TEMPORARY DIAGNOSTIC - if this file does not open the
586+
// skirmish team records stay empty, because they were cleared just above.
587+
std::fprintf(stderr, "[GGC_SK] FAILED to open '%s'\n", path.str());
588+
}
589+
#endif
571590

572591

573592
}
593+
594+
#ifndef _WIN32
595+
// TheSuperHackers @info TEMPORARY DIAGNOSTIC - the skirmish AI's default team is copied out
596+
// of these records in Player::initFromDict, so show exactly what survived this function.
597+
std::fprintf(stderr, "[GGC_SK] prepare done: sides=%d skirmishSides=%d skirmishTeams=%d\n",
598+
m_numSides, m_numSkirmishSides, getNumSkirmishTeams());
599+
for (Int probeS = 0; probeS < m_numSkirmishSides; ++probeS)
600+
{
601+
std::fprintf(stderr, "[GGC_SK] skirmishSide[%d] name='%s' faction='%s'\n", probeS,
602+
getSkirmishSideInfo(probeS)->getDict()->getAsciiString(TheKey_playerName).str(),
603+
getSkirmishSideInfo(probeS)->getDict()->getAsciiString(TheKey_playerFaction).str());
604+
}
605+
for (Int probeT = 0; probeT < getNumSkirmishTeams(); ++probeT)
606+
{
607+
std::fprintf(stderr, "[GGC_SK] skirmishTeam[%d] name='%s' owner='%s'\n", probeT,
608+
getSkirmishTeamInfo(probeT)->getDict()->getAsciiString(TheKey_teamName).str(),
609+
getSkirmishTeamInfo(probeT)->getDict()->getAsciiString(TheKey_teamOwner).str());
610+
}
611+
#endif
574612
}
575613

576614

0 commit comments

Comments
 (0)