]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/vehicle/spiderbot.qc
Optimize a spiderbot rocket loop
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicle / spiderbot.qc
index d41e81ce6154c0d3bc5c57bfc8b877d891e47d0f..8015b3102729534d836ce32fc4d111e59f6ea8c1 100644 (file)
@@ -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;