Skip to content

Commit 2d13736

Browse files
authored
refactor(object): Replace explicit local player checks with Object::isLocallyControlled (#2512)
1 parent 90afd63 commit 2d13736

9 files changed

Lines changed: 11 additions & 11 deletions

File tree

Core/GameEngine/Source/GameClient/SelectionInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ Bool addDrawableToList( Drawable *draw, void *userData )
386386
{
387387
const Object *obj = draw->getObject();
388388
if (obj)
389-
if (obj->getControllingPlayer() != ThePlayerList->getLocalPlayer())
389+
if (!obj->isLocallyControlled())
390390
if (obj->getContain() && draw->getObject()->getContain()->getContainCount() > 0)
391391
return FALSE;
392392
}

Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control,
243243
break;
244244

245245
// sanity check, the building must be under our control to cancel construction
246-
if( building->getControllingPlayer() != ThePlayerList->getLocalPlayer() )
246+
if( !building->isLocallyControlled() )
247247
break;
248248

249249
// do the message
@@ -357,7 +357,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control,
357357
break;
358358

359359
// sanity, we must control the producer ... if this isn't true they might be hacking the game
360-
if( producer->getControllingPlayer() != ThePlayerList->getLocalPlayer() )
360+
if( !producer->isLocallyControlled() )
361361
break;
362362

363363
// send a message to cancel that particular production entry

Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ UpdateSleepTime OverchargeBehavior::update()
126126
enable( FALSE );
127127

128128
// do some UI info for the local user if this is theirs
129-
if( ThePlayerList->getLocalPlayer() == us->getControllingPlayer() )
129+
if( us->isLocallyControlled() )
130130
{
131131

132132
// print msg

Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ void Object::attemptDamage( DamageInfo *damageInfo )
17101710
damageInfo->in.m_damageType != DAMAGE_HEALING &&
17111711
!BitIsSet(damageInfo->in.m_sourcePlayerMask, getControllingPlayer()->getPlayerMask()) &&
17121712
m_radarData != nullptr &&
1713-
getControllingPlayer() == ThePlayerList->getLocalPlayer() )
1713+
isLocallyControlled() )
17141714
TheRadar->tryUnderAttackEvent( this );
17151715

17161716
}

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control,
375375
break;
376376

377377
// sanity check, the building must be under our control to cancel construction
378-
if( building->getControllingPlayer() != ThePlayerList->getLocalPlayer() )
378+
if( !building->isLocallyControlled() )
379379
break;
380380

381381
// do the message
@@ -490,7 +490,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control,
490490
break;
491491

492492
// sanity, we must control the producer ... if this isn't true they might be hacking the game
493-
if( producer->getControllingPlayer() != ThePlayerList->getLocalPlayer() )
493+
if( !producer->isLocallyControlled() )
494494
break;
495495

496496
// send a message to cancel that particular production entry

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ UpdateSleepTime OverchargeBehavior::update()
126126
enable( FALSE );
127127

128128
// do some UI info for the local user if this is theirs
129-
if( ThePlayerList->getLocalPlayer() == us->getControllingPlayer() )
129+
if( us->isLocallyControlled() )
130130
{
131131

132132
// print msg

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ void RiderChangeContain::onRemoving( Object *rider )
324324
if( containDraw && riderDraw )
325325
{
326326
//Create the selection message for the rider if it's ours and SELECTED!
327-
if( bike->getControllingPlayer() == ThePlayerList->getLocalPlayer() && containDraw->isSelected() )
327+
if( bike->isLocallyControlled() && containDraw->isSelected() )
328328
{
329329
GameMessage *teamMsg = TheMessageStream->appendMessage( GameMessage::MSG_CREATE_SELECTED_GROUP );
330330
teamMsg->appendBooleanArgument( FALSE );// not creating new team so pass false

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,7 @@ void Object::attemptDamage( DamageInfo *damageInfo )
19161916
getControllingPlayer() &&
19171917
!BitIsSet(damageInfo->in.m_sourcePlayerMask, getControllingPlayer()->getPlayerMask()) &&
19181918
m_radarData != nullptr &&
1919-
getControllingPlayer() == ThePlayerList->getLocalPlayer() )
1919+
isLocallyControlled() )
19201920
TheRadar->tryUnderAttackEvent( this );
19211921

19221922
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4030,7 +4030,7 @@ void GameLogic::destroyObject( Object *obj )
40304030
//Clean up special power shortcut bars
40314031
if( obj->hasAnySpecialPower() )
40324032
{
4033-
if( ThePlayerList->getLocalPlayer() == obj->getControllingPlayer() )
4033+
if( obj->isLocallyControlled() )
40344034
{
40354035
TheControlBar->markUIDirty();
40364036
}

0 commit comments

Comments
 (0)