You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw/components/esm3/loadpgrd.hpp

75 lines
2.0 KiB
C++

#ifndef OPENMW_ESM_PGRD_H
#define OPENMW_ESM_PGRD_H
#include <string>
#include <vector>
#include "components/esm/defs.hpp"
#include "components/esm/refid.hpp"
namespace ESM
{
class ESMReader;
class ESMWriter;
/*
* Path grid.
*/
struct Pathgrid
{
constexpr static RecNameInts sRecordId = REC_PGRD;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string_view getRecordType() { return "Pathgrid"; }
struct DATAstruct
{
int mX, mY; // Grid location, matches cell for exterior cells
short mS1; // ?? Usually but not always a power of 2. Doesn't seem
// to have any relation to the size of PGRC.
short mS2; // Number of path points.
}; // 12 bytes
struct Point // path grid point
{
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;
Point& operator=(const float[3]);
Point(const float[3]);
Point();
Point(int x, int y, int z)
: mX(x)
, mY(y)
, mZ(z)
, mAutogenerated(0)
, mConnectionNum(0)
, mUnknown(0)
{
}
}; // 16 bytes
struct Edge // path grid edge
{
size_t mV0, mV1; // index of points connected with this edge
};
ESM::RefId mCell; // Cell name
DATAstruct mData;
typedef std::vector<Point> PointList;
PointList mPoints;
typedef std::vector<Edge> EdgeList;
EdgeList mEdges;
void load(ESMReader& esm, bool& isDeleted);
void save(ESMWriter& esm, bool isDeleted = false) const;
void blank();
};
}
#endif