fix dep: ScreenManager shouldn't use GameState
This commit is contained in:
@@ -45,6 +45,38 @@ GameState* GAMESTATE = NULL; // global and accessable from anywhere in our progr
|
||||
|
||||
#define NAME_BLACKLIST_FILE "/Data/NamesBlacklist.txt"
|
||||
|
||||
class GameStateMessageHandler: public MessageSubscriber
|
||||
{
|
||||
void HandleMessage( const Message &msg )
|
||||
{
|
||||
if( msg.GetName() == "RefreshCreditText" )
|
||||
{
|
||||
RString sJoined;
|
||||
FOREACH_HumanPlayer( pn )
|
||||
{
|
||||
if( sJoined != "" )
|
||||
sJoined += ", ";
|
||||
sJoined += ssprintf( "P%i", pn+1 );
|
||||
}
|
||||
|
||||
if( sJoined == "" )
|
||||
sJoined = "none";
|
||||
|
||||
LOG->MapLog( "JOINED", "Players joined: %s", sJoined.c_str() );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct GameStateImpl
|
||||
{
|
||||
GameStateMessageHandler m_Subscriber;
|
||||
GameStateImpl::GameStateImpl()
|
||||
{
|
||||
m_Subscriber.SubscribeToMessage( "RefreshCreditText" );
|
||||
}
|
||||
};
|
||||
static GameStateImpl *g_pImpl = NULL;
|
||||
|
||||
ThemeMetric<bool> USE_NAME_BLACKLIST("GameState","UseNameBlacklist");
|
||||
|
||||
ThemeMetric<RString> DEFAULT_SORT ("GameState","DefaultSort");
|
||||
@@ -87,6 +119,8 @@ GameState::GameState() :
|
||||
m_iEditCourseEntryIndex( Message_EditCourseEntryIndexChanged ),
|
||||
m_sEditLocalProfileID( Message_EditLocalProfileIDChanged )
|
||||
{
|
||||
g_pImpl = new GameStateImpl;
|
||||
|
||||
SetCurrentStyle( NULL );
|
||||
|
||||
m_pCurGame.Set( NULL );
|
||||
@@ -140,6 +174,7 @@ GameState::~GameState()
|
||||
SAFE_DELETE( m_pMultiPlayerState[p] );
|
||||
|
||||
SAFE_DELETE( m_Environment );
|
||||
SAFE_DELETE( g_pImpl );
|
||||
}
|
||||
|
||||
void GameState::ApplyGameCommand( const RString &sCommand, PlayerNumber pn )
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
#include "ScreenDimensions.h"
|
||||
#include "Foreach.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "GameState.h" // XXX: bad dep
|
||||
|
||||
ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -784,20 +783,6 @@ void ScreenManager::HideSystemMessage()
|
||||
void ScreenManager::RefreshCreditsMessages()
|
||||
{
|
||||
MESSAGEMAN->Broadcast( "RefreshCreditText" );
|
||||
|
||||
/* This is called when GAMESTATE->m_bSideIsJoined changes. */
|
||||
RString joined;
|
||||
FOREACH_HumanPlayer( pn )
|
||||
{
|
||||
if( joined != "" )
|
||||
joined += ", ";
|
||||
joined += ssprintf( "P%i", pn+1 );
|
||||
}
|
||||
|
||||
if( joined == "" )
|
||||
joined = "none";
|
||||
|
||||
LOG->MapLog( "JOINED", "Players joined: %s", joined.c_str() );
|
||||
}
|
||||
|
||||
void ScreenManager::ZeroNextUpdate()
|
||||
|
||||
Reference in New Issue
Block a user