From: Mario Date: Sun, 25 Feb 2018 17:30:53 +0000 (+1000) Subject: Move weaponorder_byimpulse to ClientState X-Git-Tag: xonotic-v0.8.5~2280 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e432937a6aac2f10771930c4f95aab4e6b7511a5;p=xonotic%2Fxonotic-data.pk3dir.git Move weaponorder_byimpulse to ClientState --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index f0837f180..01f2b74e0 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1347,6 +1347,7 @@ void ClientDisconnect(entity this) MUTATOR_CALLHOOK(ClientDisconnect, this); if (CS(this).netname_previous) strunzone(CS(this).netname_previous); // needs to be before the CS entity is removed! + if (CS(this).weaponorder_byimpulse) strunzone(CS(this).weaponorder_byimpulse); ClientState_detach(this); Portal_ClearAll(this); @@ -1367,7 +1368,6 @@ void ClientDisconnect(entity this) bot_relinkplayerlist(); if (this.clientstatus) strunzone(this.clientstatus); - if (this.weaponorder_byimpulse) strunzone(this.weaponorder_byimpulse); if (this.personal) delete(this.personal); this.playerid = 0; diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 42d7d9560..48d42da00 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -113,6 +113,7 @@ CLASS(Client, Object) ATTRIB(Client, cmd_floodcount, int, this.cmd_floodcount); ATTRIB(Client, cmd_floodtime, float, this.cmd_floodtime); ATTRIB(Client, wasplayer, bool, this.wasplayer); + ATTRIB(Client, weaponorder_byimpulse, string, this.weaponorder_byimpulse); // networked cvars diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 8b4204b12..ff762e904 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -368,12 +368,12 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo { string o; o = W_FixWeaponOrder_ForceComplete(wo); - if(this.weaponorder_byimpulse) + if(CS(this).weaponorder_byimpulse) { - strunzone(this.weaponorder_byimpulse); - this.weaponorder_byimpulse = string_null; + strunzone(CS(this).weaponorder_byimpulse); + CS(this).weaponorder_byimpulse = string_null; } - this.weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(o)); + CS(this).weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(o)); return o; } diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 693d5a240..f059dfba9 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -304,7 +304,7 @@ void W_NextWeapon(entity this, int list, .entity weaponentity) if(list == 0) W_CycleWeapon(this, weaponorder_byid, -1, weaponentity); else if(list == 1) - W_CycleWeapon(this, this.weaponorder_byimpulse, -1, weaponentity); + W_CycleWeapon(this, CS(this).weaponorder_byimpulse, -1, weaponentity); else if(list == 2) W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, -1, weaponentity); } @@ -315,7 +315,7 @@ void W_PreviousWeapon(entity this, float list, .entity weaponentity) if(list == 0) W_CycleWeapon(this, weaponorder_byid, +1, weaponentity); else if(list == 1) - W_CycleWeapon(this, this.weaponorder_byimpulse, +1, weaponentity); + W_CycleWeapon(this, CS(this).weaponorder_byimpulse, +1, weaponentity); else if(list == 2) W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, weaponentity); }