Skip to content

Commit 85825c6

Browse files
committed
Changed 'thisPlayer' to 'msgPlayer'.
1 parent 7c8b814 commit 85825c6

1 file changed

Lines changed: 51 additions & 51 deletions

File tree

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
349349
DEBUG_ASSERTCRASH(msg != nullptr && msg != (GameMessage*)0xdeadbeef, ("bad msg"));
350350
#endif
351351

352-
Player *thisPlayer = ThePlayerList->getNthPlayer( msg->getPlayerIndex() );
353-
if (thisPlayer == nullptr)
352+
Player *msgPlayer = ThePlayerList->getNthPlayer( msg->getPlayerIndex() );
353+
if (msgPlayer == nullptr)
354354
{
355355
DEBUG_CRASH(("logicMessageDispatcher: Processing message from unknown player (player index '%d')", msg->getPlayerIndex()));
356356
return;
@@ -367,9 +367,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
367367
currentlySelectedGroup = TheAI->createGroup(); // can't do this outside a game - it'll cause sync errors galore.
368368
CRCGEN_LOG(( "Creating AIGroup %d in GameLogic::logicMessageDispatcher()", currentlySelectedGroup?currentlySelectedGroup->getID():0 ));
369369
#if RETAIL_COMPATIBLE_AIGROUP
370-
thisPlayer->getCurrentSelectionAsAIGroup(currentlySelectedGroup);
370+
msgPlayer->getCurrentSelectionAsAIGroup(currentlySelectedGroup);
371371
#else
372-
thisPlayer->getCurrentSelectionAsAIGroup(currentlySelectedGroup.Peek());
372+
msgPlayer->getCurrentSelectionAsAIGroup(currentlySelectedGroup.Peek());
373373
#endif
374374

375375
// We can't issue commands to groups that contain units that don't belong to the issuing player, so pretend like
@@ -385,7 +385,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
385385

386386
// If there are any units that the player doesn't own, then remove them from the "currentlySelectedGroup"
387387
if (currentlySelectedGroup)
388-
if (currentlySelectedGroup->removeAnyObjectsNotOwnedByPlayer(thisPlayer))
388+
if (currentlySelectedGroup->removeAnyObjectsNotOwnedByPlayer(msgPlayer))
389389
currentlySelectedGroup = nullptr;
390390

391391
if(TheStatsCollector)
@@ -410,7 +410,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
410410
if (commandName.isNotEmpty() /*&& msg->getType() != GameMessage::MSG_FRAME_TICK*/)
411411
{
412412
DEBUG_LOG(("Frame %d: GameLogic::logicMessageDispatcher() saw a %s from player %d (%ls)", getFrame(), commandName.str(),
413-
thisPlayer->getPlayerIndex(), thisPlayer->getPlayerDisplayName().str()));
413+
msgPlayer->getPlayerIndex(), msgPlayer->getPlayerDisplayName().str()));
414414
}
415415
#endif
416416
#endif // DEBUG_LOGGING
@@ -1037,7 +1037,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
10371037
break;
10381038

10391039
// sanity, the player must actually control this object
1040-
if( objectWantingToExit->getControllingPlayer() != thisPlayer )
1040+
if( objectWantingToExit->getControllingPlayer() != msgPlayer )
10411041
break;
10421042

10431043
objectWantingToExit->releaseWeaponLock(LOCKED_TEMPORARILY); // release any temporary locks.
@@ -1345,7 +1345,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
13451345
break;
13461346

13471347
// the player must actually control the producer object
1348-
if( producer->getControllingPlayer() != thisPlayer )
1348+
if( producer->getControllingPlayer() != msgPlayer )
13491349
break;
13501350

13511351
// producer must have a production update
@@ -1412,7 +1412,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
14121412
break;
14131413

14141414
// sanity, the player must control the producer
1415-
if( producer->getControllingPlayer() != thisPlayer )
1415+
if( producer->getControllingPlayer() != msgPlayer )
14161416
break;
14171417

14181418
// get the unit production interface
@@ -1496,7 +1496,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
14961496
break;
14971497

