diff --git a/src/game/GridMap.cpp b/src/game/GridMap.cpp index 7fbd379be..bedfbccaf 100644 --- a/src/game/GridMap.cpp +++ b/src/game/GridMap.cpp @@ -25,6 +25,7 @@ #include "DBCStores.h" #include "GridMap.h" #include "VMapFactory.h" +#include "MoveMap.h" #include "World.h" #include "Policies/SingletonImp.h" #include "Util.h" @@ -645,6 +646,7 @@ TerrainInfo::~TerrainInfo() delete m_GridMaps[i][k]; VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId); + MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId); } GridMap * TerrainInfo::Load(const uint32 x, const uint32 y) @@ -705,6 +707,9 @@ void TerrainInfo::CleanUpGrids(const uint32 diff) //unload VMAPS... VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId, x, y); + + //unload mmap... + MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId, x, y); } } } @@ -1088,6 +1093,9 @@ GridMap * TerrainInfo::LoadMapAndVMap( const uint32 x, const uint32 y ) DEBUG_LOG("Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", mapName, m_mapId, x,y,x,y); break; } + + // load navmesh + MMAP::MMapFactory::createOrGetMMapManager()->loadMap(m_mapId, x, y); } } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index c0b0f6f3f..d6c5ac878 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -35,6 +35,7 @@ #include "DBCEnums.h" #include "MapPersistentStateMgr.h" #include "VMapFactory.h" +#include "MoveMap.h" #include "BattleGroundMgr.h" Map::~Map() @@ -53,6 +54,9 @@ Map::~Map() i_data = NULL; } + // unload instance specific navigation data + MMAP::MMapFactory::createOrGetMMapManager()->unloadMapInstance(m_TerrainData->GetMapId(), GetInstanceId()); + //release reference count if(m_TerrainData->Release()) sTerrainMgr.UnloadTerrain(m_TerrainData->GetMapId()); diff --git a/src/game/vmap/MapTree.h b/src/game/vmap/MapTree.h index e481a4fd3..661504d0b 100644 --- a/src/game/vmap/MapTree.h +++ b/src/game/vmap/MapTree.h @@ -80,6 +80,11 @@ namespace VMAP void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm); bool isTiled() const { return iIsTiled; } uint32 numLoadedTiles() const { return iLoadedTiles.size(); } + +#ifdef MMAP_GENERATOR + public: + void getModelInstances(ModelInstance* &models, uint32 &count); +#endif }; struct AreaInfo diff --git a/src/game/vmap/ModelInstance.h b/src/game/vmap/ModelInstance.h index 923b4c8f6..6c9ea6fc1 100644 --- a/src/game/vmap/ModelInstance.h +++ b/src/game/vmap/ModelInstance.h @@ -75,6 +75,11 @@ namespace VMAP G3D::Matrix3 iInvRot; float iInvScale; WorldModel *iModel; + +#ifdef MMAP_GENERATOR + public: + WorldModel* const getWorldModel(); +#endif }; } // namespace VMAP diff --git a/src/game/vmap/VMapDefinitions.h b/src/game/vmap/VMapDefinitions.h index 06638972f..05f33e562 100644 --- a/src/game/vmap/VMapDefinitions.h +++ b/src/game/vmap/VMapDefinitions.h @@ -35,6 +35,12 @@ namespace VMAP #include "Errors.h" #include "Log.h" #define ERROR_LOG(...) sLog.outError(__VA_ARGS__); +#elif defined MMAP_GENERATOR + #include + #define MANGOS_ASSERT(x) assert(x) + #define DEBUG_LOG(...) 0 + #define DETAIL_LOG(...) 0 + #define ERROR_LOG(...) do{ printf("ERROR:"); printf(__VA_ARGS__); printf("\n"); } while(0) #else #include #define MANGOS_ASSERT(x) assert(x) diff --git a/src/game/vmap/VMapManager2.h b/src/game/vmap/VMapManager2.h index 074480f17..ee43bc83f 100644 --- a/src/game/vmap/VMapManager2.h +++ b/src/game/vmap/VMapManager2.h @@ -106,6 +106,11 @@ namespace VMAP return getMapFileName(pMapId); } virtual bool existsMap(const char* pBasePath, unsigned int pMapId, int x, int y); + +#ifdef MMAP_GENERATOR + public: + void getInstanceMapTree(InstanceTreeMap &instanceMapTree); +#endif }; } #endif diff --git a/src/game/vmap/WorldModel.h b/src/game/vmap/WorldModel.h index 3455be76f..c5020f74b 100644 --- a/src/game/vmap/WorldModel.h +++ b/src/game/vmap/WorldModel.h @@ -66,6 +66,10 @@ namespace VMAP uint32 iType; //!< liquid type float *iHeight; //!< (tilesX + 1)*(tilesY + 1) height values uint8 *iFlags; //!< info if liquid tile is used +#ifdef MMAP_GENERATOR + public: + void getPosInfo(uint32 &tilesX, uint32 &tilesY, Vector3 &corner) const; +#endif }; /*! holding additional info for WMO group files */ @@ -98,6 +102,11 @@ namespace VMAP std::vector triangles; BIH meshTree; WmoLiquid *iLiquid; + +#ifdef MMAP_GENERATOR + public: + void getMeshData(std::vector &vertices, std::vector &triangles, WmoLiquid* &liquid); +#endif }; /*! Holds a model (converted M2 or WMO) in its original coordinate space */ class WorldModel @@ -117,6 +126,11 @@ namespace VMAP uint32 RootWMOID; std::vector groupModels; BIH groupTree; + +#ifdef MMAP_GENERATOR + public: + void getGroupModels(std::vector &groupModels); +#endif }; } // namespace VMAP diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 21b4559f8..61ddf9d1a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11909" + #define REVISION_NR "11910" #endif // __REVISION_NR_H__