Skip to content

Commit 15a7e04

Browse files
authored
bugfix(controlbar): Show the experience bar for the selected player when observing (#1432)
1 parent e571c9c commit 15a7e04

File tree

2 files changed

+20
-4
lines changed
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks

2 files changed

+20
-4
lines changed

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,17 @@ void W3DCommandBarGridDraw( GameWindow *window, WinInstanceData *instData )
486486

487487
void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData )
488488
{
489-
Player *player = ThePlayerList->getLocalPlayer();
490-
if(!player->isPlayerActive())
489+
Player* player = NULL;
490+
491+
// TheSuperHackers @bugfix Stubbjax 08/08/2025 Show the experience bar for observers
492+
if (TheControlBar->isObserverControlBarOn())
493+
player = TheControlBar->getObserverLookAtPlayer();
494+
else
495+
player = ThePlayerList->getLocalPlayer();
496+
497+
if (!player)
491498
return;
499+
492500
static const Image *endBar = TheMappedImageCollection->findImageByName("GenExpBarTop1");
493501
static const Image *beginBar = TheMappedImageCollection->findImageByName("GenExpBarBottom1");
494502
static const Image *centerBar = TheMappedImageCollection->findImageByName("GenExpBar1");

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,17 @@ void W3DCommandBarGridDraw( GameWindow *window, WinInstanceData *instData )
486486

487487
void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData )
488488
{
489-
Player *player = ThePlayerList->getLocalPlayer();
490-
if(!player->isPlayerActive())
489+
Player* player = NULL;
490+
491+
// TheSuperHackers @bugfix Stubbjax 08/08/2025 Show the experience bar for observers
492+
if (TheControlBar->isObserverControlBarOn())
493+
player = TheControlBar->getObserverLookAtPlayer();
494+
else
495+
player = ThePlayerList->getLocalPlayer();
496+
497+
if (!player)
491498
return;
499+
492500
static const Image *endBar = TheMappedImageCollection->findImageByName("GenExpBarTop1");
493501
static const Image *beginBar = TheMappedImageCollection->findImageByName("GenExpBarBottom1");
494502
static const Image *centerBar = TheMappedImageCollection->findImageByName("GenExpBar1");

0 commit comments

Comments
 (0)