fix dep: ScreenManager shouldn't use GameState

This commit is contained in:
Glenn Maynard
2006-11-21 02:01:40 +00:00
parent 70d2d0dbc7
commit 6207f655e5
2 changed files with 35 additions and 15 deletions
+35
View File
@@ -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 )