summaryrefslogtreecommitdiffstats
path: root/src/control/PathFind.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/PathFind.h')
-rw-r--r--src/control/PathFind.h69
1 files changed, 30 insertions, 39 deletions
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index 64c12d5b..bbfdf7b7 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -41,7 +41,8 @@ struct CPedPathNode
CPedPathNode* prev;
CPedPathNode* next;
};
-static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error");
+
+VALIDATE_SIZE(CPedPathNode, 0x10);
class CPedPath {
public:
@@ -69,31 +70,17 @@ struct CPathNode
uint8 bBetweenLevels : 1;
int8 group;
-/* For reference VC:
- int16 prevIndex;
- int16 nextIndex;
- int16 x;
- int16 y;
- int16 z;
- int16 distance;
- int16 firstLink;
- int8 width;
- int8 group;
- int8 numLinks : 4;
- int8 bDeadEnd : 1;
- int8 bTurnedOff : 1; // flag 8 in node info
- int8 flagA40 : 1; // flag 20 in node info
- int8 flagA80 : 1; // flag 4 in node info
- int8 flagB1 : 1; // flag 10 in node info
- int8 flagB2 : 1; // flag 2 in node info
- int8 flagB4 : 1;
- int8 speedLimit : 2; // speed limit
- int8 flagB20 : 1;
- int8 flagB40 : 1;
- int8 flagB80 : 1;
- int8 spawnRate : 4;
- int8 flagsC : 4;
-*/
+
+ CVector &GetPosition(void) { return pos; }
+ void SetPosition(const CVector &p) { pos = p; }
+ float GetX(void) { return pos.x; }
+ float GetY(void) { return pos.y; }
+ float GetZ(void) { return pos.z; }
+
+ CPathNode *GetPrev(void) { return prev; }
+ CPathNode *GetNext(void) { return next; }
+ void SetPrev(CPathNode *node) { prev = node; }
+ void SetNext(CPathNode *node) { next = node; }
};
union CConnectionFlags
@@ -112,11 +99,18 @@ struct CCarPathLink
int16 pathNodeIndex;
int8 numLeftLanes;
int8 numRightLanes;
- int8 trafficLightType;
+ uint8 trafficLightType;
uint8 bBridgeLights : 1;
// more?
+ CVector2D &GetPosition(void) { return pos; }
+ CVector2D &GetDirection(void) { return dir; }
+ float GetX(void) { return pos.x; }
+ float GetY(void) { return pos.y; }
+ float GetDirX(void) { return dir.x; }
+ float GetDirY(void) { return dir.y; }
+
float OneWayLaneOffset()
{
if (numLeftLanes == 0)
@@ -127,6 +121,7 @@ struct CCarPathLink
}
};
+// This is what we're reading from the files, only temporary
struct CPathInfoForObject
{
int16 x;
@@ -161,16 +156,6 @@ struct CTempDetachedNode // unused
class CPathFind
{
public:
-/* For reference VC:
- CPathNode pathNodes[9650];
- CCarPathLink m_carPathLinks[3500];
- CBuilding *m_mapObjects[1250];
- // 0x8000 is cross road flag
- // 0x4000 is traffic light flag
- uint16 m_connections[20400];
- uint8 m_distances[20400];
- int16 m_carPathConnections[20400];
-*/
CPathNode m_pathNodes[NUM_PATHNODES];
CCarPathLink m_carPathLinks[NUM_CARPATHLINKS];
CTreadable *m_mapObjects[NUM_MAPOBJECTS];
@@ -179,6 +164,7 @@ public:
int16 m_distances[NUM_PATHCONNECTIONS];
CConnectionFlags m_connectionFlags[NUM_PATHCONNECTIONS];
int16 m_carPathConnections[NUM_PATHCONNECTIONS];
+
int32 m_numPathNodes;
int32 m_numCarPathNodes;
int32 m_numPedPathNodes;
@@ -199,7 +185,7 @@ public:
void PreparePathData(void);
void CountFloodFillGroups(uint8 type);
void PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo,
- float unk, CTempDetachedNode *detachednodes, int unused);
+ float maxdist, CTempDetachedNode *detachednodes, int32 numDetached);
bool IsPathObject(int id) { return id < PATHNODESIZE && (InfoForTileCars[id*12].type != 0 || InfoForTilePeds[id*12].type != 0); }
@@ -229,10 +215,15 @@ public:
bool TestCoorsCloseness(CVector target, uint8 type, CVector start);
void Save(uint8 *buf, uint32 *size);
void Load(uint8 *buf, uint32 size);
+ uint16 ConnectedNode(int id) { return m_connections[id]; }
+ bool ConnectionCrossesRoad(int id) { return m_connectionFlags[id].bCrossesRoad; }
+ bool ConnectionHasTrafficLight(int id) { return m_connectionFlags[id].bTrafficLight; }
+ void ConnectionSetTrafficLight(int id) { m_connectionFlags[id].bTrafficLight = true; }
void DisplayPathData(void);
};
-static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
+
+VALIDATE_SIZE(CPathFind, 0x49bf4);
extern CPathFind ThePaths;