From: terencehill <piuntn@gmail.com>
Date: Tue, 19 Jul 2016 12:40:22 +0000 (+0200)
Subject: Clean up STAT usage: this.camera_spectator --> STAT(CAMERA_SPECTATOR, this), remove... 
X-Git-Tag: xonotic-v0.8.2~700^2~31^2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=29d0eb9c0ef79d820a07dd7a8fd6cfcdb7e9d1df;p=xonotic%2Fxonotic-data.pk3dir.git

Clean up STAT usage: this.camera_spectator --> STAT(CAMERA_SPECTATOR, this), remove camera_spectator_stat field
---

diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh
index 4432929a19..1e55ad009b 100644
--- a/qcsrc/common/stats.qh
+++ b/qcsrc/common/stats.qh
@@ -246,8 +246,7 @@ REGISTER_STAT(DOM_PPS_PINK, float)
 REGISTER_STAT(TELEPORT_MAXSPEED, float, autocvar_g_teleport_maxspeed)
 REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int, autocvar_g_telefrags_avoid)
 
-.int camera_spectator;
-REGISTER_STAT(CAMERA_SPECTATOR, int, this.camera_spectator)
+REGISTER_STAT(CAMERA_SPECTATOR, int)
 
 REGISTER_STAT(SPECTATORSPEED, float)
 
diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc
index 2d81f5962d..942bc4699d 100644
--- a/qcsrc/server/cl_client.qc
+++ b/qcsrc/server/cl_client.qc
@@ -1615,7 +1615,7 @@ void SpectateCopy(entity this, entity spectatee)
 	this.angles = spectatee.v_angle;
 	STAT(FROZEN, this) = STAT(FROZEN, spectatee);
 	this.revive_progress = spectatee.revive_progress;
-	if(!PHYS_INPUT_BUTTON_USE(this) && this.camera_spectator != 2)
+	if(!PHYS_INPUT_BUTTON_USE(this) && STAT(CAMERA_SPECTATOR, this) != 2)
 		this.fixangle = true;
 	setorigin(this, spectatee.origin);
 	setsize(this, spectatee.mins, spectatee.maxs);
@@ -1962,7 +1962,7 @@ void SpectatorThink(entity this)
 
 		if (this.impulse == IMP_weapon_drop.impulse)
 		{
-			this.camera_spectator = (this.camera_spectator + 1) % 3;
+			STAT(CAMERA_SPECTATOR, this) = (STAT(CAMERA_SPECTATOR, this) + 1) % 3;
 			this.impulse = 0;
 			return;
 		}
@@ -2074,7 +2074,6 @@ Called every frame for each client before the physics are run
 .float usekeypressed;
 .float last_vehiclecheck;
 .int items_added;
-.float camera_spectator_stat = _STAT(CAMERA_SPECTATOR);
 void PlayerPreThink (entity this)
 {
 	WarpZone_PlayerPhysics_FixVAngle(this);
@@ -2402,8 +2401,6 @@ void PlayerPreThink (entity this)
 	// if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring
 	if (PS(this).m_weapon == WEP_Null)
 		this.clip_load = this.clip_size = 0;
-
-	this.camera_spectator_stat = this.camera_spectator;
 }
 
 void DrownPlayer(entity this)