From cf882f4a3013f51beced84186e0c2b223106d628 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 Aug 2022 23:46:41 +0100 Subject: [PATCH] Utilise `execversion` to one-time reset two cvars on upgrade to v1.4. - `cv_masterserver` - Replaces a hack checking for the original SRB2 MS addres every time, and additionally catches those who tested an early version of the http MS. - `cv_usegamma` - This was previously WAY too easy to accidentially change. This way, a user who has had this accidentially happen will automatically return to baseline. --- src/command.c | 7 +++++++ src/mserv.c | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/command.c b/src/command.c index 6064291df..4e9d97aa6 100644 --- a/src/command.c +++ b/src/command.c @@ -1884,6 +1884,13 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr) if (!(v->flags & CV_SAVE)) return true; + if (GETMAJOREXECVERSION(cv_execversion.value) < 8) // 8 = 1.4 + { + if (!stricmp(v->name, "masterserver") // Replaces a hack in MasterServer_OnChange for the original SRB2 MS. + || !stricmp(v->name, "gamma")) // Too easy to accidentially change in prior versions. + return false; + } + if (GETMAJOREXECVERSION(cv_execversion.value) < 2) // 2 = 1.0.2 { #if 0 diff --git a/src/mserv.c b/src/mserv.c index d59e1b9e0..e0078d553 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -554,17 +554,6 @@ static void MasterServer_OnChange(void) #ifdef MASTERSERVER UnregisterServer(); - /* - TODO: remove this for v2, it's just a hack - for those coming in with an old config. - */ - if ( - ! cv_masterserver.changed && - strcmp(cv_masterserver.string, "ms.srb2.org:28900") == 0 - ){ - CV_StealthSet(&cv_masterserver, cv_masterserver.defaultvalue); - } - Set_api(cv_masterserver.string); if (Online())