OpenMW
components/esm/loadpgrd.hpp
Go to the documentation of this file.
00001 #ifndef OPENMW_ESM_PGRD_H
00002 #define OPENMW_ESM_PGRD_H
00003 
00004 #include <string>
00005 #include <vector>
00006 
00007 namespace ESM
00008 {
00009 
00010 class ESMReader;
00011 class ESMWriter;
00012 
00013 /*
00014  * Path grid.
00015  */
00016 struct Pathgrid
00017 {
00018     static unsigned int sRecordId;
00019 
00020     struct DATAstruct
00021     {
00022         int mX, mY; // Grid location, matches cell for exterior cells
00023         short mS1; // ?? Usually but not always a power of 2. Doesn't seem
00024                   // to have any relation to the size of PGRC.
00025         short mS2; // Number of path points.
00026     }; // 12 bytes
00027 
00028     struct Point // path grid point
00029     {
00030         int mX, mY, mZ; // Location of point
00031         unsigned char mAutogenerated; // autogenerated vs. user coloring flag?
00032         unsigned char mConnectionNum; // number of connections for this point
00033         short mUnknown;
00034     }; // 16 bytes
00035 
00036     struct Edge // path grid edge
00037     {
00038         int mV0, mV1; // index of points connected with this edge
00039     }; // 8 bytes
00040 
00041     std::string mCell; // Cell name
00042     DATAstruct mData;
00043 
00044     typedef std::vector<Point> PointList;
00045     PointList mPoints;
00046 
00047     typedef std::vector<Edge> EdgeList;
00048     EdgeList mEdges;
00049 
00050     void load(ESMReader &esm);
00051     void save(ESMWriter &esm) const;
00052 };
00053 }
00054 #endif