From 1c926170728dd04506435e3f858360d2c7eee0c1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 13 Sep 2006 09:12:51 +0000 Subject: [PATCH] phase out StyleInput; it's just a column number now StyleInput_INVALID -> Column_INVALID. (This notation is mostly used for enums, but makes sense for plain ints, too.) --- stepmania/src/Style.cpp | 19 +++++++++---------- stepmania/src/Style.h | 5 +++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/stepmania/src/Style.cpp b/stepmania/src/Style.cpp index f1ba73dd4e..8859c5deeb 100644 --- a/stepmania/src/Style.cpp +++ b/stepmania/src/Style.cpp @@ -38,10 +38,10 @@ void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& ori noteDataOut.LoadTransformed( original, m_iColsPerPlayer, iNewToOriginalTrack ); } -GameInput Style::StyleInputToGameInput( const StyleInput& StyleI, PlayerNumber pn ) const +GameInput Style::StyleInputToGameInput( int iCol, PlayerNumber pn ) const { - ASSERT_M( pn < NUM_PLAYERS && StyleI < MAX_COLS_PER_PLAYER, - ssprintf("P%i C%i", pn, StyleI) ); + ASSERT_M( pn < NUM_PLAYERS && iCol < MAX_COLS_PER_PLAYER, + ssprintf("P%i C%i", pn, iCol) ); bool bUsingOneSide = m_StyleType != ONE_PLAYER_TWO_SIDES && m_StyleType != TWO_PLAYERS_SHARED_SIDES; FOREACH_GameController(gc) @@ -50,24 +50,23 @@ GameInput Style::StyleInputToGameInput( const StyleInput& StyleI, PlayerNumber p continue; for( int i = 0; i < m_pGame->m_iButtonsPerController && m_iInputColumn[gc][i] != END_MAPPING; ++i ) - if( m_iInputColumn[gc][i] == StyleI ) + if( m_iInputColumn[gc][i] == iCol ) return GameInput( gc, i ); } - FAIL_M( ssprintf("Unknown StyleInput %i,%i", pn, StyleI) ); + FAIL_M( ssprintf("Invalid column %i,%i", pn, iCol) ); }; -StyleInput Style::GameInputToStyleInput( const GameInput &GameI ) const +int Style::GameInputToStyleInput( const GameInput &GameI ) const { if( m_iInputColumn[GameI.controller][GameI.button] == NO_MAPPING ) - return StyleInput_INVALID; + return Column_INVALID; for( int i = 0; i <= GameI.button; ++i ) if( m_iInputColumn[GameI.controller][i] == END_MAPPING ) - return StyleInput_INVALID; + return Column_INVALID; - StyleInput SI = (StyleInput) m_iInputColumn[GameI.controller][GameI.button]; - return SI; + return m_iInputColumn[GameI.controller][GameI.button]; } diff --git a/stepmania/src/Style.h b/stepmania/src/Style.h index 552b9035f0..3396c4f5f7 100644 --- a/stepmania/src/Style.h +++ b/stepmania/src/Style.h @@ -11,6 +11,7 @@ const int MAX_COLS_PER_PLAYER = MAX_NOTE_TRACKS; +static const int Column_INVALID = -1; class NoteData; class Game; @@ -53,8 +54,8 @@ public: bool m_bCanUseBeginnerHelper; bool m_bLockDifficulties; // used in couple Styles - GameInput StyleInputToGameInput( const StyleInput& StyleI, PlayerNumber pn ) const; - StyleInput GameInputToStyleInput( const GameInput &GameI ) const; + GameInput StyleInputToGameInput( int iCol, PlayerNumber pn ) const; + int GameInputToStyleInput( const GameInput &GameI ) const; PlayerNumber ControllerToPlayerNumber( GameController controller ) const;