Fix negative frag/capturelimit causing an infinite map end loop

Reported by @vloup.
This commit is contained in:
Zack Middleton 2018-02-04 10:37:20 -06:00
parent fc16ac6bd2
commit 0b6d97f849

View file

@ -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 ( g_gametype.integer < GT_CTF && g_fraglimit.integer ) {
if ( level.teamScores[TEAM_RED] >= g_fraglimit.integer ) { if ( level.teamScores[TEAM_RED] >= g_fraglimit.integer ) {
trap_SendServerCommand( -1, "print \"Red hit the fraglimit.\n\"" ); 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 ( g_gametype.integer >= GT_CTF && g_capturelimit.integer ) {
if ( level.teamScores[TEAM_RED] >= g_capturelimit.integer ) { if ( level.teamScores[TEAM_RED] >= g_capturelimit.integer ) {