Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
VMapManager2.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef _VMAPMANAGER2_H
7#define _VMAPMANAGER2_H
8
9#include "IVMapManager.h"
11#include "Define.h"
12#include <mutex>
13
14//===========================================================
15
16#define MAP_FILENAME_EXTENSION2 ".vmtree"
17
18#define FILENAMEBUFFER_SIZE 500
19
27
28//===========================================================
29
30namespace G3D
31{
32 class Vector3;
33}
34
35namespace VMAP
36{
37 class StaticMapTree;
38 class WorldModel;
39
41 {
42 public:
44 void setModel(WorldModel* model) { iModel = model; }
45 WorldModel* getModel() { return iModel; }
46 void incRefCount() { ++iRefCount; }
47 int decRefCount() { return --iRefCount; }
48 protected:
51 };
52
55
57 {
58 protected:
59 // Tree to check collision
62 // Mutex for iLoadedModelFiles
64
65 bool _loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY);
66 /* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */
67
68 public:
69 // public for debug
70 G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
71 static std::string getMapFileName(unsigned int mapId);
72
74 ~VMapManager2(void);
75
76 int loadMap(const char* pBasePath, unsigned int mapId, int x, int y);
77
78 void unloadMap(unsigned int mapId, int x, int y);
79 void unloadMap(unsigned int mapId);
80
81 bool isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2) ;
85 bool getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist);
86 float getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist);
87
88 bool processCommand(char* /*command*/) { return false; } // for debug and extensions
89
90 bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const;
91 bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const;
92
93 WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename);
94 void releaseModelInstance(const std::string& filename);
95
96 // what's the use of this? o.O
97 virtual std::string getDirFileName(unsigned int mapId, int /*x*/, int /*y*/) const
98 {
99 return getMapFileName(mapId);
100 }
101 virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y);
102 public:
103 void getInstanceMapTree(InstanceTreeMap &instanceMapTree);
104 };
105}
106
107#endif
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define UNORDERED_MAP
WorldModel * getModel()
WorldModel * iModel
void setModel(WorldModel *model)
int loadMap(const char *pBasePath, unsigned int mapId, int x, int y)
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const
void releaseModelInstance(const std::string &filename)
std::mutex LoadedModelFilesLock
ModelFileMap iLoadedModelFiles
virtual bool existsMap(const char *basePath, unsigned int mapId, int x, int y)
virtual std::string getDirFileName(unsigned int mapId, int, int) const
void getInstanceMapTree(InstanceTreeMap &instanceMapTree)
bool processCommand(char *)
bool getAreaInfo(unsigned int pMapId, float x, float y, float &z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const
WorldModel * acquireModelInstance(const std::string &basepath, const std::string &filename)
void unloadMap(unsigned int mapId, int x, int y)
float getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist)
bool getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist)
bool isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2)
InstanceTreeMap iInstanceMapTrees
static std::string getMapFileName(unsigned int mapId)
bool _loadMap(uint32 mapId, const std::string &basePath, uint32 tileX, uint32 tileY)
bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 reqLiquidType, float &level, float &floor, uint32 &type) const
UNORDERED_MAP< uint32, StaticMapTree * > InstanceTreeMap
UNORDERED_MAP< std::string, ManagedModel > ModelFileMap