fix old sort not being selected in sort menu
This commit is contained in:
@@ -308,33 +308,35 @@ bool MusicWheel::SelectCourse( Course *p )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool DescribesCurrentModeForAllPlayersAndSort( const GameCommand &gc, SortOrder so )
|
||||||
|
{
|
||||||
|
const SortOrder OldSortOrder = GAMESTATE->m_SortOrder;
|
||||||
|
GAMESTATE->m_SortOrder = so;
|
||||||
|
bool bRet = gc.DescribesCurrentModeForAllPlayers();
|
||||||
|
GAMESTATE->m_SortOrder = OldSortOrder;
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
bool MusicWheel::SelectSort( SortOrder so )
|
bool MusicWheel::SelectSort( SortOrder so )
|
||||||
{
|
{
|
||||||
if(so == SORT_INVALID)
|
if(so == SORT_INVALID)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
const vector<WheelItemData> &from = m_WheelItemDatas[GAMESTATE->m_SortOrder];
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
vector<WheelItemData> &from = m_WheelItemDatas[GAMESTATE->m_SortOrder];
|
|
||||||
for( i=0; i<from.size(); i++ )
|
for( i=0; i<from.size(); i++ )
|
||||||
{
|
if( DescribesCurrentModeForAllPlayersAndSort( from[i].m_Action, so) )
|
||||||
if( from[i].m_Action.m_SortOrder != so )
|
break;
|
||||||
continue;
|
if( i == from.size() )
|
||||||
if( !from[i].m_Action.DescribesCurrentModeForAllPlayers() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// make its group the currently expanded group
|
|
||||||
SetOpenGroup(from[i].m_sSectionName);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(i == from.size())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// make its group the currently expanded group
|
||||||
|
SetOpenGroup( from[i].m_sSectionName );
|
||||||
|
|
||||||
for( i=0; i<m_CurWheelItemData.size(); i++ )
|
for( i=0; i<m_CurWheelItemData.size(); i++ )
|
||||||
{
|
{
|
||||||
if( m_CurWheelItemData[i]->m_Action.m_SortOrder != so )
|
if( !DescribesCurrentModeForAllPlayersAndSort( m_CurWheelItemData[i]->m_Action, so) )
|
||||||
continue;
|
|
||||||
if( !m_CurWheelItemData[i]->m_Action.DescribesCurrentModeForAllPlayers() )
|
|
||||||
continue;
|
continue;
|
||||||
m_iSelection = i; // select it
|
m_iSelection = i; // select it
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user