int BattleListCtrl::CompareOneCrit( DataType u1, DataType u2, int col, int dir ) const { switch ( col ) { case 0: return dir * CompareStatus( u1, u2 ); case 1: { try { return dir * u1->GetFounder().GetCountry().CmpNoCase( u2->GetFounder().GetCountry() ); }catch(...){} break; } case 2: return dir * compareSimple( u1->GetRankNeeded(), u2->GetRankNeeded() ); case 3: return dir * u1->GetDescription().CmpNoCase( u2->GetDescription() ); case 4: return dir * u1->GetHostMapName().CmpNoCase( u2->GetHostMapName() ); case 5: return dir * u1->GetHostModName().CmpNoCase( u2->GetHostModName() ); case 6: { try { return dir * u1->GetFounder().GetNick().CmpNoCase( u2->GetFounder().GetNick() ); }catch(...){} break; } case 7: return dir * compareSimple( u1->GetSpectators(), u2->GetSpectators() ); case 8: return dir * ComparePlayer( u1, u2 ); case 9: return dir * compareSimple( u1->GetMaxPlayers(), u2->GetMaxPlayers() ); case 10: return dir * compareSimple( u1->GetBattleRunningTime(), u2->GetBattleRunningTime()); case 11: return dir * compareSimple( u1->GetEngineVersion(), u2->GetEngineVersion() ); default: return 0; } return 0; // simply to avoid compiler warning }
int BattleroomListCtrl::CompareOneCrit(DataType u1, DataType u2, int col, int dir) const { if ( col == m_status_column_index ) return dir * CompareStatus( u1, u2, m_battle ); if ( col == m_ingame_column_index ) return dir * CompareLobbyStatus( u1, u2 ); if ( col == m_faction_column_index ) return dir * CompareSide( u1, u2 ); if ( col == m_colour_column_index ) return dir * CompareColor( u1, u2 ); if ( col == m_country_column_index ) return dir * compareSimple( u1, u2 ); if ( col == m_rank_column_index ) return dir * CompareRank( u1, u2 ); if ( col == m_nick_column_index ) return dir * u1->GetNick().CmpNoCase( u2->GetNick() ); if ( col == m_team_column_index ) return dir * CompareTeam( u1, u2 ); if ( col == m_ally_column_index ) return dir * CompareAlly( u1, u2 ); if ( col == m_resourcebonus_column_index ) return dir * CompareHandicap( u1, u2 ); return 0; }