From: bones_was_here Date: Sun, 13 Aug 2023 11:41:15 +0000 (+1000) Subject: Small optimisation in WarpZone_Touch() X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=414abe43bfc7d7f8ce54ecb0a39ce9b049113ca2;p=xonotic%2Fxonotic-data.pk3dir.git Small optimisation in WarpZone_Touch() Cheap early-out checks should be performed before expensive checks to avoid wasting CPU. --- diff --git a/qcsrc/lib/warpzone/server.qc b/qcsrc/lib/warpzone/server.qc index d444ee6e8..f216aa9c6 100644 --- a/qcsrc/lib/warpzone/server.qc +++ b/qcsrc/lib/warpzone/server.qc @@ -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