Skip to content

Commit 23a2926

Browse files
authored
tweak(metaevent): Change COMMANDUSABLE_OBSERVER to no longer apply in Shell Map (#2002)
Keys P and O no longer pause the Shell Map. But Shift+P and Shift+O still do
1 parent fc36efc commit 23a2926

File tree

6 files changed

+16
-24
lines changed

6 files changed

+16
-24
lines changed

Core/GameEngine/Include/Common/GameUtility.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ typedef Int PlayerIndex;
2828
namespace rts
2929
{
3030

31-
bool localPlayerIsObserving();
3231
bool localPlayerHasRadar();
3332
Player* getObservedOrLocalPlayer(); ///< Get the current observed or local player. Is never null.
3433
Player* getObservedOrLocalPlayer_Safe(); ///< Get the current observed or local player. Is never null, except when the application does not have players.

Core/GameEngine/Source/Common/GameUtility.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff 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-
6352
bool localPlayerHasRadar()
6453
{
6554
// Using "local" instead of "observed or local" player because as an observer we prefer

Generals/Code/GameEngine/Include/Common/Player.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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

Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

GeneralsMD/Code/GameEngine/Include/Common/Player.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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

GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)