File tree Expand file tree Collapse file tree 6 files changed +16
-24
lines changed
GeneralsMD/Code/GameEngine
Source/GameClient/MessageStream
Source/GameClient/MessageStream Expand file tree Collapse file tree 6 files changed +16
-24
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ typedef Int PlayerIndex;
2828namespace rts
2929{
3030
31- bool localPlayerIsObserving ();
3231bool localPlayerHasRadar ();
3332Player* getObservedOrLocalPlayer (); // /< Get the current observed or local player. Is never null.
3433Player* getObservedOrLocalPlayer_Safe (); // /< Get the current observed or local player. Is never null, except when the application does not have players.
Original file line number Diff line number Diff line change @@ -49,17 +49,6 @@ static void changePlayerCommon(Player* player)
4949
5050} // namespace detail
5151
52- bool localPlayerIsObserving ()
53- {
54- if (TheGameLogic->isInReplayGame () || TheGameLogic->isInShellGame ())
55- return true ;
56-
57- if (ThePlayerList->getLocalPlayer ()->isPlayerObserver ())
58- return true ;
59-
60- return false ;
61- }
62-
6352bool localPlayerHasRadar ()
6453{
6554 // Using "local" instead of "observed or local" player because as an observer we prefer
Original file line number Diff line number Diff line change @@ -590,9 +590,9 @@ class Player : public Snapshot
590590
591591 Bool isPlayableSide ( void ) const ;
592592
593- Bool isPlayerObserver ( void ) const ; // Favor !isActive () - this is used for Observer GUI mostly, not in-game stuff
594- Bool isPlayerDead (void ) const ; // Favor !isActive () - this is used so OCLs don't give us stuff after death.
595- Bool isPlayerActive (void ) const ;
593+ Bool isPlayerObserver ( void ) const ; // Favor !isPlayerActive () - this is used for Observer GUI mostly, not in-game stuff
594+ Bool isPlayerDead (void ) const ; // Favor !isPlayerActive () - this is used so OCLs don't give us stuff after death.
595+ Bool isPlayerActive (void ) const ; // Player is alive and not observer. !isPlayerActive() is synonymous with observing.
596596
597597 Bool didPlayerPreorder ( void ) const { return m_isPreorder; }
598598
Original file line number Diff line number Diff line change @@ -380,14 +380,16 @@ static Bool isMessageUsable(CommandUsableInType usableIn)
380380 const Bool usableInShell = (usableIn & COMMANDUSABLE_SHELL);
381381 const Bool usableInGame = (usableIn & COMMANDUSABLE_GAME);
382382 const Bool usableAsObserver = (usableIn & COMMANDUSABLE_OBSERVER);
383+ const Bool isShellActive = TheShell && TheShell->isShellActive ();
384+ const Bool isObserving = !ThePlayerList->getLocalPlayer ()->isPlayerActive ();
383385
384- if (usableInShell && TheShell && TheShell-> isShellActive () )
386+ if (usableInShell && isShellActive)
385387 return true ;
386388
387- if (usableInGame && (!TheShell || !TheShell-> isShellActive ()) )
389+ if (usableInGame && ! isShellActive)
388390 return true ;
389391
390- if (usableAsObserver && rts::localPlayerIsObserving () )
392+ if (usableAsObserver && isObserving )
391393 return true ;
392394
393395 return false ;
Original file line number Diff line number Diff line change @@ -617,9 +617,9 @@ class Player : public Snapshot
617617
618618 Bool isPlayableSide ( void ) const ;
619619
620- Bool isPlayerObserver ( void ) const ; // Favor !isActive () - this is used for Observer GUI mostly, not in-game stuff
621- Bool isPlayerDead (void ) const ; // Favor !isActive () - this is used so OCLs don't give us stuff after death.
622- Bool isPlayerActive (void ) const ;
620+ Bool isPlayerObserver ( void ) const ; // Favor !isPlayerActive () - this is used for Observer GUI mostly, not in-game stuff
621+ Bool isPlayerDead (void ) const ; // Favor !isPlayerActive () - this is used so OCLs don't give us stuff after death.
622+ Bool isPlayerActive (void ) const ; // Player is alive and not observer. !isPlayerActive() is synonymous with observing.
623623
624624 Bool didPlayerPreorder ( void ) const { return m_isPreorder; }
625625
Original file line number Diff line number Diff line change @@ -418,14 +418,16 @@ static Bool isMessageUsable(CommandUsableInType usableIn)
418418 const Bool usableInShell = (usableIn & COMMANDUSABLE_SHELL);
419419 const Bool usableInGame = (usableIn & COMMANDUSABLE_GAME);
420420 const Bool usableAsObserver = (usableIn & COMMANDUSABLE_OBSERVER);
421+ const Bool isShellActive = TheShell && TheShell->isShellActive ();
422+ const Bool isObserving = !ThePlayerList->getLocalPlayer ()->isPlayerActive ();
421423
422- if (usableInShell && TheShell && TheShell-> isShellActive () )
424+ if (usableInShell && isShellActive)
423425 return true ;
424426
425- if (usableInGame && (!TheShell || !TheShell-> isShellActive ()) )
427+ if (usableInGame && ! isShellActive)
426428 return true ;
427429
428- if (usableAsObserver && rts::localPlayerIsObserving () )
430+ if (usableAsObserver && isObserving )
429431 return true ;
430432
431433 return false ;
You can’t perform that action at this time.
0 commit comments