name cleanup: StyleDef -> Style

This commit is contained in:
Chris Danford
2004-06-28 07:26:00 +00:00
parent 1296cd775d
commit 5544445ad0
80 changed files with 350 additions and 353 deletions
+27 -27
View File
@@ -21,7 +21,7 @@ void ModeChoice::Init()
m_bInvalid = true;
m_iIndex = -1;
m_game = GAME_INVALID;
m_pStyleDef = NULL;
m_pStyle = NULL;
m_pm = PLAY_MODE_INVALID;
m_dc = DIFFICULTY_INVALID;
m_CourseDifficulty = DIFFICULTY_INVALID;
@@ -52,7 +52,7 @@ bool ModeChoice::DescribesCurrentMode( PlayerNumber pn ) const
return false;
if( m_pm != PLAY_MODE_INVALID && GAMESTATE->m_PlayMode != m_pm )
return false;
if( m_pStyleDef && GAMESTATE->m_pCurStyleDef != m_pStyleDef )
if( m_pStyle && GAMESTATE->m_pCurStyle != m_pStyle )
return false;
// HACK: don't compare m_dc if m_pSteps is set. This causes problems
// in ScreenSelectOptionsMaster::ImportOptions if m_PreferredDifficulty
@@ -130,9 +130,9 @@ void ModeChoice::Load( int iIndex, CString sChoice )
if( sName == "style" )
{
const StyleDef* style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_CurGame, sValue );
const Style* style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_CurGame, sValue );
if( style )
m_pStyleDef = style;
m_pStyle = style;
else
m_bInvalid |= true;
}
@@ -208,15 +208,15 @@ void ModeChoice::Load( int iIndex, CString sChoice )
if( !m_bInvalid && sSteps != "" )
{
Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong;
const StyleDef *style = m_pStyleDef ? m_pStyleDef : GAMESTATE->m_pCurStyleDef;
const Style *style = m_pStyle ? m_pStyle : GAMESTATE->m_pCurStyle;
if( pSong == NULL || style == NULL )
RageException::Throw( "Must set Song and Style to set Steps" );
Difficulty dc = StringToDifficulty( sSteps );
if( dc != DIFFICULTY_EDIT )
m_pSteps = pSong->GetStepsByDifficulty( m_pStyleDef->m_StepsType, dc );
m_pSteps = pSong->GetStepsByDifficulty( m_pStyle->m_StepsType, dc );
else
m_pSteps = pSong->GetStepsByDescription( m_pStyleDef->m_StepsType, sSteps );
m_pSteps = pSong->GetStepsByDescription( m_pStyle->m_StepsType, sSteps );
if( m_pSteps == NULL )
{
m_sInvalidReason = "steps not found";
@@ -237,18 +237,18 @@ int GetNumCreditsPaid()
}
int GetCreditsRequiredToPlayStyle( const StyleDef *style )
int GetCreditsRequiredToPlayStyle( const Style *style )
{
if( PREFSMAN->GetPremium() == PrefsManager::JOINT_PREMIUM )
return 1;
switch( style->m_StyleType )
{
case StyleDef::ONE_PLAYER_ONE_CREDIT:
case Style::ONE_PLAYER_ONE_CREDIT:
return 1;
case StyleDef::TWO_PLAYERS_TWO_CREDITS:
case Style::TWO_PLAYERS_TWO_CREDITS:
return 2;
case StyleDef::ONE_PLAYER_TWO_CREDITS:
case Style::ONE_PLAYER_TWO_CREDITS:
return (PREFSMAN->GetPremium() == PrefsManager::DOUBLES_PREMIUM) ? 1 : 2;
default:
ASSERT(0);
@@ -256,7 +256,7 @@ int GetCreditsRequiredToPlayStyle( const StyleDef *style )
}
}
static bool AreStyleAndPlayModeCompatible( const StyleDef *style, PlayMode pm )
static bool AreStyleAndPlayModeCompatible( const Style *style, PlayMode pm )
{
if( style == NULL || pm == PLAY_MODE_INVALID )
return true;
@@ -273,7 +273,7 @@ static bool AreStyleAndPlayModeCompatible( const StyleDef *style, PlayMode pm )
return false;
/* Don't allow battle modes if the style takes both sides. */
if( style->m_StyleType==StyleDef::ONE_PLAYER_TWO_CREDITS )
if( style->m_StyleType==Style::ONE_PLAYER_TWO_CREDITS )
return false;
}
@@ -289,11 +289,11 @@ bool ModeChoice::IsPlayable( CString *why ) const
return false;
}
if ( m_pStyleDef )
if ( m_pStyle )
{
int iCredits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit;
const int iNumCreditsPaid = GetNumCreditsPaid();
const int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyleDef);
const int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle);
switch( PREFSMAN->GetCoinMode() )
{
@@ -334,7 +334,7 @@ bool ModeChoice::IsPlayable( CString *why ) const
/* If both sides are joined, disallow singles modes, since easy to select them
* accidentally, instead of versus mode. */
if( m_pStyleDef->m_StyleType == StyleDef::ONE_PLAYER_ONE_CREDIT &&
if( m_pStyle->m_StyleType == Style::ONE_PLAYER_ONE_CREDIT &&
GAMESTATE->GetNumSidesJoined() > 1 )
{
if( why )
@@ -345,10 +345,10 @@ bool ModeChoice::IsPlayable( CString *why ) const
/* Don't allow a PlayMode that's incompatible with our current Style (if set),
* and vice versa. */
if( m_pm != PLAY_MODE_INVALID || m_pStyleDef != NULL )
if( m_pm != PLAY_MODE_INVALID || m_pStyle != NULL )
{
const PlayMode pm = (m_pm != PLAY_MODE_INVALID) ? m_pm : GAMESTATE->m_PlayMode;
const StyleDef *style = (m_pStyleDef != NULL)? m_pStyleDef: GAMESTATE->m_pCurStyleDef;
const Style *style = (m_pStyle != NULL)? m_pStyle: GAMESTATE->m_pCurStyle;
if( !AreStyleAndPlayModeCompatible( style, pm ) )
{
if( why )
@@ -408,15 +408,15 @@ void ModeChoice::Apply( PlayerNumber pn ) const
if( m_pm != PLAY_MODE_INVALID )
GAMESTATE->m_PlayMode = m_pm;
if( m_pStyleDef != NULL )
if( m_pStyle != NULL )
{
GAMESTATE->m_pCurStyleDef = m_pStyleDef;
GAMESTATE->m_pCurStyle = m_pStyle;
// It's possible to choose a style that didn't have enough
// players joined. If enough players aren't joined, then
// we need to subtract credits for the sides that will be
// joined as a result of applying this option.
int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyleDef);
int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle);
int iNumCreditsPaid = GetNumCreditsPaid();
int iNumCreditsOwed = iNumCreditsRequired - iNumCreditsPaid;
@@ -425,12 +425,12 @@ void ModeChoice::Apply( PlayerNumber pn ) const
// If only one side is joined and we picked a style
// that requires both sides, join the other side.
switch( m_pStyleDef->m_StyleType )
switch( m_pStyle->m_StyleType )
{
case StyleDef::ONE_PLAYER_ONE_CREDIT:
case Style::ONE_PLAYER_ONE_CREDIT:
break;
case StyleDef::TWO_PLAYERS_TWO_CREDITS:
case StyleDef::ONE_PLAYER_TWO_CREDITS:
case Style::TWO_PLAYERS_TWO_CREDITS:
case Style::ONE_PLAYER_TWO_CREDITS:
{
FOREACH_PlayerNumber( p )
GAMESTATE->m_bSideIsJoined[p] = true;
@@ -476,7 +476,7 @@ void ModeChoice::Apply( PlayerNumber pn ) const
//
// We know what players are joined at the time we set the Style
//
if( m_pStyleDef != NULL )
if( m_pStyle != NULL )
{
GAMESTATE->PlayersFinalized();
}
@@ -486,7 +486,7 @@ bool ModeChoice::IsZero() const
{
if( m_game != GAME_INVALID ||
m_pm != PLAY_MODE_INVALID ||
m_pStyleDef != NULL ||
m_pStyle != NULL ||
m_dc != DIFFICULTY_INVALID ||
m_sAnnouncer != "" ||
m_sModifiers != "" ||