• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revisioncce4aa1b0fa0aafdf311b52b6412674ee98fdbad (tree)
Time2022-12-31 12:41:28
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Fixed: adding a CVar in a "defaultgamesettings" or "defaultlockedgamesettings" block would crash the game during startup.

Change Summary

Incremental Difference

diff -r b063ecdf6083 -r cce4aa1b0fa0 src/gamemode.cpp
--- a/src/gamemode.cpp Wed Jan 11 11:35:21 2023 -0500
+++ b/src/gamemode.cpp Fri Dec 30 22:41:28 2022 -0500
@@ -374,42 +374,42 @@
374374 Setting.Scope = Scope;
375375
376376 // [AK] Check if this CVar is already in the list. We don't want to have multiple copies of the same CVar.
377- for ( unsigned int i = 0; i < g_GameModes[GameMode].GameplaySettings.Size( ); i++ )
377+ for ( unsigned int i = 0; i < g_GameModes[mode].GameplaySettings.Size( ); i++ )
378378 {
379- if ( g_GameModes[GameMode].GameplaySettings[i].pCVar == Setting.pCVar )
379+ if ( g_GameModes[mode].GameplaySettings[i].pCVar == Setting.pCVar )
380380 {
381381 // [AK] Check if these two CVars have the same scope (i.e. offline or online games only), or if the
382382 // new CVar that we're trying to add has no scope (i.e. works in both offline and online games).
383- if (( g_GameModes[GameMode].GameplaySettings[i].Scope == Setting.Scope ) || ( Setting.Scope == GAMESCOPE_OFFLINEANDONLINE ))
383+ if (( g_GameModes[mode].GameplaySettings[i].Scope == Setting.Scope ) || ( Setting.Scope == GAMESCOPE_OFFLINEANDONLINE ))
384384 {
385385 // [AK] A locked CVar always replaces any unlocked copies of the same CVar that already exist.
386386 // On the other hand, an unlocked CVar cannot replace any locked copies.
387- if (( g_GameModes[GameMode].GameplaySettings[i].bIsLocked ) && ( Setting.bIsLocked == false ))
387+ if (( g_GameModes[mode].GameplaySettings[i].bIsLocked ) && ( Setting.bIsLocked == false ))
388388 {
389389 // [AK] If the new/unlocked CVar has no scope, but the old/locked CVar is "offlineonly" or "onlineonly",
390390 // then change the new CVar's scope so that it's opposite to the old CVar's. The two CVars can then co-exist.
391391 // Otherwise, the new CVar must be discarded.
392- if ( g_GameModes[GameMode].GameplaySettings[i].Scope != Setting.Scope )
393- Setting.Scope = g_GameModes[GameMode].GameplaySettings[i].Scope != GAMESCOPE_OFFLINEONLY ? GAMESCOPE_OFFLINEONLY : GAMESCOPE_ONLINEONLY;
392+ if ( g_GameModes[mode].GameplaySettings[i].Scope != Setting.Scope )
393+ Setting.Scope = g_GameModes[mode].GameplaySettings[i].Scope != GAMESCOPE_OFFLINEONLY ? GAMESCOPE_OFFLINEONLY : GAMESCOPE_ONLINEONLY;
394394 else
395395 bPushToList = false;
396396
397397 break;
398398 }
399399
400- g_GameModes[GameMode].GameplaySettings.Delete( i );
400+ g_GameModes[mode].GameplaySettings.Delete( i );
401401 }
402402 // [AK] If the old CVar has no scope, but the new CVar is "offlineonly" or "onlineonly", just change the old CVar's
403403 // scope so that it becomes opposite to the new CVar's. The two CVars can then co-exist.
404- else if ( g_GameModes[GameMode].GameplaySettings[i].Scope == GAMESCOPE_OFFLINEANDONLINE )
404+ else if ( g_GameModes[mode].GameplaySettings[i].Scope == GAMESCOPE_OFFLINEANDONLINE )
405405 {
406- g_GameModes[GameMode].GameplaySettings[i].Scope = Setting.Scope != GAMESCOPE_OFFLINEONLY ? GAMESCOPE_OFFLINEONLY : GAMESCOPE_ONLINEONLY;
406+ g_GameModes[mode].GameplaySettings[i].Scope = Setting.Scope != GAMESCOPE_OFFLINEONLY ? GAMESCOPE_OFFLINEONLY : GAMESCOPE_ONLINEONLY;
407407 }
408408 }
409409 }
410410
411411 if ( bPushToList )
412- g_GameModes[GameMode].GameplaySettings.Push( Setting );
412+ g_GameModes[mode].GameplaySettings.Push( Setting );
413413 }
414414 }
415415 }
Show on old repository browser