# HG changeset patch # User Adam Kaminski # Date 1623558639 14400 # Sun Jun 13 00:30:39 2021 -0400 # Node ID 2e11b023bf1415cae78aee11eb40ada7acbb37e8 # Parent 88ecab1da6d7ebb2a3c66f1b2df17249bf68adc0 Prevent GAMEMODE from removing all or adding more than one of the PLAYERSEARN flags. diff -r 88ecab1da6d7 -r 2e11b023bf14 src/gamemode.cpp --- a/src/gamemode.cpp Sat Jun 12 23:52:34 2021 -0400 +++ b/src/gamemode.cpp Sun Jun 13 00:30:39 2021 -0400 @@ -351,6 +351,16 @@ else sc.ScriptError ( "Unknown option '%s', on line %d in GAMEMODE.", sc.String, sc.Line ); } + + // [AK] Get the type of "players earn" flag this game mode is currently using. + ULONG ulMask = GMF_PLAYERSEARNKILLS | GMF_PLAYERSEARNFRAGS | GMF_PLAYERSEARNPOINTS | GMF_PLAYERSEARNWINS; + ULONG ulEarnFlags = g_GameModes[GameMode].ulFlags & ulMask; + + // [AK] If all of these flags were removed or if more than one was added, then throw an error. + if ( ulEarnFlags == 0 ) + sc.ScriptError( "Players have no way of earning kills, frags, points, or wins in '%s'.", g_GameModes[GameMode].szName ); + else if (( ulEarnFlags & ( ulEarnFlags - 1 )) != 0 ) + sc.ScriptError( "There is more than one PLAYERSEARN flag enabled in '%s'.", g_GameModes[GameMode].szName ); } //*****************************************************************************