]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move killindicator_teamchange out of clientstate (potentially called before clientsta...
authorMario <mario@smbclan.net>
Sat, 25 Nov 2017 00:21:17 +0000 (10:21 +1000)
committerMario <mario@smbclan.net>
Sat, 25 Nov 2017 00:21:17 +0000 (10:21 +1000)
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/defs.qh
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/player.qc

index 4f7dd14a54da6040d8bc1c93965c515b8a37d049..d7b9a7ae0e7d6305ef86a5994b2b3e09f2edef80 100644 (file)
@@ -873,19 +873,19 @@ Called when a client types 'kill' in the console
 .float clientkill_nexttime;
 void ClientKill_Now_TeamChange(entity this)
 {
-       if(CS(this).killindicator_teamchange == -1)
+       if(this.killindicator_teamchange == -1)
        {
                JoinBestTeam( this, false, true );
        }
-       else if(CS(this).killindicator_teamchange == -2)
+       else if(this.killindicator_teamchange == -2)
        {
                if(blockSpectators)
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
                PutObserverInServer(this);
        }
        else
-               SV_ChangeTeam(this, CS(this).killindicator_teamchange - 1);
-       CS(this).killindicator_teamchange = 0;
+               SV_ChangeTeam(this, this.killindicator_teamchange - 1);
+       this.killindicator_teamchange = 0;
 }
 
 void ClientKill_Now(entity this)
@@ -893,7 +893,7 @@ void ClientKill_Now(entity this)
        if(this.vehicle)
        {
            vehicles_exit(this.vehicle, VHEF_RELEASE);
-           if(!CS(this).killindicator_teamchange)
+           if(!this.killindicator_teamchange)
            {
             this.vehicle_health = -1;
             Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0');
@@ -905,7 +905,7 @@ void ClientKill_Now(entity this)
 
        this.killindicator = NULL;
 
-       if(CS(this).killindicator_teamchange)
+       if(this.killindicator_teamchange)
                ClientKill_Now_TeamChange(this);
 
        if (!IS_SPEC(this) && !IS_OBSERVER(this) && MUTATOR_CALLHOOK(ClientKill_Now, this) == false)
@@ -970,7 +970,7 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change,
        return;
     killtime = M_ARGV(1, float);
 
-       CS(this).killindicator_teamchange = targetteam;
+       this.killindicator_teamchange = targetteam;
 
     if(!this.killindicator)
        {
index 2282c09cbb1cafd54e3a667886430b98b554c342..af81535a7a231bbd66f34bc0612d40caaf567999 100644 (file)
@@ -73,7 +73,6 @@ CLASS(Client, Object)
 
     ATTRIB(Client, parm_idlesince, int, this.parm_idlesince);
     ATTRIB(Client, muted, bool, this.muted);
-    ATTRIB(Client, killindicator_teamchange, int, this.killindicator_teamchange);
     ATTRIB(Client, idlekick_lasttimeleft, float, this.idlekick_lasttimeleft);
     ATTRIB(Client, pm_frametime, float, this.pm_frametime);
     ATTRIB(Client, pressedkeys, int, this.pressedkeys);
index 4c3b1d221ea4ae73be7f0ff7cc7b7ed5d7b9000f..89582bb7a009f81e4e183604ebdd103894c610b8 100644 (file)
@@ -376,6 +376,8 @@ const float ACTIVE_TOGGLE   = 3;
 
 .float stat_respawn_time = _STAT(RESPAWN_TIME); // shows respawn time, and is negative when awaiting respawn
 
+.int killindicator_teamchange;
+
 void PlayerUseKey(entity this);
 
 USING(spawn_evalfunc_t, vector(entity this, entity player, entity spot, vector current));
index 73d3825e53bdc42a2f2c3a8d7dacc3987e8e68a5..919df49013dd5f53cc1c5c2f819cf11c2ee38d41 100644 (file)
@@ -293,7 +293,7 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
 
        if (!IS_DEAD(player))
                ca_LastPlayerForTeam_Notify(player);
-       if (CS(player).killindicator_teamchange == -2) // player wants to spectate
+       if (player.killindicator_teamchange == -2) // player wants to spectate
                player.caplayer = 0;
        if (player.caplayer)
                player.frags = FRAGS_LMS_LOSER;
index fc88b69bb9955d8cd2c9cbb820bac9c068c4c964..26fc9e659204d7bf6305a5d2483bf1b2b4ba9819 100644 (file)
@@ -538,7 +538,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                {
                        delete(this.killindicator);
                        this.killindicator = NULL;
-                       if(CS(this).killindicator_teamchange)
+                       if(this.killindicator_teamchange)
                                defer_ClientKill_Now_TeamChange = true;
 
                        if(this.classname == "body")