diff options
author | Shauren <shauren.trinity@gmail.com> | 2018-02-24 21:07:08 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2018-03-25 19:28:36 +0300 |
commit | 4798d9ce7abd86be381af086763d8dbc9ed67ef3 (patch) | |
tree | 01ff6ae3c36ca7c443d8cdfd105825262e29e92a /src/common/Collision/Maps/MapTree.h | |
parent | 91be2332e249147ce3169c46a7da77f0f8c2211d (diff) |
Core/VMaps: Implement loading phased tiles
Closes #15163
Diffstat (limited to 'src/common/Collision/Maps/MapTree.h')
-rw-r--r-- | src/common/Collision/Maps/MapTree.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/common/Collision/Maps/MapTree.h b/src/common/Collision/Maps/MapTree.h index a15f328fc76..bf991c547c9 100644 --- a/src/common/Collision/Maps/MapTree.h +++ b/src/common/Collision/Maps/MapTree.h @@ -47,23 +47,33 @@ namespace VMAP BIH iTree; ModelInstance* iTreeValues; // the tree entries uint32 iNTreeValues; + std::unordered_map<uint32, uint32> iSpawnIndices; // Store all the map tile idents that are loaded for that map // some maps are not splitted into tiles and we have to make sure, not removing the map before all tiles are removed // empty tiles have no tile file, hence map with bool instead of just a set (consistency check) loadedTileMap iLoadedTiles; + std::vector<std::pair<int32, int32>> iLoadedPrimaryTiles; // stores <tree_index, reference_count> to invalidate tree values, unload map, and to be able to report errors loadedSpawnMap iLoadedSpawns; std::string iBasePath; + struct TileFileOpenResult + { + FILE* File; + std::string Name; + bool IsPrimary; + }; + private: + static TileFileOpenResult OpenMapTileFile(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager2* vm); bool getIntersectionTime(const G3D::Ray& pRay, float &pMaxDist, bool pStopAtFirstHit) const; //bool containsLoadedMapTile(unsigned int pTileIdent) const { return(iLoadedMapTiles.containsKey(pTileIdent)); } public: static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY); static uint32 packTileID(uint32 tileX, uint32 tileY) { return tileX<<16 | tileY; } - static void unpackTileID(uint32 ID, uint32 &tileX, uint32 &tileY) { tileX = ID>>16; tileY = ID&0xFF; } - static bool CanLoadMap(const std::string &basePath, uint32 mapID, uint32 tileX, uint32 tileY); + static void unpackTileID(uint32 ID, uint32 &tileX, uint32 &tileY) { tileX = ID >> 16; tileY = ID & 0xFF; } + static bool CanLoadMap(const std::string &basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager2* vm); StaticMapTree(uint32 mapID, const std::string &basePath); ~StaticMapTree(); @@ -82,6 +92,8 @@ namespace VMAP uint32 numLoadedTiles() const { return uint32(iLoadedTiles.size()); } void getModelInstances(ModelInstance* &models, uint32 &count); + int32 GetDistanceToClosestPrimaryTile(int32 x, int32 y) const; + private: StaticMapTree(StaticMapTree const& right) = delete; StaticMapTree& operator=(StaticMapTree const& right) = delete; |