From: Mario <mario@smbclan.net>
Date: Sun, 19 Jun 2016 00:17:42 +0000 (+1000)
Subject: Optimize a spiderbot rocket loop
X-Git-Tag: xonotic-v0.8.2~786
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b8dea2df7d3495a80c733043b136b28cd12cab79;p=xonotic%2Fxonotic-data.pk3dir.git

Optimize a spiderbot rocket loop
---

diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc
index d41e81ce61..8015b31027 100644
--- a/qcsrc/common/vehicles/vehicle/spiderbot.qc
+++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc
@@ -337,19 +337,14 @@ bool spiderbot_frame(entity this)
 
 void spiderbot_exit(entity this, int eject)
 {
-	entity e;
 	vector spot;
 
-	e = findchain(classname,"spiderbot_rocket");
-	while(e)
+	FOREACH_ENTITY_ENT(owner, this.owner,
 	{
-		if(e.owner == this.owner)
-		{
-			e.realowner = this.owner;
-			e.owner = NULL;
-		}
-		e = e.chain;
-	}
+		if(it.classname != "spiderbot_rocket") continue;
+		it.realowner = this.owner;
+		it.owner = NULL;
+	});
 
 	setthink(this, vehicles_think);
 	this.nextthink = time;