TrinityCore
wdtfile.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef WDTFILE_H
19#define WDTFILE_H
20
21#include "cascfile.h"
22#include "wmo.h"
23#include <memory>
24#include <string>
25#include <vector>
26
27class ADTFile;
28
29#pragma pack(push, 1)
30namespace WDT
31{
32 struct MPHD
33 {
42 };
43
44 struct MAIN
45 {
47 {
50 } Data[64][64];
51 };
52
53 struct MAID
54 {
56 {
57 uint32 RootADT; // FileDataID of mapname_xx_yy.adt
58 uint32 Obj0ADT; // FileDataID of mapname_xx_yy_obj0.adt
59 uint32 Obj1ADT; // FileDataID of mapname_xx_yy_obj1.adt
60 uint32 Tex0ADT; // FileDataID of mapname_xx_yy_tex0.adt
61 uint32 LodADT; // FileDataID of mapname_xx_yy_lod.adt
62 uint32 MapTexture; // FileDataID of mapname_xx_yy.blp
63 uint32 MapTextureN; // FileDataID of mapname_xx_yy_n.blp
64 uint32 MinimapTexture; // FileDataID of mapxx_yy.blp
65 } Data[64][64];
66 };
67}
68#pragma pack(pop)
69
71{
72public:
73 WDTFile(uint32 fileDataId, std::string const& description, std::string mapName, bool cache);
75 bool init(uint32 mapId);
76
78 void FreeADT(ADTFile* adt);
79private:
83 std::unique_ptr<WDT::MAID> _adtFileDataIds;
84 std::string _mapName;
85 std::vector<std::string> _wmoNames;
86 struct ADTCache
87 {
88 std::unique_ptr<ADTFile> file[64][64];
89 };
90 std::unique_ptr<ADTCache> _adtCache;
91};
92
93#endif
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
void FreeADT(ADTFile *adt)
Definition: wdtfile.cpp:165
WDT::MAIN _adtInfo
Definition: wdtfile.h:82
WDT::MPHD _header
Definition: wdtfile.h:81
std::vector< std::string > _wmoNames
Definition: wdtfile.h:85
ADTFile * GetMap(int32 x, int32 y)
Definition: wdtfile.cpp:141
WDTFile(uint32 fileDataId, std::string const &description, std::string mapName, bool cache)
Definition: wdtfile.cpp:28
bool init(uint32 mapId)
Definition: wdtfile.cpp:44
CASCFile _file
Definition: wdtfile.h:80
std::string _mapName
Definition: wdtfile.h:84
std::unique_ptr< ADTCache > _adtCache
Definition: wdtfile.h:90
std::unique_ptr< WDT::MAID > _adtFileDataIds
Definition: wdtfile.h:83
Definition: wdtfile.h:31
std::unique_ptr< ADTFile > file[64][64]
Definition: wdtfile.h:88
uint32 LgtFileDataID
Definition: wdtfile.h:35
uint32 TexFileDataID
Definition: wdtfile.h:39
uint32 OccFileDataID
Definition: wdtfile.h:36
uint32 WdlFileDataID
Definition: wdtfile.h:40
uint32 Flags
Definition: wdtfile.h:34
uint32 MpvFileDataID
Definition: wdtfile.h:38
uint32 Pd4FileDataID
Definition: wdtfile.h:41
uint32 FogsFileDataID
Definition: wdtfile.h:37