Skip to content

Commit

Permalink
[MP] fix g_weaponDisable + g_forcePowerDisable regression when creati…
Browse files Browse the repository at this point in the history
…ng 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
  • Loading branch information
Razish committed Feb 29, 2024
1 parent 1e8a799 commit c79e657
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions codemp/ui/ui_main.c
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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";
}
Expand All @@ -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)
Expand Down Expand Up @@ -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)) {
Expand All @@ -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;
Expand Down Expand Up @@ -7535,7 +7531,6 @@ static void UI_BuildServerDisplayList(int force) {
// done with this server
if (ping > 0) {
trap->LAN_MarkServerVisible(lanSource, i, qfalse);
numinvisible++;
}
}
}
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit c79e657

Please sign in to comment.