14981498
// the player sending this message must actually control this building
1499-
if( building->getControllingPlayer() != thisPlayer )
1499+
if( building->getControllingPlayer() != msgPlayer )
15001500
break;
15011501

15021502
// Check to make sure it is actually under construction
@@ -1506,8 +1506,8 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
15061506
// OK, refund the money to the player, unless it is a rebuilding Hole.
15071507
if( !building->testStatus(OBJECT_STATUS_RECONSTRUCTING))
15081508
{
1509-
Money *money = thisPlayer->getMoney();
1510-
UnsignedInt amount = building->getTemplate()->calcCostToBuild( thisPlayer );
1509+
Money *money = msgPlayer->getMoney();
1510+
UnsignedInt amount = building->getTemplate()->calcCostToBuild( msgPlayer );
15111511
money->deposit( amount, TRUE, FALSE );
15121512
}
15131513

@@ -1594,7 +1594,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
15941594
continue;
15951595
}
15961596

1597-
selectObject(obj, createNewGroup && firstObject, thisPlayer->getPlayerMask());
1597+
selectObject(obj, createNewGroup && firstObject, msgPlayer->getPlayerMask());
15981598
firstObject = FALSE;
15991599
}
16001600

@@ -1612,7 +1612,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
16121612
continue;
16131613
}
16141614

1615-
deselectObject(objToRemove, thisPlayer->getPlayerMask());
1615+
deselectObject(objToRemove, msgPlayer->getPlayerMask());
16161616
}
16171617

