TrinityCore
IVMapManager.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 _IVMAPMANAGER_H
19#define _IVMAPMANAGER_H
20
21#include "Define.h"
22#include "ModelIgnoreFlags.h"
23#include "Optional.h"
24#include <string>
25
26//===========================================================
27
32namespace VMAP
33{
34 enum class LoadResult : uint8
35 {
36 Success,
41 };
42
43 #define VMAP_INVALID_HEIGHT -100000.0f // for check
44 #define VMAP_INVALID_HEIGHT_VALUE -200000.0f // real assigned value in unknown height case
45
47 {
48 struct AreaInfo
49 {
50 AreaInfo() = default;
51 AreaInfo(int32 _groupId, int32 _adtId, int32 _rootId, uint32 _mogpFlags, uint32 _uniqueId)
52 : groupId(_groupId), adtId(_adtId), rootId(_rootId), mogpFlags(_mogpFlags), uniqueId(_uniqueId) { }
58 };
60 {
61 LiquidInfo() = default;
62 LiquidInfo(uint32 _type, float _level) : type(_type), level(_level) { }
64 float level = 0.0f;
65 };
66
70 };
71 //===========================================================
73 {
74 private:
77
78 public:
79 IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) { }
80
81 virtual ~IVMapManager(void) { }
82
83 virtual LoadResult loadMap(char const* pBasePath, unsigned int pMapId, int x, int y) = 0;
84
85 virtual LoadResult existsMap(char const* pBasePath, unsigned int pMapId, int x, int y) = 0;
86
87 virtual void unloadMap(unsigned int pMapId, int x, int y) = 0;
88 virtual void unloadMap(unsigned int pMapId) = 0;
89
90 virtual bool isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags) = 0;
91 virtual float getHeight(unsigned int pMapId, float x, float y, float z, float maxSearchDist) = 0;
96 virtual bool getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float pModifyDist) = 0;
100 virtual bool processCommand(char *pCommand)= 0;
101
106 void setEnableLineOfSightCalc(bool pVal) { iEnableLineOfSightCalc = pVal; }
111 void setEnableHeightCalc(bool pVal) { iEnableHeightCalc = pVal; }
112
113 bool isLineOfSightCalcEnabled() const { return(iEnableLineOfSightCalc); }
114 bool isHeightCalcEnabled() const { return(iEnableHeightCalc); }
115 bool isMapLoadingEnabled() const { return(iEnableLineOfSightCalc || iEnableHeightCalc ); }
116
117 virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const =0;
118
123 virtual bool getAreaAndLiquidData(unsigned int mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const = 0;
124 };
125
126}
127#endif
uint8_t uint8
Definition: Define.h:144
#define TC_COMMON_API
Definition: Define.h:99
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
#define VMAP_INVALID_HEIGHT
Definition: IVMapManager.h:43
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
virtual float getHeight(unsigned int pMapId, float x, float y, float z, float maxSearchDist)=0
virtual bool isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)=0
bool isHeightCalcEnabled() const
Definition: IVMapManager.h:114
virtual bool getAreaAndLiquidData(unsigned int mapId, float x, float y, float z, Optional< uint8 > reqLiquidType, AreaAndLiquidData &data) const =0
void setEnableLineOfSightCalc(bool pVal)
Definition: IVMapManager.h:106
bool isMapLoadingEnabled() const
Definition: IVMapManager.h:115
bool isLineOfSightCalcEnabled() const
Definition: IVMapManager.h:113
virtual LoadResult loadMap(char const *pBasePath, unsigned int pMapId, int x, int y)=0
virtual LoadResult existsMap(char const *pBasePath, unsigned int pMapId, int x, int y)=0
virtual bool processCommand(char *pCommand)=0
virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const =0
virtual void unloadMap(unsigned int pMapId, int x, int y)=0
virtual void unloadMap(unsigned int pMapId)=0
virtual bool getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float pModifyDist)=0
void setEnableHeightCalc(bool pVal)
Definition: IVMapManager.h:111
virtual ~IVMapManager(void)
Definition: IVMapManager.h:81
LoadResult
Definition: IVMapManager.h:35
AreaInfo(int32 _groupId, int32 _adtId, int32 _rootId, uint32 _mogpFlags, uint32 _uniqueId)
Definition: IVMapManager.h:51
LiquidInfo(uint32 _type, float _level)
Definition: IVMapManager.h:62
Optional< AreaInfo > areaInfo
Definition: IVMapManager.h:68
Optional< LiquidInfo > liquidInfo
Definition: IVMapManager.h:69