2012-09-23 22:11:08 +04:00
|
|
|
#ifndef OPENMW_ESM_PGRD_H
|
|
|
|
#define OPENMW_ESM_PGRD_H
|
2010-02-25 14:03:03 +01:00
|
|
|
|
2012-09-17 11:37:50 +04:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2011-04-08 17:58:21 +04:00
|
|
|
namespace ESM
|
|
|
|
{
|
2010-02-25 14:03:03 +01:00
|
|
|
|
2012-10-01 00:51:54 +04:00
|
|
|
class ESMReader;
|
|
|
|
class ESMWriter;
|
|
|
|
|
2010-02-25 14:03:03 +01:00
|
|
|
/*
|
|
|
|
* Path grid.
|
|
|
|
*/
|
2012-09-30 23:34:53 +04:00
|
|
|
struct Pathgrid
|
2010-02-25 14:03:03 +01:00
|
|
|
{
|
2013-09-24 13:17:28 +02:00
|
|
|
static unsigned int sRecordId;
|
2015-06-14 02:31:00 +02:00
|
|
|
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
|
|
|
static std::string getRecordType() { return "Pathgrid"; }
|
2013-09-24 13:17:28 +02:00
|
|
|
|
2011-04-08 17:58:21 +04:00
|
|
|
struct DATAstruct
|
|
|
|
{
|
2012-09-17 11:37:50 +04:00
|
|
|
int mX, mY; // Grid location, matches cell for exterior cells
|
|
|
|
short mS1; // ?? Usually but not always a power of 2. Doesn't seem
|
2011-04-08 17:58:21 +04:00
|
|
|
// to have any relation to the size of PGRC.
|
2012-09-17 11:37:50 +04:00
|
|
|
short mS2; // Number of path points.
|
2011-04-08 17:58:21 +04:00
|
|
|
}; // 12 bytes
|
2010-02-25 14:03:03 +01:00
|
|
|
|
2012-03-02 19:50:04 +04:00
|
|
|
struct Point // path grid point
|
|
|
|
{
|
2012-09-17 11:37:50 +04:00
|
|
|
int mX, mY, mZ; // Location of point
|
|
|
|
unsigned char mAutogenerated; // autogenerated vs. user coloring flag?
|
|
|
|
unsigned char mConnectionNum; // number of connections for this point
|
|
|
|
short mUnknown;
|
2014-05-13 13:25:22 -04:00
|
|
|
Point& operator=(const float[3]);
|
|
|
|
Point(const float[3]);
|
2014-05-12 21:05:32 -04:00
|
|
|
Point();
|
2018-06-25 09:35:42 +04:00
|
|
|
Point(int x, int y, int z)
|
|
|
|
: mX(x), mY(y), mZ(z)
|
|
|
|
, mAutogenerated(0), mConnectionNum(0), mUnknown(0)
|
|
|
|
{}
|
2012-03-02 19:50:04 +04:00
|
|
|
}; // 16 bytes
|
|
|
|
|
|
|
|
struct Edge // path grid edge
|
|
|
|
{
|
2012-09-17 11:37:50 +04:00
|
|
|
int mV0, mV1; // index of points connected with this edge
|
2012-03-02 19:50:04 +04:00
|
|
|
}; // 8 bytes
|
|
|
|
|
2012-09-17 11:37:50 +04:00
|
|
|
std::string mCell; // Cell name
|
|
|
|
DATAstruct mData;
|
2012-03-02 19:50:04 +04:00
|
|
|
|
2012-03-10 13:37:35 +04:00
|
|
|
typedef std::vector<Point> PointList;
|
2012-09-17 11:37:50 +04:00
|
|
|
PointList mPoints;
|
2012-03-09 23:35:20 +04:00
|
|
|
|
2012-03-10 13:37:35 +04:00
|
|
|
typedef std::vector<Edge> EdgeList;
|
2012-09-17 11:37:50 +04:00
|
|
|
EdgeList mEdges;
|
2012-03-02 19:50:04 +04:00
|
|
|
|
2015-07-20 17:23:14 +03:00
|
|
|
void load(ESMReader &esm, bool &isDeleted);
|
|
|
|
void save(ESMWriter &esm, bool isDeleted = false) const;
|
2014-10-02 12:30:15 +02:00
|
|
|
|
|
|
|
void blank();
|
2010-02-25 14:03:03 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|