if (this.goalcurrent == this.goalentity && this.goalentity_lock_timeout > time)
locked_goal = true;
- navigation_shortenpath(this);
+ if (navigation_shortenpath(this))
+ {
+ if (vdist(this.origin - this.goalcurrent_prev.origin, <, 50)
+ && navigation_goalrating_timeout_can_be_anticipated(this))
+ navigation_goalrating_timeout_force(this);
+ }
bool goalcurrent_can_be_removed = false;
if (IS_MOVABLE(this.goalcurrent))
}
// shorten path by removing intermediate goals
-void navigation_shortenpath(entity this)
+bool navigation_shortenpath(entity this)
{
if (!this.goalstack01 || wasfreed(this.goalstack01))
- return;
+ return false;
if (this.bot_tracewalk_time > time)
- return;
+ return false;
this.bot_tracewalk_time = max(time, this.bot_tracewalk_time) + 0.25;
bool cut_allowed = false;
navigation_poproute(this);
}
while (this.goalcurrent != next);
+ return true;
}
- return;
+ return false;
}
}
{
LOG_DEBUG("path optimized for ", this.netname, ", removed a goal from the queue");
navigation_poproute(this);
+ return true;
}
}
+ return false;
}
// removes any currently touching waypoints from the goal stack
void navigation_markroutes(entity this, entity fixed_source_waypoint);
void navigation_markroutes_inverted(entity fixed_source_waypoint);
void navigation_routerating(entity this, entity e, float f, float rangebias);
-void navigation_shortenpath(entity this);
+bool navigation_shortenpath(entity this);
int navigation_poptouchedgoals(entity this);
void navigation_goalrating_start(entity this);
void navigation_goalrating_end(entity this);