mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Tools: Enabled struct packing to ensure that structures are read from files properly
This commit is contained in:
@@ -40,6 +40,8 @@ enum LiquidType
|
||||
#define ADT_CELL_SIZE 8
|
||||
#define ADT_GRID_SIZE (ADT_CELLS_PER_GRID*ADT_CELL_SIZE)
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
//
|
||||
// Adt file height map chunk
|
||||
//
|
||||
@@ -304,4 +306,6 @@ public:
|
||||
adt_MHDR *a_grid;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
|
||||
friend class DBCFile;
|
||||
friend class DBCFile::Iterator;
|
||||
|
||||
Record& operator=(Record const& right);
|
||||
};
|
||||
/** Iterator that iterates over records
|
||||
*/
|
||||
@@ -111,6 +113,8 @@ public:
|
||||
}
|
||||
private:
|
||||
Record record;
|
||||
|
||||
Iterator& operator=(Iterator const& right);
|
||||
};
|
||||
|
||||
// Get record by id
|
||||
|
||||
@@ -47,6 +47,8 @@ typedef uint8_t uint8;
|
||||
|
||||
#define FILE_FORMAT_VERSION 18
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
union u_map_fcc
|
||||
{
|
||||
char fcc_txt[4];
|
||||
@@ -80,4 +82,7 @@ public:
|
||||
bool loadFile(char *filename, bool log = true);
|
||||
virtual void free();
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
//**************************************************************************************
|
||||
#define WDT_MAP_SIZE 64
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
class wdt_MWMO{
|
||||
union{
|
||||
uint32 fcc;
|
||||
@@ -83,4 +85,6 @@ public:
|
||||
wdt_MWMO *wmo;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
||||
ADT.read(buf, size);
|
||||
char* p=buf;
|
||||
int q = 0;
|
||||
WmoInstansName = new string[size];
|
||||
WmoInstansName = new std::string[size];
|
||||
while (p<buf+size)
|
||||
{
|
||||
char* s = GetPlainName(p);
|
||||
|
||||
@@ -113,14 +113,14 @@ private:
|
||||
//size_t mcnk_offsets[256], mcnk_sizes[256];
|
||||
MPQFile ADT;
|
||||
//mcell Mcell;
|
||||
string Adtfilename;
|
||||
std::string Adtfilename;
|
||||
public:
|
||||
ADTFile(char* filename);
|
||||
~ADTFile();
|
||||
int nWMO;
|
||||
int nMDX;
|
||||
string* WmoInstansName;
|
||||
string* ModelInstansName;
|
||||
std::string* WmoInstansName;
|
||||
std::string* ModelInstansName;
|
||||
bool init(uint32 map_num, uint32 tileX, uint32 tileY);
|
||||
//void LoadMapChunks();
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ typedef uint8_t uint8;
|
||||
|
||||
#define FILE_FORMAT_VERSION 18
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
//
|
||||
// File version chunk
|
||||
//
|
||||
@@ -74,4 +76,7 @@ public:
|
||||
bool loadFile(char *filename, bool log = true);
|
||||
virtual void free();
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -67,6 +67,8 @@ struct WMOLiquidHeader
|
||||
short type;
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct WMOLiquidVert
|
||||
{
|
||||
uint16 unk1;
|
||||
@@ -74,6 +76,8 @@ struct WMOLiquidVert
|
||||
float height;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
class WMOGroup
|
||||
{
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user