From b5c8db00f836f303ca33319f73969f6226474059 Mon Sep 17 00:00:00 2001
From: LoganAir <logan.gba@gmail.com>
Date: Sun, 26 Nov 2023 17:44:03 -0500
Subject: [PATCH] Update mserv.c

https://mb.srb2.org is now behind CloudFlare, and the Master Server API v1 can not be accessed for some users due to this change. so I setup a new dual stack DNS record for accessing to the API
---
 src/mserv.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mserv.c b/src/mserv.c
index 62cda96e45..f83b16d07e 100644
--- a/src/mserv.c
+++ b/src/mserv.c
@@ -61,7 +61,7 @@ static CV_PossibleValue_t masterserver_update_rate_cons_t[] = {
 	{0,NULL}
 };
 
-consvar_t cv_masterserver = CVAR_INIT ("masterserver", "https://mb.srb2.org/MS/0", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange);
+consvar_t cv_masterserver = CVAR_INIT ("masterserver", "https://ds.ms.srb2.org/MS/0", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange);
 consvar_t cv_servername = CVAR_INIT ("servername", "SRB2 server", CV_SAVE|CV_NETVAR|CV_CALL|CV_NOINIT|CV_ALLOWLUA, NULL, Update_parameters);
 
 consvar_t cv_masterserver_update_rate = CVAR_INIT ("masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, Update_parameters);
@@ -544,6 +544,13 @@ static void MasterServer_OnChange(void)
 		CV_StealthSet(&cv_masterserver, cv_masterserver.defaultvalue);
 	}
 
+	if (
+			! cv_masterserver.changed &&
+			strcmp(cv_masterserver.string, "https://mb.srb2.org/MS/0") == 0
+	){
+		CV_StealthSet(&cv_masterserver, cv_masterserver.defaultvalue);
+	}
+
 	Set_api(cv_masterserver.string);
 
 	if (Online())
-- 
GitLab