diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index e80ce0a98b..b937ab0740 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -58,7 +58,14 @@ inline unsigned long max(unsigned long a, unsigned int b) { return a > b? a:b; } #define CLAMP(x, l, h) {if (x > h) x = h; else if (x < l) x = l;} -#define WRAP(x, n) {if (x<0) x += ((-x/n)+1)*n; x = x%n;} +inline void wrap( int &x, int n) +{ + if (x<0) + x += ((-x/n)+1)*n; + + x %= n; +} + //----------------------------------------------------------------------------- diff --git a/stepmania/src/ScreenSelectCharacter.cpp b/stepmania/src/ScreenSelectCharacter.cpp index 0f7b4b1ff5..1f939fa7b5 100644 --- a/stepmania/src/ScreenSelectCharacter.cpp +++ b/stepmania/src/ScreenSelectCharacter.cpp @@ -250,13 +250,13 @@ void ScreenSelectCharacter::AfterValueChange( PlayerNumber pn ) for( int j=0; jm_sAttacks[i][j] ); - unsigned c = m_iSelectedCharacter[pnAffected] - MAX_CHAR_ICONS_TO_SHOW/2; - WRAP( c, GAMESTATE->m_pCharacters.size() ); + int c = m_iSelectedCharacter[pnAffected] - MAX_CHAR_ICONS_TO_SHOW/2; + wrap( c, GAMESTATE->m_pCharacters.size() ); for( unsigned i=0; im_pCharacters.size() ); + wrap( c, GAMESTATE->m_pCharacters.size() ); Character* pCharacter = GAMESTATE->m_pCharacters[c]; Banner &banner = m_sprIcons[pnAffected][i]; banner.LoadIconFromCharacter( pCharacter );