From 0117ae7d3a9112024ff83615b16ba1df2d719521 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 7 Mar 2017 03:18:09 +0100 Subject: [PATCH] Use -1 instead of an insanely high timeout --- qcsrc/server/bot/default/navigation.qc | 7 ++++--- qcsrc/server/bot/default/waypoints.qc | 2 +- qcsrc/server/race.qc | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 857d6222f8..24cc29bdcc 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -20,7 +20,7 @@ void navigation_dynamicgoal_init(entity this, bool initially_static) this.navigation_dynamicgoal = true; this.bot_basewaypoint = this.nearestwaypoint; if(initially_static) - this.nearestwaypointtimeout = time + 1000000000; + this.nearestwaypointtimeout = -1; else this.nearestwaypointtimeout = time; } @@ -34,7 +34,7 @@ void navigation_dynamicgoal_unset(entity this) { if(this.bot_basewaypoint) this.nearestwaypoint = this.bot_basewaypoint; - this.nearestwaypointtimeout = time + 1000000000; + this.nearestwaypointtimeout = -1; } // rough simulation of walking from one point to another to test if a path @@ -821,7 +821,8 @@ void navigation_routerating(entity this, entity e, float f, float rangebias) } else { - if ((!e.nearestwaypoint || e.navigation_dynamicgoal) && time > e.nearestwaypointtimeout) + if ((!e.nearestwaypoint || e.navigation_dynamicgoal) + && e.nearestwaypointtimeout >= 0 && time > e.nearestwaypointtimeout) { nwp = navigation_findnearestwaypoint(e, true); if(nwp) diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index bd920149b9..e88967e8ba 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -739,7 +739,7 @@ void waypoint_spawnforteleporter_boxes(entity e, vector org1, vector org2, vecto // the teleporter's nearest spawnfunc_waypoint is this one // (teleporters are not goals, so this is probably useless) e.nearestwaypoint = w; - e.nearestwaypointtimeout = time + 1000000000; + e.nearestwaypointtimeout = -1; } void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken) diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index d171dc6e03..3701c80152 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -926,7 +926,7 @@ spawnfunc(trigger_race_checkpoint) o = (this.absmin + this.absmax) * 0.5; tracebox(o, PL_MIN_CONST, PL_MAX_CONST, o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this); waypoint_spawnforitem_force(this, trace_endpos); - this.nearestwaypointtimeout = time + 1000000000; + this.nearestwaypointtimeout = -1; if(this.message == "") this.message = "went backwards"; @@ -985,7 +985,7 @@ spawnfunc(target_checkpoint) // defrag entity org = (this.absmin + this.absmax) * 0.5; tracebox(org, PL_MIN_CONST, PL_MAX_CONST, org - '0 0 1' * (org.z - this.absmin.z), MOVE_NORMAL, this); waypoint_spawnforitem_force(this, trace_endpos); - this.nearestwaypointtimeout = time + 1000000000; + this.nearestwaypointtimeout = -1; } if(this.message == "") -- 2.39.2