From c79e6576a0d19e961f096c44835f93e0ba6b8fe6 Mon Sep 17 00:00:00 2001 From: razor Date: Thu, 29 Feb 2024 11:22:34 +1100 Subject: [PATCH] [MP] fix g_weaponDisable + g_forcePowerDisable regression when creating listen servers (#1217) * fix g_weaponDisable + g_forcePowerDisable regression when creating listen servers. re-enabling this block that turns e.g. g_weaponDisable 1 --> g_weaponDisable 524279 also fix some stray uninitialised warnings * replace commented code with commented words --- codemp/ui/ui_main.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/codemp/ui/ui_main.c b/codemp/ui/ui_main.c index 45501d9479..3375301f79 100644 --- a/codemp/ui/ui_main.c +++ b/codemp/ui/ui_main.c @@ -6505,7 +6505,6 @@ static void UI_RunMenuScript(char **args) { UI_UpdateCharacterSkin(); } -#if 0 else if (Q_stricmp(name, "setui_dualforcepower") == 0) { int forcePowerDisable = trap->Cvar_VariableValue("g_forcePowerDisable"); @@ -6540,7 +6539,7 @@ static void UI_RunMenuScript(char **args) } else if (Q_stricmp(name, "dualForcePowers") == 0) { - int dualforcePower,i, forcePowerDisable; + int dualforcePower,i, forcePowerDisable=0; dualforcePower = trap->Cvar_VariableValue("ui_dualforcepower"); if (dualforcePower==0) // All force powers @@ -6598,8 +6597,8 @@ static void UI_RunMenuScript(char **args) int weaponDisable,i; const char *cvarString; - if (uiInfo.gameTypes[ui_netGameType.integer].gtEnum == GT_DUEL || - uiInfo.gameTypes[ui_netGameType.integer].gtEnum == GT_POWERDUEL) + if (uiInfo.gameTypes[ui_netGametype.integer].gtEnum == GT_DUEL || + uiInfo.gameTypes[ui_netGametype.integer].gtEnum == GT_POWERDUEL) { cvarString = "g_duelWeaponDisable"; } @@ -6624,7 +6623,6 @@ static void UI_RunMenuScript(char **args) trap->Cvar_Set(cvarString, va("%i",weaponDisable)); } } -#endif // If this is siege, change all the bots to humans, because we faked it earlier // swapping humans for bots on the menu else if (Q_stricmp(name, "setSiegeNoBots") == 0) @@ -7414,7 +7412,6 @@ static void UI_BuildServerDisplayList(int force) { int i, count, clients, maxClients, ping, game, len, passw/*, visible*/; char info[MAX_STRING_CHARS]; // qboolean startRefresh = qtrue; TTimo: unused - static int numinvisible; int lanSource; if (!(force || uiInfo.uiDC.realTime > uiInfo.serverStatus.nextDisplayRefresh)) { @@ -7440,7 +7437,6 @@ static void UI_BuildServerDisplayList(int force) { lanSource = UI_SourceForLAN(); if (force) { - numinvisible = 0; // clear number of displayed servers uiInfo.serverStatus.numDisplayServers = 0; uiInfo.serverStatus.numPlayersOnServers = 0; @@ -7535,7 +7531,6 @@ static void UI_BuildServerDisplayList(int force) { // done with this server if (ping > 0) { trap->LAN_MarkServerVisible(lanSource, i, qfalse); - numinvisible++; } } } @@ -7705,7 +7700,7 @@ UI_BuildFindPlayerList ================== */ static void UI_BuildFindPlayerList(qboolean force) { - static int numFound, numTimeOuts; + static int numFound; int i, j, resend; serverStatusInfo_t info; char name[MAX_NAME_LENGTH+2]; @@ -7745,7 +7740,6 @@ static void UI_BuildFindPlayerList(qboolean force) { // sizeof(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1]), // "searching %d...", uiInfo.pendingServerStatus.num); numFound = 0; - numTimeOuts++; } for (i = 0; i < MAX_SERVERSTATUSREQUESTS; i++) { // if this pending server is valid @@ -7796,7 +7790,7 @@ static void UI_BuildFindPlayerList(qboolean force) { if (!uiInfo.pendingServerStatus.server[i].valid || uiInfo.pendingServerStatus.server[i].startTime < uiInfo.uiDC.realTime - ui_serverStatusTimeOut.integer) { if (uiInfo.pendingServerStatus.server[i].valid) { - numTimeOuts++; + // timed out } // reset server status request for this address UI_GetServerStatusInfo( uiInfo.pendingServerStatus.server[i].adrstr, NULL );