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
12 changes: 5 additions & 7 deletions Core/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2383,18 +2383,16 @@ bool GameLogic::onLogicCrc(MAYBE_UNUSED GameMessage *msg)
Player *msgPlayer = getMessagePlayer(msg);
if (TheNetwork)
{
Int slotIndex = -1;
for (Int i=0; i<MAX_SLOTS; ++i)
if (msgPlayer->getPlayerType() != PLAYER_HUMAN)
{
if (msgPlayer->getPlayerType() == PLAYER_HUMAN && TheNetwork->getPlayerName(i) == msgPlayer->getPlayerDisplayName())
{
slotIndex = i;
break;
}
return false;
}

const Int slotIndex = ThePlayerList->getSlotIndex(msgPlayer->getPlayerIndex());
if (slotIndex < 0 || !TheNetwork->isPlayerConnected(slotIndex))
{
return false;
}

if (msgPlayer->isLocalPlayer())
{
Expand Down
8 changes: 2 additions & 6 deletions Generals/Code/GameEngine/Source/Common/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,13 +989,9 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
}

Int localPlayerIndex = m_crcInfo.getLocalPlayer();
Bool samePlayer = FALSE;
AsciiString playerName;
playerName.format("player%d", localPlayerIndex);
const Player *p = ThePlayerList->getNthPlayer(playerIndex);
if (!p || (p->getPlayerNameKey() == NAMEKEY(playerName)))
samePlayer = TRUE;
if (samePlayer || (localPlayerIndex < 0))
const Bool isLocalPlayer = !p || ThePlayerList->getSlotIndex(playerIndex) == localPlayerIndex;
if (isLocalPlayer)
{
UnsignedInt playbackCRC = m_crcInfo.readCRC();
//DEBUG_LOG(("RecorderClass::handleCRCMessage() - Comparing CRCs of InGame:%8.8X Replay:%8.8X Frame:%d from Player %d",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@ void VictoryConditions::update()
TheAudio->addAudioEvent(&leftGameSound);
}

for (Int idx = 0; idx < MAX_SLOTS; ++idx)
if (TheGameInfo)
{
AsciiString pName;
pName.format("player%d", idx);
if (p->getPlayerNameKey() == NAMEKEY(pName))
const Int slotIndex = ThePlayerList->getSlotIndex(p->getPlayerIndex());
const GameSlot* slot = slotIndex >= 0 ? TheGameInfo->getSlot(slotIndex) : nullptr;

if (slot && slot->isAI())
{
GameSlot *slot = (TheGameInfo)?TheGameInfo->getSlot(idx):nullptr;
if (slot && slot->isAI())
{
DEBUG_LOG(("Marking AI player %s as defeated", pName.str()));
slot->setLastFrameInGame(TheGameLogic->getFrame());
}
DEBUG_LOG(("Marking AI player %s as defeated", TheNameKeyGenerator->keyToName(p->getPlayerNameKey()).str()));
slot->setLastFrameInGame(TheGameLogic->getFrame());
}
}

Expand Down
8 changes: 2 additions & 6 deletions GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,13 +991,9 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
}

Int localPlayerIndex = m_crcInfo.getLocalPlayer();
Bool samePlayer = FALSE;
AsciiString playerName;
playerName.format("player%d", localPlayerIndex);
const Player *p = ThePlayerList->getNthPlayer(playerIndex);
if (!p || (p->getPlayerNameKey() == NAMEKEY(playerName)))
samePlayer = TRUE;
if (samePlayer || (localPlayerIndex < 0))
const Bool isLocalPlayer = !p || ThePlayerList->getSlotIndex(playerIndex) == localPlayerIndex;
if (isLocalPlayer)
{
UnsignedInt playbackCRC = m_crcInfo.readCRC();
//DEBUG_LOG(("RecorderClass::handleCRCMessage() - Comparing CRCs of InGame:%8.8X Replay:%8.8X Frame:%d from Player %d",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,15 @@ void VictoryConditions::update()
TheAudio->addAudioEvent(&leftGameSound);
}

for (Int idx = 0; idx < MAX_SLOTS; ++idx)
if (TheGameInfo)
{
AsciiString pName;
pName.format("player%d", idx);
if (p->getPlayerNameKey() == NAMEKEY(pName))
const Int slotIndex = ThePlayerList->getSlotIndex(p->getPlayerIndex());
GameSlot *const slot = slotIndex >= 0 ? TheGameInfo->getSlot(slotIndex) : nullptr;

if (slot && slot->isAI())
{
GameSlot *slot = (TheGameInfo)?TheGameInfo->getSlot(idx):nullptr;
if (slot && slot->isAI())
{
DEBUG_LOG(("Marking AI player %s as defeated", pName.str()));
slot->setLastFrameInGame(TheGameLogic->getFrame());
}
DEBUG_LOG(("Marking AI player %s as defeated", TheNameKeyGenerator->keyToName(p->getPlayerNameKey()).str()));
slot->setLastFrameInGame(TheGameLogic->getFrame());
}
}

Expand Down