broadcast CoinsChanged, removed InsertCoin broadcast later
This commit is contained in:
@@ -632,7 +632,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
|
||||
int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle);
|
||||
int iNumCreditsPaid = GetNumCreditsPaid();
|
||||
int iNumCreditsOwed = iNumCreditsRequired - iNumCreditsPaid;
|
||||
GAMESTATE->m_iCoins -= iNumCreditsOwed * PREFSMAN->m_iCoinsPerCredit;
|
||||
GAMESTATE->m_iCoins.Set( GAMESTATE->m_iCoins - iNumCreditsOwed * PREFSMAN->m_iCoinsPerCredit );
|
||||
LOG->Trace( "Deducted %i coins, %i remaining",
|
||||
iNumCreditsOwed * PREFSMAN->m_iCoinsPerCredit, GAMESTATE->m_iCoins );
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ GameState::GameState() :
|
||||
m_pCurGame( Message_CurrentGameChanged ),
|
||||
m_pCurStyle( Message_CurrentStyleChanged ),
|
||||
m_PlayMode( Message_PlayModeChanged ),
|
||||
m_iCoins( Message_CoinsChanged ),
|
||||
m_sPreferredSongGroup( Message_PreferredSongGroupChanged ),
|
||||
m_sPreferredCourseGroup( Message_PreferredCourseGroupChanged ),
|
||||
m_PreferredStepsType( Message_PreferredStepsTypeChanged ),
|
||||
@@ -135,7 +136,7 @@ GameState::GameState() :
|
||||
SetCurrentStyle( NULL );
|
||||
|
||||
m_pCurGame.Set( NULL );
|
||||
m_iCoins = 0;
|
||||
m_iCoins.Set( 0 );
|
||||
m_timeGameStarted.SetZero();
|
||||
m_bDemonstrationOrJukebox = false;
|
||||
|
||||
@@ -410,7 +411,7 @@ namespace
|
||||
if( GAMESTATE->m_iCoins < iCoinsNeededToJoin )
|
||||
return false; // not enough coins
|
||||
|
||||
GAMESTATE->m_iCoins -= iCoinsNeededToJoin;
|
||||
GAMESTATE->m_iCoins.Set( GAMESTATE->m_iCoins - iCoinsNeededToJoin );
|
||||
|
||||
GAMESTATE->JoinPlayer( pn );
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
bool m_bSideIsJoined[NUM_PLAYERS]; // left side, right side
|
||||
MultiPlayerStatus m_MultiPlayerStatus[NUM_MultiPlayer];
|
||||
BroadcastOnChange<PlayMode> m_PlayMode; // many screens display different info depending on this value
|
||||
int m_iCoins; // not "credits"
|
||||
BroadcastOnChange<int> m_iCoins; // not "credits"
|
||||
PlayerNumber m_MasterPlayerNumber; // used in Styles where one player controls both sides
|
||||
bool m_bMultiplayer;
|
||||
int m_iNumMultiplayerNoteFields;
|
||||
|
||||
@@ -16,6 +16,7 @@ static const char *MessageIDNames[] = {
|
||||
"CurrentGameChanged",
|
||||
"CurrentStyleChanged",
|
||||
"PlayModeChanged",
|
||||
"CoinsChanged",
|
||||
"CurrentSongChanged",
|
||||
"CurrentStepsP1Changed",
|
||||
"CurrentStepsP2Changed",
|
||||
|
||||
@@ -13,6 +13,7 @@ enum MessageID
|
||||
Message_CurrentGameChanged,
|
||||
Message_CurrentStyleChanged,
|
||||
Message_PlayModeChanged,
|
||||
Message_CoinsChanged,
|
||||
Message_CurrentSongChanged,
|
||||
Message_CurrentStepsP1Changed,
|
||||
Message_CurrentStepsP2Changed,
|
||||
|
||||
@@ -1193,12 +1193,12 @@ void StepMania::InsertCoin( int iNum, bool bCountInBookkeeping )
|
||||
BOOKKEEPER->CoinInserted();
|
||||
}
|
||||
int iNumCoinsOld = GAMESTATE->m_iCoins;
|
||||
GAMESTATE->m_iCoins += iNum;
|
||||
GAMESTATE->m_iCoins.Set( GAMESTATE->m_iCoins + iNum );
|
||||
|
||||
int iCredits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit;
|
||||
bool bMaxCredits = iCredits >= MAX_NUM_CREDITS;
|
||||
if( bMaxCredits )
|
||||
GAMESTATE->m_iCoins = MAX_NUM_CREDITS * PREFSMAN->m_iCoinsPerCredit;
|
||||
GAMESTATE->m_iCoins.Set( MAX_NUM_CREDITS * PREFSMAN->m_iCoinsPerCredit );
|
||||
|
||||
LOG->Trace("%i coins inserted, %i needed to play", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Get() );
|
||||
if( iNumCoinsOld != GAMESTATE->m_iCoins )
|
||||
@@ -1214,6 +1214,7 @@ void StepMania::InsertCoin( int iNum, bool bCountInBookkeeping )
|
||||
SCREENMAN->PlayStartSound();
|
||||
}
|
||||
|
||||
/* TODO: remove this redundant message and things that depend on it */
|
||||
Message msg( "CoinInserted" );
|
||||
// below params are unused
|
||||
//msg.SetParam( "Coins", GAMESTATE->m_iCoins );
|
||||
@@ -1230,8 +1231,10 @@ void StepMania::InsertCredit()
|
||||
void StepMania::ClearCredits()
|
||||
{
|
||||
LOG->Trace("%i coins cleared", GAMESTATE->m_iCoins );
|
||||
GAMESTATE->m_iCoins = 0;
|
||||
GAMESTATE->m_iCoins.Set( 0 );
|
||||
SCREENMAN->PlayInvalidSound();
|
||||
|
||||
/* TODO: remove this redundant message and things that depend on it */
|
||||
Message msg( "CoinInserted" );
|
||||
// below params are unused
|
||||
//msg.SetParam( "Coins", GAMESTATE->m_iCoins );
|
||||
|
||||
Reference in New Issue
Block a user