Persistent Coins (#1405)
On Coin Insert, a file Save/Coin.ini is created if it does not exist, which stores the number of coins currrently in m_iCoins. Whenever m_iCoins is update, the Coin.ini is updated. On boot, Coin.ini is read and m_iCoins is set to that value. If coins in coin.ini file is greater then MAX_NUM_CREDITS then reset the value to 0.
This commit is contained in:
committed by
Colby Klein
parent
4b3507f195
commit
8f332653e1
+7
-1
@@ -1281,9 +1281,12 @@ void StepMania::InsertCoin( int iNum, bool bCountInBookkeeping )
|
||||
{
|
||||
GAMESTATE->m_iCoins.Set( MAX_NUM_CREDITS * PREFSMAN->m_iCoinsPerCredit );
|
||||
}
|
||||
|
||||
|
||||
LOG->Trace("%i coins inserted, %i needed to play", GAMESTATE->m_iCoins.Get(), PREFSMAN->m_iCoinsPerCredit.Get() );
|
||||
|
||||
// On InsertCoin, make sure to update Coins file
|
||||
BOOKKEEPER->WriteCoinsFile(GAMESTATE->m_iCoins.Get());
|
||||
|
||||
// If inserting coins, play an appropriate sound; if deducting coins, don't play anything.
|
||||
if (iNum > 0)
|
||||
{
|
||||
@@ -1323,6 +1326,9 @@ void StepMania::ClearCredits()
|
||||
GAMESTATE->m_iCoins.Set( 0 );
|
||||
SCREENMAN->PlayInvalidSound();
|
||||
|
||||
// Update Coins file to make sure credits are cleared.
|
||||
BOOKKEEPER->WriteCoinsFile(GAMESTATE->m_iCoins.Get());
|
||||
|
||||
// TODO: remove this redundant message and things that depend on it
|
||||
Message msg( "CoinInserted" );
|
||||
// below params are unused
|
||||
|
||||
Reference in New Issue
Block a user