Make reverting netvars a toggle that defaults off and remove CV_NETVAR from local server cvars

For Kart players, its common practice to save replays and or leave the server play with the a server's settings offline for stuff like timeattack or practice which ends up making this feature more annoying then anything. Also removed CV_NETVAR from local server cvars so that people doing the first case don't get listen server settings overwritten just because they wanted to practice offline
This commit is contained in:
NepDisk 2025-07-17 15:55:11 -04:00
parent 868c9c9a87
commit 1292ad2325
4 changed files with 20 additions and 9 deletions

View file

@ -89,6 +89,8 @@ CV_PossibleValue_t kartspeed_cons_t[] = {
{0, NULL}
};
consvar_t cv_resetnetvars = CVAR_INIT ("resetnetvars", "Off", CV_SAVE, CV_OnOff, NULL);
// Filter consvars by EXECVERSION
// First implementation is 2 (1.0.2), so earlier configs default at 1 (1.0.0)
// Also set CV_HIDEN during runtime, after config is loaded
@ -1875,7 +1877,7 @@ void CV_SaveVars(UINT8 **p, boolean in_demo)
static void CV_LoadVars(UINT8 **p,
consvar_t *(*got)(UINT8 **p, char **ret_value, boolean *ret_stealth))
{
const boolean store = (client || demo.playback);
const boolean store = cv_resetnetvars.value && (client || demo.playback);
consvar_t *cvar;
UINT16 count;
@ -1917,6 +1919,12 @@ void CV_RevertNetVars(void)
{
consvar_t * cvar;
if (!cv_resetnetvars.value)
{
// Sorry bud, not today.
return;
}
for (cvar = consvar_vars; cvar; cvar = cvar->next)
{
if (cvar->revert.v.string != NULL)

View file

@ -192,6 +192,8 @@ extern CV_PossibleValue_t kartspeed_cons_t[];
extern consvar_t cv_execversion;
extern consvar_t cv_resetnetvars;
void CV_InitFilterVar(void);
void CV_ToggleExecVersion(boolean enable);

View file

@ -189,7 +189,7 @@ ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
consvar_t cv_showjoinaddress = CVAR_INIT ("showjoinaddress", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL);
consvar_t cv_showjoinaddress = CVAR_INIT ("showjoinaddress", "Off", CV_SAVE, CV_OnOff, NULL);
static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}};
consvar_t cv_playbackspeed = CVAR_INIT ("playbackspeed", "1", 0, playbackspeed_cons_t, NULL);
@ -3348,7 +3348,7 @@ static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {MAXPLAYERS, "MAX"}
consvar_t cv_maxplayers = CVAR_INIT ("maxplayers", "8", CV_SAVE|CV_CALL, maxplayers_cons_t, Joinable_OnChange);
static CV_PossibleValue_t joindelay_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, "Off"}, {0, NULL}};
consvar_t cv_joindelay = CVAR_INIT ("joindelay", "10", CV_SAVE|CV_NETVAR, joindelay_cons_t, NULL);
consvar_t cv_joindelay = CVAR_INIT ("joindelay", "10", CV_SAVE, joindelay_cons_t, NULL);
// Here for dedicated servers
static CV_PossibleValue_t discordinvites_cons_t[] = {{0, "Admins Only"}, {1, "Everyone"}, {0, NULL}};
@ -3356,17 +3356,17 @@ consvar_t cv_discordinvites = CVAR_INIT ("discordinvites", "Everyone", CV_SAVE|C
static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}};
consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "2", CV_SAVE|CV_NETVAR, resynchattempts_cons_t, NULL);
consvar_t cv_blamecfail = CVAR_INIT ("blamecfail", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL);
consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "2", CV_SAVE, resynchattempts_cons_t, NULL);
consvar_t cv_blamecfail = CVAR_INIT ("blamecfail", "Off", CV_SAVE, CV_OnOff, NULL);
// max file size to send to a player (in kilobytes)
static CV_PossibleValue_t maxsend_cons_t[] = {{0, "MIN"}, {51200, "MAX"}, {0, NULL}};
consvar_t cv_maxsend = CVAR_INIT ("maxsend", "51200", CV_SAVE|CV_NETVAR, maxsend_cons_t, NULL);
consvar_t cv_noticedownload = CVAR_INIT ("noticedownload", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL);
consvar_t cv_maxsend = CVAR_INIT ("maxsend", "51200", CV_SAVE, maxsend_cons_t, NULL);
consvar_t cv_noticedownload = CVAR_INIT ("noticedownload", "Off", CV_SAVE, CV_OnOff, NULL);
// Speed of file downloading (in packets per tic)
static CV_PossibleValue_t downloadspeed_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}};
consvar_t cv_downloadspeed = CVAR_INIT ("downloadspeed", "32", CV_SAVE|CV_NETVAR, downloadspeed_cons_t, NULL);
consvar_t cv_downloadspeed = CVAR_INIT ("downloadspeed", "32", CV_SAVE, downloadspeed_cons_t, NULL);
static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}};
consvar_t cv_connectawaittime = CVAR_INIT ("connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL);

View file

@ -603,7 +603,7 @@ consvar_t cv_maxping = CVAR_INIT ("maxdelay", "20", CV_SAVE, CV_Unsigned, NULL);
consvar_t cv_lagless = CVAR_INIT ("lagless", "On", CV_SAVE|CV_NETVAR|CV_CALL, CV_OnOff, Lagless_OnChange);
static CV_PossibleValue_t pingtimeout_cons_t[] = {{8, "MIN"}, {120, "MAX"}, {0, NULL}};
consvar_t cv_pingtimeout = CVAR_INIT ("maxdelaytimeout", "10", CV_SAVE|CV_NETVAR, pingtimeout_cons_t, NULL);
consvar_t cv_pingtimeout = CVAR_INIT ("maxdelaytimeout", "10", CV_SAVE, pingtimeout_cons_t, NULL);
// show your ping on the HUD next to framerate. Defaults to warning only (shows up if your ping is > maxping)
static CV_PossibleValue_t showping_cons_t[] = {{0, "Off"}, {1, "Always"}, {2, "Warning"}, {0, NULL}};
@ -1026,6 +1026,7 @@ void D_RegisterClientCommands(void)
COM_AddCommand("stopdemo", Command_Stopdemo_f);
COM_AddCommand("playintro", Command_Playintro_f);
CV_RegisterVar(&cv_resyncdemo);
CV_RegisterVar(&cv_resetnetvars);
COM_AddCommand("resetcamera", Command_ResetCamera_f);