View | Details | Raw Unified
Collapse All | Expand All

(-) StepMania-3.9-src-orig/src/Difficulty.cpp (-1 / +1 lines)
 Lines 57-63    Link Here 
CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd )
CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd )
{
{
	for( CourseDifficulty d=(CourseDifficulty)(cd+1); d<NUM_DIFFICULTIES; ((int&)d)++ )
	for( CourseDifficulty d=(CourseDifficulty)(cd+1); d<NUM_DIFFICULTIES; enum_add(d, 1) )
	{
	{
		if( GAMESTATE->IsCourseDifficultyShown(d) )
		if( GAMESTATE->IsCourseDifficultyShown(d) )
			return d;
			return d;
(-) StepMania-3.9-src-orig/src/PlayerNumber.cpp (-20 / +12 lines)
 Lines 22-62    Link Here 
PlayerNumber GetNextHumanPlayer( PlayerNumber pn )
PlayerNumber GetNextHumanPlayer( PlayerNumber pn )
{
{
	for( PlayerNumber p=(PlayerNumber)(pn+1); p<NUM_PLAYERS; ((int&)p)++ )
	for( enum_add(pn, 1); pn < NUM_PLAYERS; enum_add(pn, 1) )
	{
		if( GAMESTATE->IsHumanPlayer(pn) )
		if( GAMESTATE->IsHumanPlayer(p) )
			return pn;
			return p;
	}
	return PLAYER_INVALID;
	return PLAYER_INVALID;
}
}
PlayerNumber GetNextEnabledPlayer( PlayerNumber pn )
PlayerNumber GetNextEnabledPlayer( PlayerNumber pn )
{
{
	for( PlayerNumber p=(PlayerNumber)(pn+1); p<NUM_PLAYERS; ((int&)p)++ )
	for( enum_add(pn, 1); pn < NUM_PLAYERS; enum_add(pn, 1) )
	{
		if( GAMESTATE->IsPlayerEnabled(pn) )
		if( GAMESTATE->IsPlayerEnabled(p) )
			return pn;
			return p;
	}
	return PLAYER_INVALID;
	return PLAYER_INVALID;
}
}
PlayerNumber GetNextCpuPlayer( PlayerNumber pn )
PlayerNumber GetNextCpuPlayer( PlayerNumber pn )
{
{
	for( PlayerNumber p=(PlayerNumber)(pn+1); p<NUM_PLAYERS; ((int&)p)++ )
	for( enum_add(pn, 1); pn < NUM_PLAYERS; enum_add(pn, 1) )
	{
		if( GAMESTATE->IsCpuPlayer(pn) )
		if( GAMESTATE->IsCpuPlayer(p) )
			return pn;
			return p;
	}
	return PLAYER_INVALID;
	return PLAYER_INVALID;
}
}
PlayerNumber GetNextPotentialCpuPlayer( PlayerNumber pn )
PlayerNumber GetNextPotentialCpuPlayer( PlayerNumber pn )
{
{
	for( PlayerNumber p=(PlayerNumber)(pn+1); p<NUM_PLAYERS; ((int&)p)++ )
	for( enum_add(pn, 1); pn < NUM_PLAYERS; enum_add(pn, 1) )
	{
		if( !GAMESTATE->IsHumanPlayer(pn) )
		if( !GAMESTATE->IsHumanPlayer(p) )
			return pn;
			return p;
	}
	return PLAYER_INVALID;
	return PLAYER_INVALID;
}
}
(-) StepMania-3.9-src-orig/src/RageUtil.h (+8 lines)
 Lines 53-58    Link Here 
	return false;
	return false;
}
}
template<class T>
inline bool ENUM_CLAMP( T &x, T l, T h )
{
	if (x > h)	{ x = h; return true; }
	else if (x < l) { x = l; return true; }
	return false;
}
inline void wrap( int &x, int n)
inline void wrap( int &x, int n)
{
{
	if (x<0)
	if (x<0)
(-) StepMania-3.9-src-orig/src/ScreenBookkeeping.cpp (-2 / +2 lines)
 Lines 74-87    Link Here 
void ScreenBookkeeping::MenuLeft( PlayerNumber pn )
void ScreenBookkeeping::MenuLeft( PlayerNumber pn )
{
{
	m_View = (View)(m_View-1);
	m_View = (View)(m_View-1);
	CLAMP( (int&)m_View, 0, NUM_VIEWS-1 );
	ENUM_CLAMP( m_View, View(0), View(NUM_VIEWS-1) );
	ChangeView( m_View );
	ChangeView( m_View );
}
}
void ScreenBookkeeping::MenuRight( PlayerNumber pn )
void ScreenBookkeeping::MenuRight( PlayerNumber pn )
{
{
	m_View = (View)(m_View+1);
	m_View = (View)(m_View+1);
	CLAMP( (int&)m_View, 0, NUM_VIEWS-1 );
	ENUM_CLAMP( m_View, View(0), View(NUM_VIEWS-1) );
	ChangeView( m_View );
	ChangeView( m_View );
}
}
(-) StepMania-3.9-src-orig/src/ScreenSetTime.cpp (-1 / +1 lines)
 Lines 160-166    Link Here 
	SetTimeSelection OldSelection = m_Selection;
	SetTimeSelection OldSelection = m_Selection;
	enum_add<SetTimeSelection>( m_Selection, iDirection );
	enum_add<SetTimeSelection>( m_Selection, iDirection );
	CLAMP( (int&)m_Selection, 0, NUM_SET_TIME_SELECTIONS-1 );
	ENUM_CLAMP( m_Selection, SetTimeSelection(0), SetTimeSelection(NUM_SET_TIME_SELECTIONS-1) );
	if( iDirection != 0 && m_Selection == OldSelection )
	if( iDirection != 0 && m_Selection == OldSelection )
		return; // can't move any more
		return; // can't move any more
(-) StepMania-3.9-src-orig/src/Song.cpp (-4 / +4 lines)
 Lines 916-937    Link Here 
	if( pSteps )
	if( pSteps )
		return pSteps;
		return pSteps;
	newDC = (Difficulty)(dc-1);
	newDC = (Difficulty)(dc-1);
	CLAMP( (int&)newDC, 0, NUM_DIFFICULTIES-1 );
	ENUM_CLAMP( newDC, Difficulty(0), Difficulty(NUM_DIFFICULTIES-1) );
	pSteps = GetStepsByDifficulty( st, newDC );
	pSteps = GetStepsByDifficulty( st, newDC );
	if( pSteps )
	if( pSteps )
		return pSteps;
		return pSteps;
	newDC = (Difficulty)(dc+1);
	newDC = (Difficulty)(dc+1);
	CLAMP( (int&)newDC, 0, NUM_DIFFICULTIES-1 );
	ENUM_CLAMP( newDC, Difficulty(0), Difficulty(NUM_DIFFICULTIES-1) );
	pSteps = GetStepsByDifficulty( st, newDC );
	pSteps = GetStepsByDifficulty( st, newDC );
	if( pSteps )
	if( pSteps )
		return pSteps;
		return pSteps;
	newDC = (Difficulty)(dc-2);
	newDC = (Difficulty)(dc-2);
	CLAMP( (int&)newDC, 0, NUM_DIFFICULTIES-1 );
	ENUM_CLAMP( newDC, Difficulty(0), Difficulty(NUM_DIFFICULTIES-1) );
	pSteps = GetStepsByDifficulty( st, newDC );
	pSteps = GetStepsByDifficulty( st, newDC );
	if( pSteps )
	if( pSteps )
		return pSteps;
		return pSteps;
	newDC = (Difficulty)(dc+2);
	newDC = (Difficulty)(dc+2);
	CLAMP( (int&)newDC, 0, NUM_DIFFICULTIES-1 );
	ENUM_CLAMP( newDC, Difficulty(0), Difficulty(NUM_DIFFICULTIES-1) );
	pSteps = GetStepsByDifficulty( st, newDC );
	pSteps = GetStepsByDifficulty( st, newDC );
	return pSteps;
	return pSteps;
}
}