TrinityCore
Loading...
Searching...
No Matches
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
41
42 enum class LoadResult : uint8
43 {
44 Success,
47 };
48
49 #define VMAP_INVALID_HEIGHT -100000.0f // for check
50 #define VMAP_INVALID_HEIGHT_VALUE -200000.0f // real assigned value in unknown height case
51
53 {
54 struct AreaInfo
55 {
56 AreaInfo() = default;
57 AreaInfo(int32 _groupId, int32 _adtId, int32 _rootId, uint32 _mogpFlags, uint32 _uniqueId)
58 : groupId(_groupId), adtId(_adtId), rootId(_rootId), mogpFlags(_mogpFlags), uniqueId(_uniqueId) { }
64 };
66 {
67 LiquidInfo() = default;
68 LiquidInfo(uint32 _type, float _level) : type(_type), level(_level) { }
70 float level = 0.0f;
71 };
72
76 };
77 //===========================================================
79 {
80 private:
83
84 public:
85 IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) { }
86
87 virtual ~IVMapManager(void) { }
88
89 virtual int loadMap(char const* pBasePath, unsigned int pMapId, int x, int y) = 0;
90
91 virtual LoadResult existsMap(char const* pBasePath, unsigned int pMapId, int x, int y) = 0;
92
93 virtual void unloadMap(unsigned int pMapId, int x, int y) = 0;
94 virtual void unloadMap(unsigned int pMapId) = 0;
95
96 virtual bool isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags) = 0;
97 virtual float getHeight(unsigned int pMapId, float x, float y, float z, float maxSearchDist) = 0;
102 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;
106 virtual bool processCommand(char *pCommand)= 0;
107
112 void setEnableLineOfSightCalc(bool pVal) { iEnableLineOfSightCalc = pVal; }
117 void setEnableHeightCalc(bool pVal) { iEnableHeightCalc = pVal; }
118
119 bool isLineOfSightCalcEnabled() const { return(iEnableLineOfSightCalc); }
120 bool isHeightCalcEnabled() const { return(iEnableHeightCalc); }
121 bool isMapLoadingEnabled() const { return(iEnableLineOfSightCalc || iEnableHeightCalc ); }
122
123 virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const =0;
124
129 virtual bool getAreaAndLiquidData(unsigned int mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const = 0;
130 };
131
132}
133#endif
uint8_t uint8
Definition Define.h:135
#define TC_COMMON_API
Definition Define.h:96
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define VMAP_INVALID_HEIGHT
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 int loadMap(char const *pBasePath, unsigned int pMapId, int x, int y)=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
virtual bool getAreaAndLiquidData(unsigned int mapId, float x, float y, float z, Optional< uint8 > reqLiquidType, AreaAndLiquidData &data) const =0
void setEnableLineOfSightCalc(bool pVal)
bool isMapLoadingEnabled() const
bool isLineOfSightCalcEnabled() const
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)
virtual ~IVMapManager(void)
VMAP_LOAD_RESULT
@ VMAP_LOAD_RESULT_ERROR
@ VMAP_LOAD_RESULT_OK
@ VMAP_LOAD_RESULT_IGNORED
AreaInfo(int32 _groupId, int32 _adtId, int32 _rootId, uint32 _mogpFlags, uint32 _uniqueId)
LiquidInfo(uint32 _type, float _level)
Optional< AreaInfo > areaInfo
Optional< LiquidInfo > liquidInfo