summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-02-15 12:53:42 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-02-15 12:53:42 +0100
commit043efaf082a8ce5010e6ff974afea05d8d66e9d1 (patch)
tree40115f81c6a4b4756743a36485eacd4b7a5607b9 /src/peds
parentMerge branch 'master' of https://github.com/Nick007J/re3 (diff)
downloadre3-043efaf082a8ce5010e6ff974afea05d8d66e9d1.tar
re3-043efaf082a8ce5010e6ff974afea05d8d66e9d1.tar.gz
re3-043efaf082a8ce5010e6ff974afea05d8d66e9d1.tar.bz2
re3-043efaf082a8ce5010e6ff974afea05d8d66e9d1.tar.lz
re3-043efaf082a8ce5010e6ff974afea05d8d66e9d1.tar.xz
re3-043efaf082a8ce5010e6ff974afea05d8d66e9d1.tar.zst
re3-043efaf082a8ce5010e6ff974afea05d8d66e9d1.zip
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/PedRoutes.cpp25
-rw-r--r--src/peds/PedRoutes.h1
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