# HG changeset patch # User Adam Kaminski # Date 1630632855 14400 # Thu Sep 02 21:34:15 2021 -0400 # Node ID 231265a981503d560f0664f0facb2113c95e50fe # Parent 6ada262547b9acd007ccae44a90abaa97579b0dd The server now informs clients which maps have been used when syncing the map rotation. diff -r 6ada262547b9 -r 231265a98150 protocolspec/spec.misc.txt --- a/protocolspec/spec.misc.txt Wed Sep 01 11:08:54 2021 -0400 +++ b/protocolspec/spec.misc.txt Thu Sep 02 21:34:15 2021 -0400 @@ -30,6 +30,7 @@ Struct MapRotationEntry String name + Byte isUsed Byte minPlayers Byte maxPlayers EndStruct diff -r 6ada262547b9 -r 231265a98150 src/cl_main.cpp --- a/src/cl_main.cpp Wed Sep 01 11:08:54 2021 -0400 +++ b/src/cl_main.cpp Thu Sep 02 21:34:15 2021 -0400 @@ -6990,6 +6990,7 @@ // [AK] Set the current position of the map rotation. MAPROTATION_SetCurrentPosition( currentPosition ); + MAPROTATION_SetUsed( currentPosition ); // [BB] We'll receive a full update for the new map from the server. g_bFullUpdateIncomplete = true; @@ -9274,8 +9275,14 @@ void ServerCommands::SyncMapRotation::Execute() { for ( unsigned int i = 0; i < entries.Size(); i++ ) + { MAPROTATION_AddMap( entries[i].name, 0, entries[i].minPlayers, entries[i].maxPlayers, true ); + // [AK] Mark this map as used if we need to. It's also now the last entry on the map list. + if ( entries[i].isUsed ) + MAPROTATION_SetUsed( MAPROTATION_GetNumEntries( ) - 1 ); + } + // [AK] Set the current position of the map rotation. MAPROTATION_SetCurrentPosition( currentPosition ); } diff -r 6ada262547b9 -r 231265a98150 src/maprotation.cpp --- a/src/maprotation.cpp Wed Sep 01 11:08:54 2021 -0400 +++ b/src/maprotation.cpp Thu Sep 02 21:34:15 2021 -0400 @@ -345,6 +345,16 @@ //***************************************************************************** // +void MAPROTATION_SetUsed( ULONG ulIdx, bool bUsed ) +{ + if ( ulIdx >= g_MapRotationEntries.size( )) + return; + + g_MapRotationEntries[ulIdx].bUsed = bUsed; +} + +//***************************************************************************** +// void MAPROTATION_AddMap( FCommandLine &argv, bool bSilent, bool bInsert ) { int iPosition = bInsert ? atoi( argv[2] ) : 0; @@ -512,8 +522,11 @@ message.Format( "%lu. %s - %s", ulIdx + 1, g_MapRotationEntries[ulIdx].pMap->mapname, g_MapRotationEntries[ulIdx].pMap->LookupLevelName( ).GetChars( )); // [AK] Highlight the current position in the map rotation in green, but only if we're actually playing on that map. + // Otherwise, maps that have already been played will be highlighted in red. if (( g_ulCurMapInList == ulIdx ) && ( stricmp( level.mapname, g_MapRotationEntries[g_ulCurMapInList].pMap->mapname ) == 0 )) message.Insert( 0, TEXTCOLOR_GREEN ); + else if ( g_MapRotationEntries[ulIdx].bUsed ) + message.Insert( 0, TEXTCOLOR_RED ); // [AK] Also print the min and max player limits if they're different from the default values. if (( g_MapRotationEntries[ulIdx].ulMinPlayers > 0 ) || ( g_MapRotationEntries[ulIdx].ulMaxPlayers < MAXPLAYERS )) diff -r 6ada262547b9 -r 231265a98150 src/maprotation.h --- a/src/maprotation.h Wed Sep 01 11:08:54 2021 -0400 +++ b/src/maprotation.h Thu Sep 02 21:34:15 2021 -0400 @@ -88,6 +88,7 @@ void MAPROTATION_SetPositionToMap( const char *pszMapName ); bool MAPROTATION_IsMapInRotation( const char *pszMapName ); bool MAPROTATION_IsUsed( ULONG ulIdx ); +void MAPROTATION_SetUsed( ULONG ulIdx, bool bUsed = true ); void MAPROTATION_AddMap( FCommandLine &argv, bool bSilent, bool bInsert = false ); void MAPROTATION_AddMap( const char *pszMapName, int iPosition, ULONG ulMinPlayers, ULONG ulMaxPlayers, bool bSilent ); void MAPROTATION_DelMap( const char *pszMapName, bool bSilent ); diff -r 6ada262547b9 -r 231265a98150 src/sv_commands.cpp --- a/src/sv_commands.cpp Wed Sep 01 11:08:54 2021 -0400 +++ b/src/sv_commands.cpp Thu Sep 02 21:34:15 2021 -0400 @@ -4980,6 +4980,7 @@ { ServerCommands::MapRotationEntry entry; entry.name = MAPROTATION_GetMap( i )->mapname; + entry.isUsed = MAPROTATION_IsUsed( i ); entry.minPlayers = MAPROTATION_GetPlayerLimits( i, false ); entry.maxPlayers = MAPROTATION_GetPlayerLimits( i, true );