From: Rudolf Polzer <divverent@xonotic.org>
Date: Sat, 14 May 2011 18:12:08 +0000 (+0200)
Subject: oh right, we HAVE destructors
X-Git-Tag: xonotic-v0.5.0~256^2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=852b9503db3046f5e42e1dafb771c371e4c47d19;p=xonotic%2Fxonotic-data.pk3dir.git

oh right, we HAVE destructors
---

diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc
index f03c2b33d..c2d0348c1 100644
--- a/qcsrc/client/Main.qc
+++ b/qcsrc/client/Main.qc
@@ -654,6 +654,10 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
 // --------------------------------------------------------------------------
 // BEGIN OPTIONAL CSQC FUNCTIONS
+void Ent_RemoveEntCS()
+{
+	entcs_receiver[self.sv_entnum] = world;
+}
 void Ent_ReadEntCS()
 {
 	InterpolateOrigin_Undo();
@@ -666,6 +670,7 @@ void Ent_ReadEntCS()
 	self.angles_y = ReadByte() * 360.0 / 256;
 	self.origin_z = self.angles_x = self.angles_z = 0;
 	entcs_receiver[self.sv_entnum] = self;
+	self.entremove = Ent_RemoveEntCS;
 
 	InterpolateOrigin_Note();
 }
diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc
index c3f7d6bda..d59c75ba8 100644
--- a/qcsrc/client/miscfunctions.qc
+++ b/qcsrc/client/miscfunctions.qc
@@ -766,9 +766,8 @@ vector getplayerorigin(float pl)
 		return stov(s);
 
 	e = entcs_receiver[pl];
-	if(e.classname == "entcs_receiver")
-		if(e.sv_entnum == pl)
-			return e.origin;
+	if(e)
+		return e.origin;
 
 	return GETPLAYERORIGIN_ERROR;
 }