Skip to content

Commit 9f65357

Browse files
committed
Revert "tweak: Update more events"
This reverts commit 9dfa949.
1 parent eb18776 commit 9f65357

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
#include "Common/ActionManager.h"
3939
#include "Common/GameType.h"
40-
#include "Common/GameUtility.h"
4140
#include "Common/MultiplayerSettings.h"
4241
#include "Common/NameKeyGenerator.h"
4342
#include "Common/Override.h"
@@ -1447,7 +1446,7 @@ void ControlBar::update( void )
14471446
setPortraitByObject(obj);
14481447

14491448
const Coord3D* exitPosition = NULL;
1450-
if (obj && obj->getControllingPlayer() == rts::getObservedOrLocalPlayer() && obj->getObjectExitInterface())
1449+
if (obj && obj->getControllingPlayer() == getCurrentlyViewedPlayer() && obj->getObjectExitInterface())
14511450
exitPosition = obj->getObjectExitInterface()->getRallyPoint();
14521451

14531452
showRallyPoint(exitPosition);
@@ -2725,12 +2724,14 @@ void ControlBar::showRallyPoint(const Coord3D* loc)
27252724
marker->setOrientation(TheGlobalData->m_downwindAngle); // To blow down wind -- ML
27262725

27272726
// set the marker colors to that of the local player
2728-
Player* player = rts::getObservedOrLocalPlayer();
2729-
2730-
if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT)
2731-
marker->setIndicatorColor(player->getPlayerNightColor());
2732-
else
2733-
marker->setIndicatorColor(player->getPlayerColor());
2727+
Player* player = TheControlBar->getCurrentlyViewedPlayer();
2728+
if (player)
2729+
{
2730+
if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT)
2731+
marker->setIndicatorColor(player->getPlayerNightColor());
2732+
else
2733+
marker->setIndicatorColor(player->getPlayerColor());
2734+
}
27342735
}
27352736

27362737
// ------------------------------------------------------------------------------------------------

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
6868
#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine
6969

70-
#include "Common/GameUtility.h"
7170
#include "Common/GlobalData.h"
7271
#include "Common/BuildAssistant.h"
7372
#include "Common/Player.h"
@@ -519,9 +518,9 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
519518
name = TheGameText->fetch("CONTROLBAR:Power");
520519
descrip = TheGameText->fetch("CONTROLBAR:PowerDescription");
521520

522-
Player* playerToDisplay = rts::getObservedOrLocalPlayer();
521+
Player* playerToDisplay = TheControlBar->getCurrentlyViewedPlayer();
523522

524-
if( playerToDisplay->getEnergy() )
523+
if( playerToDisplay && playerToDisplay->getEnergy() )
525524
{
526525
Energy *energy = playerToDisplay->getEnergy();
527526
descrip.format(descrip, energy->getProduction(), energy->getConsumption());

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
#include "Common/ActionManager.h"
3939
#include "Common/GameType.h"
40-
#include "Common/GameUtility.h"
4140
#include "Common/MultiplayerSettings.h"
4241
#include "Common/NameKeyGenerator.h"
4342
#include "Common/Override.h"
@@ -1470,7 +1469,7 @@ void ControlBar::update( void )
14701469
setPortraitByObject(obj);
14711470

14721471
const Coord3D* exitPosition = NULL;
1473-
if (obj && obj->getControllingPlayer() == rts::getObservedOrLocalPlayer() && obj->getObjectExitInterface())
1472+
if (obj && obj->getControllingPlayer() == getCurrentlyViewedPlayer() && obj->getObjectExitInterface())
14741473
exitPosition = obj->getObjectExitInterface()->getRallyPoint();
14751474

14761475
showRallyPoint(exitPosition);
@@ -2748,12 +2747,14 @@ void ControlBar::showRallyPoint(const Coord3D* loc)
27482747
marker->setOrientation(TheGlobalData->m_downwindAngle); // To blow down wind -- ML
27492748

27502749
// set the marker colors to that of the local player
2751-
Player* player = rts::getObservedOrLocalPlayer();
2752-
2753-
if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT)
2754-
marker->setIndicatorColor(player->getPlayerNightColor());
2755-
else
2756-
marker->setIndicatorColor(player->getPlayerColor());
2750+
Player* player = TheControlBar->getCurrentlyViewedPlayer();
2751+
if (player)
2752+
{
2753+
if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT)
2754+
marker->setIndicatorColor(player->getPlayerNightColor());
2755+
else
2756+
marker->setIndicatorColor(player->getPlayerColor());
2757+
}
27572758
}
27582759

27592760
// ------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
6868
#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine
6969

70-
#include "Common/GameUtility.h"
7170
#include "Common/GlobalData.h"
7271
#include "Common/BuildAssistant.h"
7372
#include "Common/Player.h"
@@ -568,9 +567,9 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
568567
name = TheGameText->fetch("CONTROLBAR:Power");
569568
descrip = TheGameText->fetch("CONTROLBAR:PowerDescription");
570569

571-
Player* playerToDisplay = rts::getObservedOrLocalPlayer();
570+
Player* playerToDisplay = TheControlBar->getCurrentlyViewedPlayer();
572571

573-
if( playerToDisplay->getEnergy() )
572+
if( playerToDisplay && playerToDisplay->getEnergy() )
574573
{
575574
Energy *energy = playerToDisplay->getEnergy();
576575
descrip.format(descrip, energy->getProduction(), energy->getConsumption());

0 commit comments

Comments
 (0)