From 0b6d97f84937750891a2d22c72af30de79d686fe Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 4 Feb 2018 10:37:20 -0600 Subject: [PATCH] Fix negative frag/capturelimit causing an infinite map end loop Reported by @vloup. --- code/game/g_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/game/g_main.c b/code/game/g_main.c index 63e93e07..4398113e 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -1380,6 +1380,12 @@ void CheckExitRules( void ) { } } + if ( g_fraglimit.integer < 0 ) { + G_Printf( "fraglimit %i is out of range, defaulting to 0\n", g_fraglimit.integer ); + trap_Cvar_Set( "fraglimit", "0" ); + trap_Cvar_Update( &g_fraglimit ); + } + if ( g_gametype.integer < GT_CTF && g_fraglimit.integer ) { if ( level.teamScores[TEAM_RED] >= g_fraglimit.integer ) { trap_SendServerCommand( -1, "print \"Red hit the fraglimit.\n\"" ); @@ -1411,6 +1417,12 @@ void CheckExitRules( void ) { } } + if ( g_capturelimit.integer < 0 ) { + G_Printf( "capturelimit %i is out of range, defaulting to 0\n", g_capturelimit.integer ); + trap_Cvar_Set( "capturelimit", "0" ); + trap_Cvar_Update( &g_capturelimit ); + } + if ( g_gametype.integer >= GT_CTF && g_capturelimit.integer ) { if ( level.teamScores[TEAM_RED] >= g_capturelimit.integer ) {