From b8dea2df7d3495a80c733043b136b28cd12cab79 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 19 Jun 2016 10:17:42 +1000 Subject: [PATCH] Optimize a spiderbot rocket loop --- qcsrc/common/vehicles/vehicle/spiderbot.qc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index d41e81ce6..8015b3102 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; -- 2.39.2