Revision | cce4aa1b0fa0aafdf311b52b6412674ee98fdbad (tree) |
---|---|
Time | 2022-12-31 12:41:28 |
Author | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Fixed: adding a CVar in a "defaultgamesettings" or "defaultlockedgamesettings" block would crash the game during startup.
@@ -374,42 +374,42 @@ | ||
374 | 374 | Setting.Scope = Scope; |
375 | 375 | |
376 | 376 | // [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++ ) | |
378 | 378 | { |
379 | - if ( g_GameModes[GameMode].GameplaySettings[i].pCVar == Setting.pCVar ) | |
379 | + if ( g_GameModes[mode].GameplaySettings[i].pCVar == Setting.pCVar ) | |
380 | 380 | { |
381 | 381 | // [AK] Check if these two CVars have the same scope (i.e. offline or online games only), or if the |
382 | 382 | // 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 )) | |
384 | 384 | { |
385 | 385 | // [AK] A locked CVar always replaces any unlocked copies of the same CVar that already exist. |
386 | 386 | // 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 )) | |
388 | 388 | { |
389 | 389 | // [AK] If the new/unlocked CVar has no scope, but the old/locked CVar is "offlineonly" or "onlineonly", |
390 | 390 | // then change the new CVar's scope so that it's opposite to the old CVar's. The two CVars can then co-exist. |
391 | 391 | // 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; | |
394 | 394 | else |
395 | 395 | bPushToList = false; |
396 | 396 | |
397 | 397 | break; |
398 | 398 | } |
399 | 399 | |
400 | - g_GameModes[GameMode].GameplaySettings.Delete( i ); | |
400 | + g_GameModes[mode].GameplaySettings.Delete( i ); | |
401 | 401 | } |
402 | 402 | // [AK] If the old CVar has no scope, but the new CVar is "offlineonly" or "onlineonly", just change the old CVar's |
403 | 403 | // 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 ) | |
405 | 405 | { |
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; | |
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
410 | 410 | |
411 | 411 | if ( bPushToList ) |
412 | - g_GameModes[GameMode].GameplaySettings.Push( Setting ); | |
412 | + g_GameModes[mode].GameplaySettings.Push( Setting ); | |
413 | 413 | } |
414 | 414 | } |
415 | 415 | } |