From 5bdbe2cc476568c3809293e1e306e7fcc99734cd Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Thu, 11 Jan 2024 15:56:41 -0800 Subject: [PATCH] NSNavAI: Add method RouteToPositionDenyFlags(). Same as RouteToPosition() but will accept a link-flag filter mask. --- src/shared/NSNavAI.h | 2 ++ src/shared/NSNavAI.qc | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/shared/NSNavAI.h b/src/shared/NSNavAI.h index 3954bfcd..787b3ff8 100644 --- a/src/shared/NSNavAI.h +++ b/src/shared/NSNavAI.h @@ -77,6 +77,8 @@ public: virtual void CheckRoute(void); /** When called, will plot a route to a given world coordinate and start moving. */ virtual void RouteToPosition(vector); + /** When called, will plot a route to a given world coordinate and start moving, ignoring any links that contain the given link flags. */ + virtual void RouteToPositionDenyFlags(vector, int); /** When called, will start following a path_corner */ virtual void ChasePath(string startPath); /** Internal use only. Called every frame to see our route progression. */ diff --git a/src/shared/NSNavAI.qc b/src/shared/NSNavAI.qc index 5b0e6727..72d747ee 100644 --- a/src/shared/NSNavAI.qc +++ b/src/shared/NSNavAI.qc @@ -284,6 +284,12 @@ NSNavAI::GetRouteDirection(void) void NSNavAI::RouteToPosition(vector destination) +{ + RouteToPositionDenyFlags(destination, 0i); +} + +void +NSNavAI::RouteToPositionDenyFlags(vector destination, int denylinkflags) { /* engine calls this upon successfully creating a route */ static void RouteToPosition_RouteCB(entity ent, vector dest, int numnodes, nodeslist_t *nodelist) @@ -332,7 +338,7 @@ NSNavAI::RouteToPosition(vector destination) RouteClear(); if (!m_iNodes) { - route_calculate(this, destination, 0, RouteToPosition_RouteCB); + route_calculate(this, destination, denylinkflags, RouteToPosition_RouteCB); m_vecLastNode = destination; } }