r4406 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Sep 8 01:31:11 EDT 2008


Author: div0
Date: 2008-09-08 01:31:10 -0400 (Mon, 08 Sep 2008)
New Revision: 4406

Modified:
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/portals.qc
Log:
no idea about these portal crashes... added debug code


Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2008-09-07 23:45:04 UTC (rev 4405)
+++ trunk/data/qcsrc/server/g_damage.qc	2008-09-08 05:31:10 UTC (rev 4406)
@@ -563,7 +563,10 @@
 				(deathtype == DEATH_DROWN) ||
 				(deathtype == DEATH_SLIME) ||
 				(deathtype == DEATH_LAVA))
+			{
+				self = oldself;
 				return;
+			}
 			if (targ.armorvalue && (deathtype == WEP_MINSTANEX) && damage)
 			{
 				targ.armorvalue -= 1;

Modified: trunk/data/qcsrc/server/portals.qc
===================================================================
--- trunk/data/qcsrc/server/portals.qc	2008-09-07 23:45:04 UTC (rev 4405)
+++ trunk/data/qcsrc/server/portals.qc	2008-09-08 05:31:10 UTC (rev 4406)
@@ -1,3 +1,5 @@
+float portals_must_not_break; // debug code
+
 .vector portal_transform;
 .vector portal_safe_origin;
 .float portal_wants_to_vanish;
@@ -83,6 +85,11 @@
 	vector new_yawforward;
 	vector old_yawforward;
 	float planeshift, s, t;
+
+	if(!portals_must_not_break)
+		error("Portal_TeleportPlayer called for unprotected portals");
+	print("Portalling using ", etos(teleporter), " to ", etos(teleporter.enemy), "\n");
+
 	from = teleporter.origin;
 	transform = teleporter.portal_transform;
 
@@ -193,6 +200,9 @@
 	TeleportPlayer(teleporter, player, to, ang, newvel, teleporter.enemy.absmin, teleporter.enemy.absmax);
 
 	// reset fade counter
+	if(!portals_must_not_break)
+		error("Portal_TeleportPlayer ended with unprotected portals");
+	print("Portalled using ", etos(teleporter), " to ", etos(teleporter.enemy), "\n");
 	teleporter.portal_wants_to_vanish = 0;
 	teleporter.fade_time = time + 15;
 	teleporter.enemy.health = 300;
@@ -227,18 +237,12 @@
 		return; // possibly engine bug
 	
 	if(!self.enemy)
-	{
 		error("Portal_Touch called for a broken portal\n");
-	}
 
 	if(trace_fraction < 1)
 		return; // only handle TouchAreaGrid ones (only these can teleport)
 		// for some unknown reason, this also gets collisions from SV_Impact sometimes
-	if(!self.enemy)
-	{
-		objerror("Portal_Touch called for [unconnected] portal\n");
-		return;
-	}
+
 	if(other.classname == "porto")
 	{
 		if(other.portal_id == self.portal_id)
@@ -268,15 +272,23 @@
 		return;
 	}
 
+	print("Portal ID ", etos(self), " verified working.\n");
+	portals_must_not_break = 1;
+
 	if(Portal_TeleportPlayer(self, other))
 		if(other.classname == "porto")
 			if(other.effects & EF_RED)
 				other.effects += EF_BLUE - EF_RED;
+
+	portals_must_not_break = 0;
 }
 
 void Portal_Think();
 void Portal_MakeBrokenPortal(entity portal)
 {
+	if(portals_must_not_break)
+		error("Trying to remove a portal during teleporting");
+
 	portal.solid = SOLID_NOT;
 	portal.touch = SUB_Null;
 	portal.think = SUB_Null;
@@ -374,6 +386,9 @@
 	entity e;
 	e = portal.enemy;
 
+	if(portals_must_not_break)
+		error("Trying to remove a portal during teleporting");
+
 	if(e)
 	{
 		Portal_Disconnect(portal, e);
@@ -409,9 +424,7 @@
 			return;
 	self.health -= damage;
 	if(self.health < 0)
-	{
 		Portal_Remove(self, 1);
-	}
 }
 
 void Portal_Think()
@@ -423,10 +436,11 @@
 		return; // possibly engine bug
 
 	if(!self.enemy)
-	{
 		error("Portal_Think called for a broken portal\n");
-	}
 
+	print("Portal ID ", etos(self), " verified working.\n");
+	portals_must_not_break = 1;
+
 	o = self.owner;
 	self.solid = SOLID_BBOX;
 	self.owner = world;
@@ -447,6 +461,8 @@
 	self.solid = SOLID_TRIGGER;
 	self.owner = o;
 
+	portals_must_not_break = 0;
+
 	self.nextthink = time;
 
 	if(time > self.fade_time)




More information about the nexuiz-commits mailing list