Skip to content

Commit 5f3c029

Browse files
authored
tweak(controlbar): Show stealthed radar objects to observers (#1487)
1 parent 841f603 commit 5f3c029

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

Generals/Code/GameEngine/Include/GameClient/ControlBar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,8 @@ class ControlBar : public SubsystemInterface
733733

734734
/// Returns the currently viewed player. May return NULL if no player is selected while observing.
735735
Player* getCurrentlyViewedPlayer();
736+
/// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing.
737+
Relationship getCurrentlyViewedPlayerRelationship(const Team* team);
736738

737739
// ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;}
738740

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ Player* ControlBar::getCurrentlyViewedPlayer()
165165
return ThePlayerList->getLocalPlayer();
166166
}
167167

168+
Relationship ControlBar::getCurrentlyViewedPlayerRelationship(const Team* team)
169+
{
170+
if (Player* player = getCurrentlyViewedPlayer())
171+
return player->getRelationship(team);
172+
173+
return NEUTRAL;
174+
}
175+
168176
void ControlBar::populatePurchaseScience( Player* player )
169177
{
170178
// TheInGameUI->deselectAllDrawables();

Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "GameLogic/Module/StealthUpdate.h"
4343

4444
#include "GameClient/Color.h"
45+
#include "GameClient/ControlBar.h"
4546
#include "GameClient/Display.h"
4647
#include "GameClient/GameClient.h"
4748
#include "GameClient/GameWindow.h"
@@ -696,7 +697,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
696697
if( !stealth )
697698
continue;
698699

699-
if ( ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ENEMIES )
700+
if ( TheControlBar->getCurrentlyViewedPlayerRelationship(obj->getTeam()) == ENEMIES )
700701
if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !stealth->isDisguised() )
701702
skip = TRUE;
702703

GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,8 @@ class ControlBar : public SubsystemInterface
747747

748748
/// Returns the currently viewed player. May return NULL if no player is selected while observing.
749749
Player* getCurrentlyViewedPlayer();
750+
/// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing.
751+
Relationship getCurrentlyViewedPlayerRelationship(const Team* team);
750752

751753
// ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;}
752754

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ Player* ControlBar::getCurrentlyViewedPlayer()
166166
return ThePlayerList->getLocalPlayer();
167167
}
168168

169+
Relationship ControlBar::getCurrentlyViewedPlayerRelationship(const Team* team)
170+
{
171+
if (Player* player = getCurrentlyViewedPlayer())
172+
return player->getRelationship(team);
173+
174+
return NEUTRAL;
175+
}
176+
169177
void ControlBar::populatePurchaseScience( Player* player )
170178
{
171179
// TheInGameUI->deselectAllDrawables();

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "GameLogic/Object.h"
4141

4242
#include "GameClient/Color.h"
43+
#include "GameClient/ControlBar.h"
4344
#include "GameClient/Display.h"
4445
#include "GameClient/GameClient.h"
4546
#include "GameClient/GameWindow.h"
@@ -690,7 +691,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
690691
// Now it twinkles for any stealthed object, whether locally controlled or neutral-observier-viewed
691692
if( obj->testStatus( OBJECT_STATUS_STEALTHED ) )
692693
{
693-
if ( ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ENEMIES )
694+
if ( TheControlBar->getCurrentlyViewedPlayerRelationship(obj->getTeam()) == ENEMIES )
694695
if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !obj->testStatus( OBJECT_STATUS_DISGUISED ) )
695696
skip = TRUE;
696697

0 commit comments

Comments
 (0)