Skip to content

Commit bd505c4

Browse files
committed
Forgot gas gren limit cvar range checks
1 parent 9c818db commit bd505c4

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

code/game/g_main.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,15 @@ static void G_RegisterCvars( void ) {
296296
g_maxNailBombs.integer = 99;
297297
}
298298

299+
if ( g_maxGasGrens.integer < 0 ) {
300+
trap_Cvar_Set("g_maxGasGrens", "0");
301+
g_maxGasGrens.integer = 0;
302+
}
303+
else if (g_maxGasGrens.integer > 99 ) {
304+
trap_Cvar_Set("g_maxGasGrens", "99");
305+
g_maxGasGrens.integer = 99;
306+
}
307+
299308
level.warmupModificationCount = g_warmup.modificationCount;
300309

301310
// Golliwog: Set ceasefire automatically if we're in match mode.
@@ -365,6 +374,7 @@ void G_SetMatchState(int state) {
365374
const char *s = va("%i",state);
366375

367376
trap_Cvar_Set( "g_matchState", s );
377+
g_matchState.integer = state;
368378
trap_Cvar_Update( &g_matchState );
369379
trap_SetConfigstring( CS_MATCH_STATE, s );
370380

@@ -405,6 +415,19 @@ static void G_UpdateCvars( void ) {
405415
trap_Cvar_Update( cv->vmCvar );
406416
}
407417
}
418+
419+
if (cv->vmCvar == &g_maxGasGrens) {
420+
if (g_maxGasGrens.integer < 0) {
421+
trap_Cvar_Set("g_maxGasGrens", "0");
422+
g_maxGasGrens.integer = 0;
423+
trap_Cvar_Update( cv->vmCvar );
424+
}
425+
else if (g_maxGasGrens.integer > 99) {
426+
trap_Cvar_Set("g_maxGasGrens", "99");
427+
g_maxGasGrens.integer = 99;
428+
trap_Cvar_Update( cv->vmCvar );
429+
}
430+
}
408431

409432
#ifdef BUILD_LUA
410433
if( cv->vmCvar == &lua_modules || cv->vmCvar == &lua_allowedModules ) {

0 commit comments

Comments
 (0)