Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MP] fix g_weaponDisable + g_forcePowerDisable regression when creating listen servers #1217

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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