Use -1 instead of an insanely high timeout
authorterencehill <piuntn@gmail.com>
Tue, 7 Mar 2017 02:18:09 +0000 (03:18 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 7 Mar 2017 02:18:09 +0000 (03:18 +0100)
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/race.qc

index 857d622..24cc29b 100644 (file)
@@ -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)
index bd92014..e88967e 100644 (file)
@@ -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)
index d171dc6..3701c80 100644 (file)
@@ -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 == "")