]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Small optimisation in WarpZone_Touch()
authorbones_was_here <bones_was_here@xonotic.au>
Sun, 13 Aug 2023 11:41:15 +0000 (21:41 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sun, 13 Aug 2023 11:41:15 +0000 (21:41 +1000)
Cheap early-out checks should be performed before expensive checks to
avoid wasting CPU.

qcsrc/lib/warpzone/server.qc

index d444ee6e8ee73e737bef409904a8fc33050ba4af..f216aa9c64bd64dd180f9d91a2de54db8b20625a 100644 (file)
@@ -193,11 +193,11 @@ void WarpZone_Touch(entity this, entity toucher)
        if(toucher.move_movetype == MOVETYPE_NONE || toucher.move_movetype == MOVETYPE_FOLLOW || toucher.tag_entity)
                return;
 
-       EXACTTRIGGER_TOUCH(this, toucher);
-
        if(WarpZone_PlaneDist(this, toucher.origin + toucher.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
                return;
 
+       EXACTTRIGGER_TOUCH(this, toucher);
+
        float f;
        // number of frames we need to go back:
        //   dist = 16*sqrt(2) qu