Core/Maps: Move terrain data handling out of Map class
Partial port of cmangos/mangos-wotlk@ff5232c648
This commit is contained in:
1 parent
21e9854686
commit
0ba58aeb6e
34 files changed
+1973
-1746
No files matched your search
@@ -33,6 +33,7 @@ EndScriptData */
|
||||
#include "PhasingHandler.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "TerrainMgr.h"
|
||||
#include "TicketMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "Util.h"
|
||||
@@ -245,8 +246,8 @@ public:
|
||||
else
|
||||
player->SaveRecallPosition();
|
||||
|
||||
Map* map = sMapMgr->CreateBaseMap(mapId);
|
||||
float z = std::max(map->GetHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
|
||||
std::shared_ptr<TerrainInfo> terrain = sTerrainMgr.LoadTerrain(mapId);
|
||||
float z = std::max(terrain->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), terrain->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
|
||||
|
||||
player->TeleportTo(mapId, x, y, z, player->GetOrientation());
|
||||
return true;
|
||||
@@ -317,11 +318,11 @@ public:
|
||||
AreaTableEntry const* zoneEntry = areaEntry->ParentAreaID ? sAreaTableStore.LookupEntry(areaEntry->ParentAreaID) : areaEntry;
|
||||
ASSERT(zoneEntry);
|
||||
|
||||
Map* map = sMapMgr->CreateBaseMap(zoneEntry->ContinentID);
|
||||
|
||||
if (map->Instanceable())
|
||||
std::shared_ptr<TerrainInfo> terrain = sTerrainMgr.LoadTerrain(zoneEntry->ContinentID);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(terrain->GetId());
|
||||
if (!mapEntry || !mapEntry->Instanceable())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->AreaName, map->GetId(), map->GetMapName());
|
||||
handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->AreaName, terrain->GetId(), terrain->GetMapName());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -345,7 +346,7 @@ public:
|
||||
else
|
||||
player->SaveRecallPosition();
|
||||
|
||||
float z = std::max(map->GetHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
|
||||
float z = std::max(terrain->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), terrain->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
|
||||
|
||||
player->TeleportTo(zoneEntry->ContinentID, x, y, z, player->GetOrientation());
|
||||
return true;
|
||||
@@ -374,8 +375,8 @@ public:
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
Map* map = sMapMgr->CreateBaseMap(mapId);
|
||||
z = std::max(map->GetHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
|
||||
std::shared_ptr<TerrainInfo> terrain = sTerrainMgr.LoadTerrain(mapId);
|
||||
z = std::max(terrain->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), terrain->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
|
||||
}
|
||||
|
||||
return DoTeleport(handler, { x, y, *z, o.value_or(0.0f) }, mapId);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "TerrainMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "Weather.h"
|
||||
#include "WeatherMgr.h"
|
||||
@@ -261,8 +262,8 @@ public:
|
||||
int gridX = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord;
|
||||
int gridY = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord;
|
||||
|
||||
uint32 haveMap = Map::ExistMap(mapId, gridX, gridY) ? 1 : 0;
|
||||
uint32 haveVMap = Map::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
|
||||
uint32 haveMap = TerrainInfo::ExistMap(mapId, gridX, gridY) ? 1 : 0;
|
||||
uint32 haveVMap = TerrainInfo::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
|
||||
uint32 haveMMap = (DisableMgr::IsPathfindingEnabled(mapId) && MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId())) ? 1 : 0;
|
||||
|
||||
if (haveVMap)
|
||||
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
handler->PSendSysMessage("gridloc [%i, %i]", gy, gx);
|
||||
|
||||
// calculate navmesh tile location
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMap(), x, y);
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMap()->GetTerrain(), x, y);
|
||||
dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(terrainMapId);
|
||||
dtNavMeshQuery const* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMeshQuery(terrainMapId, player->GetInstanceId());
|
||||
if (!navmesh || !navmeshquery)
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
static bool HandleMmapLoadedTilesCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMap(), player->GetPositionX(), player->GetPositionY());
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMap()->GetTerrain(), player->GetPositionX(), player->GetPositionY());
|
||||
dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(terrainMapId);
|
||||
dtNavMeshQuery const* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMeshQuery(terrainMapId, player->GetInstanceId());
|
||||
if (!navmesh || !navmeshquery)
|
||||
@@ -216,7 +216,7 @@ public:
|
||||
static bool HandleMmapStatsCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMap(), player->GetPositionX(), player->GetPositionY());
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMap()->GetTerrain(), player->GetPositionX(), player->GetPositionY());
|
||||
handler->PSendSysMessage("mmap stats:");
|
||||
handler->PSendSysMessage(" global mmap pathfinding is %sabled", DisableMgr::IsPathfindingEnabled(player->GetMapId()) ? "en" : "dis");
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ EndScriptData */
|
||||
#include "PhasingHandler.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "TerrainMgr.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
using namespace Trinity::ChatCommands;
|
||||
@@ -200,7 +201,7 @@ public:
|
||||
|
||||
CharacterDatabaseTransaction dummy;
|
||||
Player::SavePositionInDB(WorldLocation(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation),
|
||||
sMapMgr->GetZoneId(PhasingHandler::GetEmptyPhaseShift(), tele->mapId, tele->position_x, tele->position_y, tele->position_z), target_guid, dummy);
|
||||
sTerrainMgr.GetZoneId(PhasingHandler::GetEmptyPhaseShift(), tele->mapId, tele->position_x, tele->position_y, tele->position_z), target_guid, dummy);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user