16181618
break;
@@ -1622,7 +1622,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
16221622
//---------------------------------------------------------------------------------------------
16231623
case GameMessage::MSG_DESTROY_SELECTED_GROUP:
16241624
{
1625-
thisPlayer->setCurrentlySelectedAIGroup(nullptr);
1625+
msgPlayer->setCurrentlySelectedAIGroup(nullptr);
16261626

16271627
break;
16281628

@@ -1639,57 +1639,57 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
16391639
// --------------------------------------------------------------------------------------------
16401640
case GameMessage::MSG_PLACE_BEACON:
16411641
{
1642-
if (thisPlayer->getPlayerTemplate() == nullptr)
1642+
if (msgPlayer->getPlayerTemplate() == nullptr)
16431643
break;
16441644
Coord3D pos = msg->getArgument( 0 )->location;
16451645
Region3D r;
16461646
TheTerrainLogic->getExtent(&r);
16471647
if (!r.isInRegionNoZ(&pos))
16481648
pos = TheTerrainLogic->findClosestEdgePoint(&pos);
1649-
const ThingTemplate *thing = TheThingFactory->findTemplate( thisPlayer->getPlayerTemplate()->getBeaconTemplate() );
1650-
if (thing && !TheVictoryConditions->hasSinglePlayerBeenDefeated(thisPlayer))
1649+
const ThingTemplate *thing = TheThingFactory->findTemplate( msgPlayer->getPlayerTemplate()->getBeaconTemplate() );
1650+
if (thing && !TheVictoryConditions->hasSinglePlayerBeenDefeated(msgPlayer))
16511651
{
16521652
// how many does this player have active?
16531653
Int count;
1654-
thisPlayer->countObjectsByThingTemplate( 1, &thing, false, &count );
1654+
msgPlayer->countObjectsByThingTemplate( 1, &thing, false, &count );
16551655
DEBUG_LOG(("Player already has %d beacons active", count));
16561656
if (count >= TheMultiplayerSettings->getMaxBeaconsPerPlayer())
16571657
{
1658-
if (thisPlayer == ThePlayerList->getLocalPlayer())
1658+
if (msgPlayer == ThePlayerList->getLocalPlayer())
16591659
{
16601660
// tell the user
16611661
TheInGameUI->message( TheGameText->fetch("GUI:TooManyBeacons") );
16621662

16631663
// play a sound
16641664
static AudioEventRTS aSound("BeaconPlacementFailed");
16651665
aSound.setPosition(&pos);
1666-
aSound.setPlayerIndex(thisPlayer->getPlayerIndex());
1666+
aSound.setPlayerIndex(msgPlayer->getPlayerIndex());
16671667
TheAudio->addAudioEvent(&aSound);
16681668
}
16691669

16701670
break;
16711671
}
1672-
Object *object = TheThingFactory->newObject( thing, thisPlayer->getDefaultTeam() );
1672+
Object *object = TheThingFactory->newObject( thing, msgPlayer->getDefaultTeam() );
16731673
object->setPosition( &pos );
16741674
object->setProducer(nullptr);
16751675

1676-
if (thisPlayer->getRelationship( ThePlayerList->getLocalPlayer()->getDefaultTeam() ) == ALLIES || ThePlayerList->getLocalPlayer()->isPlayerObserver())
1676+
if (msgPlayer->getRelationship( ThePlayerList->getLocalPlayer()->getDefaultTeam() ) == ALLIES || ThePlayerList->getLocalPlayer()->isPlayerObserver())
16771677
{
16781678
// tell the user
16791679
UnicodeString s;
1680-
s.format(TheGameText->fetch("GUI:BeaconPlaced"), thisPlayer->getPlayerDisplayName().str());
1680+
s.format(TheGameText->fetch("GUI:BeaconPlaced"), msgPlayer->getPlayerDisplayName().str());
16811681
TheInGameUI->message( s );
16821682

16831683
// play a sound
16841684
static AudioEventRTS aSound("BeaconPlaced");
1685-
aSound.setPlayerIndex(thisPlayer->getPlayerIndex());
1685+
aSound.setPlayerIndex(msgPlayer->getPlayerIndex());
16861686
aSound.setPosition(&pos);
16871687
TheAudio->addAudioEvent(&aSound);
16881688

16891689
// beacons are a rare event; play a nifty radar event thingy
16901690
TheRadar->createEvent( object->getPosition(), RADAR_EVENT_INFORMATION );
16911691

1692-
if (ThePlayerList->getLocalPlayer()->getRelationship(thisPlayer->getDefaultTeam()) == ALLIES)
1692+
if (ThePlayerList->getLocalPlayer()->getRelationship(msgPlayer->getDefaultTeam()) == ALLIES)
16931693
TheEva->setShouldPlay(EVA_BeaconDetected);
16941694

16951695
TheControlBar->markUIDirty(); // check if we should grey out the button
@@ -1725,7 +1725,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
17251725
// play a sound
17261726
static AudioEventRTS aSound("BeaconPlacementFailed");
17271727
aSound.setPosition(&pos);
1728-
aSound.setPlayerIndex(thisPlayer->getPlayerIndex());
1728+
aSound.setPlayerIndex(msgPlayer->getPlayerIndex());
17291729
TheAudio->addAudioEvent(&aSound);
17301730
}
17311731
break;
@@ -1736,9 +1736,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
17361736
{
17371737
AIGroupPtr allSelectedObjects = TheAI->createGroup();
17381738
#if RETAIL_COMPATIBLE_AIGROUP
1739-
thisPlayer->getCurrentSelectionAsAIGroup(allSelectedObjects); // need to act on all objects, so we can hide teammates' beacons.
1739+
msgPlayer->getCurrentSelectionAsAIGroup(allSelectedObjects); // need to act on all objects, so we can hide teammates' beacons.
17401740
#else
1741-
thisPlayer->getCurrentSelectionAsAIGroup(allSelectedObjects.Peek()); // need to act on all objects, so we can hide teammates' beacons.
1741+
msgPlayer->getCurrentSelectionAsAIGroup(allSelectedObjects.Peek()); // need to act on all objects, so we can hide teammates' beacons.
17421742
#endif
17431743
if( allSelectedObjects )
17441744
{
@@ -1756,13 +1756,13 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
17561756
const ThingTemplate *thing = TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() );
17571757
if (thing && thing->isEquivalentTo(beacon->getTemplate()))
17581758
{
1759-
if (beacon->getControllingPlayer() == thisPlayer)
1759+
if (beacon->getControllingPlayer() == msgPlayer)
17601760
{
17611761
destroyObject(beacon); // the owner is telling it to go away. such is life.
17621762

17631763
TheControlBar->markUIDirty(); // check if we should un-grey out the button
17641764
}
1765-
else if (thisPlayer == ThePlayerList->getLocalPlayer())
1765+
else if (msgPlayer == ThePlayerList->getLocalPlayer())
17661766
{
17671767
Drawable *beaconDrawable = beacon->getDrawable();
17681768
if (beaconDrawable)
@@ -1836,31 +1836,31 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
18361836
Int i=0;
18371837
for (; i<ThePlayerList->getPlayerCount(); ++i)
18381838
{
1839-
if (i != thisPlayer->getPlayerIndex())
1839+
if (i != msgPlayer->getPlayerIndex())
18401840
{
18411841
Player *otherPlayer = ThePlayerList->getNthPlayer(i);
1842-
if (thisPlayer->getRelationship(otherPlayer->getDefaultTeam()) == ALLIES &&
1843-
otherPlayer->getRelationship(thisPlayer->getDefaultTeam()) == ALLIES)
1842+
if (msgPlayer->getRelationship(otherPlayer->getDefaultTeam()) == ALLIES &&
1843+
otherPlayer->getRelationship(msgPlayer->getDefaultTeam()) == ALLIES)
18441844
{
18451845
if (TheVictoryConditions->hasSinglePlayerBeenDefeated(otherPlayer))
18461846
continue;
18471847

18481848
// a living ally! hooray!
1849-
otherPlayer->transferAssetsFromThat(thisPlayer);
1850-
thisPlayer->killPlayer(); // just to be safe (and to kill beacons etc that don't transfer)
1849+
otherPlayer->transferAssetsFromThat(msgPlayer);
1850+
msgPlayer->killPlayer(); // just to be safe (and to kill beacons etc that don't transfer)
18511851
break;
18521852
}
18531853
}
18541854
}
18551855
if (i == ThePlayerList->getPlayerCount())
18561856
{
18571857
// didn't find any allies. die, loner!
1858-
thisPlayer->killPlayer();
1858+
msgPlayer->killPlayer();
18591859
}
18601860
}
18611861
else
18621862
{
1863-
thisPlayer->killPlayer();
1863+
msgPlayer->killPlayer();
18641864
}
18651865
// There is no reason to do any notification here, it now takes place in the victory conditions.
18661866
// bonehead.
@@ -1870,7 +1870,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
18701870
// --------------------------------------------------------------------------------------------
18711871
case GameMessage::MSG_SET_REPLAY_CAMERA:
18721872
{
1873-
if (TheRecorder->isPlaybackMode() && TheGlobalData->m_useCameraInReplay && TheControlBar->getObserverLookAtPlayer() == thisPlayer)
1873+
if (TheRecorder->isPlaybackMode() && TheGlobalData->m_useCameraInReplay && TheControlBar->getObserverLookAtPlayer() == msgPlayer)
18741874
{
18751875
if (TheTacticalView->isCameraMovementFinished())
18761876
{
@@ -1919,8 +1919,8 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
19191919
case GameMessage::MSG_CREATE_TEAM9:
19201920
{
19211921
// TheSuperHackers @tweak Stubbjax 17/08/2025 The local player processes this message in CommandXlat for immediate assignment.
1922-
if (!thisPlayer->isLocalPlayer())
1923-
thisPlayer->processCreateTeamGameMessage(msg->getType() - GameMessage::MSG_CREATE_TEAM0, msg);
1922+
if (!msgPlayer->isLocalPlayer())
1923+
msgPlayer->processCreateTeamGameMessage(msg->getType() - GameMessage::MSG_CREATE_TEAM0, msg);
19241924

19251925
break;
19261926
}
@@ -1936,7 +1936,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
19361936
case GameMessage::MSG_SELECT_TEAM8:
19371937
case GameMessage::MSG_SELECT_TEAM9:
19381938
{
1939-
thisPlayer->processSelectTeamGameMessage(msg->getType() - GameMessage::MSG_SELECT_TEAM0, msg);
1939+
msgPlayer->processSelectTeamGameMessage(msg->getType() - GameMessage::MSG_SELECT_TEAM0, msg);
19401940
break;
19411941
}
19421942

@@ -1951,7 +1951,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
19511951
case GameMessage::MSG_ADD_TEAM8:
19521952
case GameMessage::MSG_ADD_TEAM9:
19531953
{
1954-
thisPlayer->processAddTeamGameMessage(msg->getType() - GameMessage::MSG_ADD_TEAM0, msg);
1954+
msgPlayer->processAddTeamGameMessage(msg->getType() - GameMessage::MSG_ADD_TEAM0, msg);
19551955
break;
19561956
}
19571957

@@ -1964,7 +1964,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
19641964
Int slotIndex = -1;
19651965
for (Int i=0; i<MAX_SLOTS; ++i)
19661966
{
1967-
if (thisPlayer->getPlayerType() == PLAYER_HUMAN && TheNetwork->getPlayerName(i) == thisPlayer->getPlayerDisplayName())
1967+
if (msgPlayer->getPlayerType() == PLAYER_HUMAN && TheNetwork->getPlayerName(i) == msgPlayer->getPlayerDisplayName())
19681968
{
19691969
slotIndex = i;
19701970
break;
@@ -1974,7 +1974,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
19741974
if (slotIndex < 0 || !TheNetwork->isPlayerConnected(slotIndex))
19751975
break;
19761976

1977-
if (thisPlayer->isLocalPlayer())
1977+
if (msgPlayer->isLocalPlayer())
19781978
{
19791979
#if defined(RTS_DEBUG)
19801980
// don't even put this in release, cause someone might hack it.
@@ -1989,16 +1989,16 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
19891989

19901990
UnsignedInt newCRC = msg->getArgument(0)->integer;
19911991
//DEBUG_LOG(("Received CRC of %8.8X from %ls on frame %d", newCRC,
1992-
//thisPlayer->getPlayerDisplayName().str(), m_frame));
1993-
m_cachedCRCs[thisPlayer->getPlayerIndex()] = newCRC;
1992+
//msgPlayer->getPlayerDisplayName().str(), m_frame));
1993+
m_cachedCRCs[msgPlayer->getPlayerIndex()] = newCRC;
19941994
}
19951995
else if (TheRecorder && TheRecorder->isPlaybackMode())
19961996
{
19971997
UnsignedInt newCRC = msg->getArgument(0)->integer;
19981998
//DEBUG_LOG(("Saw CRC of %X from player %d. Our CRC is %X. Arg count is %d",
1999-
//newCRC, thisPlayer->getPlayerIndex(), getCRC(), msg->getArgumentCount()));
1999+
//newCRC, msgPlayer->getPlayerIndex(), getCRC(), msg->getArgumentCount()));
20002000

2001-
TheRecorder->handleCRCMessage(newCRC, thisPlayer->getPlayerIndex(), (msg->getArgument(1)->boolean));
2001+
TheRecorder->handleCRCMessage(newCRC, msgPlayer->getPlayerIndex(), (msg->getArgument(1)->boolean));
20022002
}
20032003
break;
20042004

@@ -2013,7 +2013,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
20132013
if( science == SCIENCE_INVALID )
20142014
break;
20152015

2016-
thisPlayer->attemptToPurchaseScience(science);
2016+
msgPlayer->attemptToPurchaseScience(science);
20172017

20182018
break;
20192019

@@ -2030,7 +2030,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
20302030
#endif
20312031

20322032
/**/ /// @todo: multiplayer semantics
2033-
if (currentlySelectedGroup && TheRecorder->isPlaybackMode() && TheGlobalData->m_useCameraInReplay && TheControlBar->getObserverLookAtPlayer() == thisPlayer /*&& !TheRecorder->isMultiplayer()*/)
2033+
if (currentlySelectedGroup && TheRecorder->isPlaybackMode() && TheGlobalData->m_useCameraInReplay && TheControlBar->getObserverLookAtPlayer() == msgPlayer /*&& !TheRecorder->isMultiplayer()*/)
20342034
{
20352035
const VecObjectID& selectedObjects = currentlySelectedGroup->getAllIDs();
20362036
TheInGameUI->deselectAllDrawables();

0 commit comments

Comments
 (0)