Skip to content

Commit

Permalink
Server: Player: Call SetPrefsFromUserinfo directly
Browse files Browse the repository at this point in the history
  • Loading branch information
tmp64 committed Aug 24, 2024
1 parent 23aeb7b commit 2584c91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/game/server/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,7 @@ void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer)
}
}

// Get weapon switching vars
char *autowepswitch = g_engfuncs.pfnInfoKeyValue(infobuffer, "cl_autowepswitch");
pPlayer->m_iAutoWepSwitch = autowepswitch[0] == 0 ? 1 : atoi(autowepswitch);
pPlayer->SetPrefsFromUserinfo(infobuffer);

g_pGameRules->ClientUserInfoChanged(pPlayer, infobuffer);
}
Expand Down
10 changes: 3 additions & 7 deletions src/game/server/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ BOOL CHalfLifeMultiplay::FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerIt
// player disabled auto weapon switching
return FALSE;
}

if (pPlayer->m_iAutoWepSwitch == 2)
else if (pPlayer->m_iAutoWepSwitch == 2)
{
// player disabled auto weapon switching when firing
if (pPlayer->m_afButtonLast & (IN_ATTACK | IN_ATTACK2))
Expand Down Expand Up @@ -1870,8 +1869,6 @@ void CHalfLifeMultiplay::SendHtmlMOTDToClient(edict_t *client, char *string)

void CHalfLifeMultiplay ::ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer)
{
// Set preferences
pPlayer->SetPrefsFromUserinfo(infobuffer);
}

//=========================================================
Expand Down Expand Up @@ -2132,10 +2129,9 @@ void CMultiplayBusters::PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *p

void CMultiplayBusters::ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer)
{
SetPlayerModel(pPlayer);
CHalfLifeMultiplay::ClientUserInfoChanged(pPlayer, infobuffer);

// Set preferences
pPlayer->SetPrefsFromUserinfo(infobuffer);
SetPlayerModel(pPlayer);
}

void CMultiplayBusters::PlayerSpawn(CBasePlayer *pPlayer)
Expand Down

0 comments on commit 2584c91

Please sign in to comment.