]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 857d6222f83a1387f8c449e8e8bca578937ff01b..24cc29bdccc7258ee4ce78f2777c29942b0bd826 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.navigation_dynamicgoal = true;
        this.bot_basewaypoint = this.nearestwaypoint;
        if(initially_static)
-               this.nearestwaypointtimeout = time + 1000000000;
+               this.nearestwaypointtimeout = -1;
        else
                this.nearestwaypointtimeout = time;
 }
        else
                this.nearestwaypointtimeout = time;
 }
@@ -34,7 +34,7 @@ void navigation_dynamicgoal_unset(entity this)
 {
        if(this.bot_basewaypoint)
                this.nearestwaypoint = this.bot_basewaypoint;
 {
        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
 }
 
 // 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
        {
        }
        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)
                {
                        nwp = navigation_findnearestwaypoint(e, true);
                        if(nwp)
index bd920149b9e8a72f1d1840c48a6632e8a44ee510..e88967e8baf4a436ce1c978dbf0a5eb82765d58f 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;
        // 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)
 }
 
 void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken)
index d171dc6e03b4ef25780addc3b543e087da3405ed..3701c801522024cf67311eec42c98ec0aef0508b 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);
        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";
 
        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);
                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 == "")
        }
 
        if(this.message == "")