diff options
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/PedRoutes.cpp | 25 | ||||
-rw-r--r-- | src/peds/PedRoutes.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/peds/PedRoutes.cpp b/src/peds/PedRoutes.cpp index c2ec51e2..9b7dafd4 100644 --- a/src/peds/PedRoutes.cpp +++ b/src/peds/PedRoutes.cpp @@ -43,3 +43,28 @@ CRouteNode::AddRoutePoint(int16 route, CVector pos) gaRoutes[point].m_route = route; gaRoutes[point].m_pos = pos; } + +void +CRouteNode::RemoveRoute(int16 route) +{ + uint16 first_point, last_point, i; + for (first_point = 0; first_point < NUMPEDROUTES; first_point++) { + if (gaRoutes[first_point].m_route == route) + break; + } + if (first_point == NUMPEDROUTES) + return; + for (last_point = first_point; last_point < NUMPEDROUTES; last_point++) + if (gaRoutes[last_point].m_route != route) + break; + uint16 diff = last_point - first_point; +#ifdef FIX_BUGS + for (i = first_point; i < NUMPEDROUTES - diff; i++) + gaRoutes[i] = gaRoutes[i + diff]; +#else + for (i = 0; i < diff; i++) + gaRoutes[first_point + i] = gaRoutes[last_point + i]; +#endif + for (i = NUMPEDROUTES - diff; i < NUMPEDROUTES; i++) + gaRoutes[i].m_route = -1; +} diff --git a/src/peds/PedRoutes.h b/src/peds/PedRoutes.h index ff4e6c89..d313938a 100644 --- a/src/peds/PedRoutes.h +++ b/src/peds/PedRoutes.h @@ -10,4 +10,5 @@ public: static CVector GetPointPosition(int16); static int16 GetRouteStart(int16); static void AddRoutePoint(int16, CVector); + static void RemoveRoute(int16); };
\ No newline at end of file |