2019-08-13 00:30:31 +02:00
|
|
|
#include "common.h"
|
2020-04-17 15:31:11 +02:00
|
|
|
|
2019-08-13 00:30:31 +02:00
|
|
|
#include "main.h"
|
|
|
|
#include "PedRoutes.h"
|
|
|
|
|
2020-10-09 11:02:21 +02:00
|
|
|
// --MIAMI: file done
|
|
|
|
|
2020-04-17 06:01:54 +02:00
|
|
|
CRouteNode gaRoutes[NUMPEDROUTES];
|
2019-10-06 23:39:25 +02:00
|
|
|
|
2020-03-22 15:23:40 +01:00
|
|
|
void
|
|
|
|
CRouteNode::Initialise()
|
|
|
|
{
|
|
|
|
for (int i = 0; i < NUMPEDROUTES; i++) {
|
|
|
|
gaRoutes[i].m_route = -1;
|
|
|
|
gaRoutes[i].m_pos = CVector(0.0f, 0.0f, 0.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-06 23:39:25 +02:00
|
|
|
int16
|
|
|
|
CRouteNode::GetRouteThisPointIsOn(int16 point)
|
|
|
|
{
|
|
|
|
return gaRoutes[point].m_route;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Actually GetFirstPointOfRoute
|
|
|
|
int16
|
|
|
|
CRouteNode::GetRouteStart(int16 route)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < NUMPEDROUTES; i++) {
|
|
|
|
if (route == gaRoutes[i].m_route)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
CVector
|
|
|
|
CRouteNode::GetPointPosition(int16 point)
|
|
|
|
{
|
|
|
|
return gaRoutes[point].m_pos;
|
2019-10-13 13:46:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CRouteNode::AddRoutePoint(int16 route, CVector pos)
|
|
|
|
{
|
|
|
|
uint16 point;
|
|
|
|
for (point = 0; point < NUMPEDROUTES; point++) {
|
|
|
|
if (gaRoutes[point].m_route == -1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
if (point == NUMPEDROUTES)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
gaRoutes[point].m_route = route;
|
|
|
|
gaRoutes[point].m_pos = pos;
|
|
|
|
}
|
2020-02-15 12:53:42 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|