r4675 - in branches/nexuiz-2.0: . data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Oct 8 12:11:56 EDT 2008


Author: div0
Date: 2008-10-08 12:11:56 -0400 (Wed, 08 Oct 2008)
New Revision: 4675

Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/data/qcsrc/server/builtins.qh
   branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
   branches/nexuiz-2.0/data/qcsrc/server/t_teleporters.qc
Log:
r4672 | div0 | 2008-10-08 17:57:36 +0200 (Wed, 08 Oct 2008) | 2 lines
it currently is not allowed to objerror() when an InitializeEntity function is set!
r4673 | div0 | 2008-10-08 18:00:18 +0200 (Wed, 08 Oct 2008) | 2 lines
same bug again
r4674 | div0 | 2008-10-08 18:11:22 +0200 (Wed, 08 Oct 2008) | 2 lines
make objerror safe for all entities again

Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2008-10-08 16:11:22 UTC (rev 4674)
+++ branches/nexuiz-2.0/.patchsets	2008-10-08 16:11:56 UTC (rev 4675)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-4670
+revisions_applied = 1-4674

Modified: branches/nexuiz-2.0/data/qcsrc/server/builtins.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/builtins.qh	2008-10-08 16:11:22 UTC (rev 4674)
+++ branches/nexuiz-2.0/data/qcsrc/server/builtins.qh	2008-10-08 16:11:56 UTC (rev 4675)
@@ -9,7 +9,7 @@
 //void(entity e, float chan, string samp, float vol, float atten) sound = #8;
 vector	normalize (vector v)								= #9;
 void	error (string e)								= #10;
-void	objerror (string e)								= #11;
+void	objerror_builtin (string e)								= #11; // do not call, use objerror wrapper
 float	vlen (vector v)									= #12;
 float	vectoyaw (vector v)								= #13;
 entity	spawn (void)									= #14;

Modified: branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc	2008-10-08 16:11:22 UTC (rev 4674)
+++ branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc	2008-10-08 16:11:56 UTC (rev 4675)
@@ -1,3 +1,5 @@
+void objerror(string s);
+
 void() spawnfunc_info_player_deathmatch; // needed for the other spawnpoints
 void() spawnpoint_use;
 string ColoredTeamName(float t);
@@ -1218,6 +1220,44 @@
 .float initialize_entity_order;
 .entity initialize_entity_next;
 entity initialize_entity_first;
+
+void make_safe_for_remove(entity e)
+{
+	if(e.initialize_entity)
+	{
+		entity ent, prev;
+		for(ent = initialize_entity_first; ent; )
+		{
+			if((ent == e) || ((ent.classname == "initialize_entity") && (ent.enemy == e)))
+			{
+				print("make_safe_for_remove: getting rid of initializer ", etos(ent), "\n");
+				// skip it in linked list
+				if(prev)
+				{
+					prev.initialize_entity_next = ent.initialize_entity_next;
+					ent = prev.initialize_entity_next;
+				}
+				else
+				{
+					initialize_entity_first = ent.initialize_entity_next;
+					ent = initialize_entity_first;
+				}
+			}
+			else
+			{
+				prev = ent;
+				ent = ent.initialize_entity_next;
+			}
+		}
+	}
+}
+
+void objerror(string s)
+{
+	make_safe_for_remove(self);
+	objerror_builtin(s);
+}
+
 void InitializeEntity(entity e, void(void) func, float order)
 {
 	entity prev, cur;

Modified: branches/nexuiz-2.0/data/qcsrc/server/t_teleporters.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/t_teleporters.qc	2008-10-08 16:11:22 UTC (rev 4674)
+++ branches/nexuiz-2.0/data/qcsrc/server/t_teleporters.qc	2008-10-08 16:11:56 UTC (rev 4675)
@@ -150,7 +150,6 @@
 	if (!self.enemy)
 	{
 		objerror ("Teleporter with nonexistant target");
-		remove(self);
 		return;
 	}
 
@@ -168,5 +167,8 @@
 	InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);
 
 	if (!self.target)
+	{
 		objerror ("Teleporter with no target");
+		return;
+	}
 }




More information about the nexuiz-commits mailing list