Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ void PlayerList::newGame()
if (pname.isEmpty())
continue; // it's neutral, which we've already done, so skip it.

if (m_playerCount >= MAX_PLAYER_COUNT)
{
DEBUG_ASSERTCRASH(false, ("Map has more player sides than MAX_PLAYER_COUNT (%d); skipping side '%s'", MAX_PLAYER_COUNT, pname.str()));
continue;
}

/// @todo The Player class should have a reset() method, instead of directly calling initFromDict() (MSB)
Player* p = m_players[m_playerCount++];
p->initFromDict(d);
Expand Down Expand Up @@ -188,6 +194,9 @@ void PlayerList::newGame()
Dict *d = TheSidesList->getSideInfo(i)->getDict();
Player* p = findPlayerWithNameKey(NAMEKEY(d->getAsciiString(TheKey_playerName)));

if (!p)
continue; // player was skipped (e.g. side count exceeded MAX_PLAYER_COUNT) or is neutral with no name key.

AsciiString tok;

AsciiString enemies = d->getAsciiString(TheKey_playerEnemies);
Expand Down
9 changes: 9 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ void PlayerList::newGame()
if (pname.isEmpty())
continue; // it's neutral, which we've already done, so skip it.

if (m_playerCount >= MAX_PLAYER_COUNT)
{
DEBUG_ASSERTCRASH(false, ("Map has more player sides than MAX_PLAYER_COUNT (%d); skipping side '%s'", MAX_PLAYER_COUNT, pname.str()));
continue;
}

/// @todo The Player class should have a reset() method, instead of directly calling initFromDict() (MSB)
Player* p = m_players[m_playerCount++];
p->initFromDict(d);
Expand Down Expand Up @@ -188,6 +194,9 @@ void PlayerList::newGame()
Dict *d = TheSidesList->getSideInfo(i)->getDict();
Player* p = findPlayerWithNameKey(NAMEKEY(d->getAsciiString(TheKey_playerName)));

if (!p)
continue; // player was skipped (e.g. side count exceeded MAX_PLAYER_COUNT) or is neutral with no name key.

AsciiString tok;

AsciiString enemies = d->getAsciiString(TheKey_playerEnemies);
Expand Down
Loading