]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Port parm_idlesince to ClientState
authorMario <mario@smbclan.net>
Sat, 15 Jul 2017 14:24:39 +0000 (00:24 +1000)
committerMario <mario@smbclan.net>
Sat, 15 Jul 2017 14:24:39 +0000 (00:24 +1000)
qcsrc/ecs/systems/sv_physics.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/defs.qh

index 9e46dcfc57513b42bb6d6e634666a7c30fe6ed80..20cd53144f884ffff258aef9d9c7ff37b15f6045 100644 (file)
@@ -11,11 +11,11 @@ void sys_phys_fix(entity this, float dt)
 bool sys_phys_override(entity this, float dt)
 {
        int buttons = PHYS_INPUT_BUTTON_MASK(this);
-       float idlesince = this.parm_idlesince;
-       this.parm_idlesince = time; // in the case that physics are overridden
+       float idlesince = CS(this).parm_idlesince;
+       CS(this).parm_idlesince = time; // in the case that physics are overridden
        if (PM_check_specialcommand(this, buttons)) { return true; }
        if (this.PlayerPhysplug && this.PlayerPhysplug(this, dt)) { return true; }
-       this.parm_idlesince = idlesince;
+       CS(this).parm_idlesince = idlesince;
        return false;
 }
 
@@ -26,7 +26,7 @@ void sys_phys_monitor(entity this, float dt)
        if (sv_maxidle > 0) {
                if (buttons != this.buttons_old
                    || this.movement != this.movement_old
-                   || this.v_angle != this.v_angle_old) { this.parm_idlesince = time; }
+                   || this.v_angle != this.v_angle_old) { CS(this).parm_idlesince = time; }
        }
        PM_check_nickspam(this);
        PM_check_punch(this, dt);
index 3d83a99d2f7bd94991553560dbee7375f7abe58e..bbfe2eacdf4578eddfd0c200bda209b6487e99db 100644 (file)
@@ -821,7 +821,7 @@ SetChangeParms
 void SetChangeParms (entity this)
 {
        // save parms for level change
-       parm1 = this.parm_idlesince - time;
+       parm1 = CS(this).parm_idlesince - time;
 
        MUTATOR_CALLHOOK(SetChangeParms);
 }
@@ -834,12 +834,12 @@ DecodeLevelParms
 void DecodeLevelParms(entity this)
 {
        // load parms
-       this.parm_idlesince = parm1;
-       if (this.parm_idlesince == -(86400 * 366))
-               this.parm_idlesince = time;
+       CS(this).parm_idlesince = parm1;
+       if (CS(this).parm_idlesince == -(86400 * 366))
+               CS(this).parm_idlesince = time;
 
        // whatever happens, allow 60 seconds of idling directly after connect for map loading
-       this.parm_idlesince = max(this.parm_idlesince, time - sv_maxidle + 60);
+       CS(this).parm_idlesince = max(CS(this).parm_idlesince, time - sv_maxidle + 60);
 
        MUTATOR_CALLHOOK(DecodeLevelParms);
 }
@@ -2672,7 +2672,7 @@ void PlayerPostThink (entity this)
 
                if (sv_maxidle_slots > 0 && (maxclients - totalClients) > sv_maxidle_slots)
                { /* do nothing */ }
-               else if (time - this.parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
+               else if (time - CS(this).parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
                {
                        if (this.idlekick_lasttimeleft)
                        {
@@ -2682,7 +2682,7 @@ void PlayerPostThink (entity this)
                }
                else
                {
-                       float timeleft = ceil(sv_maxidle - (time - this.parm_idlesince));
+                       float timeleft = ceil(sv_maxidle - (time - CS(this).parm_idlesince));
                        if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
                                if (!this.idlekick_lasttimeleft)
                                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
index 37e5eeb94d59bf8f8b7d05b184cb9de84298af15..c63d26190489ed084b4cd1397f5f7649c42b18ac 100644 (file)
@@ -33,6 +33,8 @@ CLASS(Client, Object)
 
     ATTRIB(Client, playerid, int, this.playerid);
 
+    ATTRIB(Client, parm_idlesince, int, this.parm_idlesince);
+
     METHOD(Client, m_unwind, bool(Client this));
 
     STATIC_METHOD(Client, Add, void(Client this, int _team));
index a6ca911bdc64fe4d5cbe29ae4d8bb149348b349e..7a155fddd9d69e732f38040d2a71af86617986e2 100644 (file)
@@ -232,7 +232,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
 
 float lockteams;
 
-.float parm_idlesince;
 float sv_maxidle;
 float sv_maxidle_spectatorsareidle;
 int sv_maxidle_slots;