Core/Maps: Move terrain data handling out of Map class

Port From (https://github.com/TrinityCore/TrinityCore/commit/16a06346aea16ffd6ee84081cedfdb0c75ac0b38)
This commit is contained in:
hondacrx
2022-07-24 16:31:00 -04:00
parent c4344fbf66
commit 3cd58e4a17
25 changed files with 1035 additions and 960 deletions
+1 -1
View File
@@ -3556,7 +3556,7 @@ namespace Game.Entities
// Unit is flying, check for potential collision via vmaps
if (path.GetPathType().HasFlag(PathType.NotUsingPath))
{
col = Global.VMapMgr.GetObjectHitPos(PhasingHandler.GetTerrainMapId(GetPhaseShift(), GetMap(), pos.posX, pos.posY),
col = Global.VMapMgr.GetObjectHitPos(PhasingHandler.GetTerrainMapId(GetPhaseShift(), GetMap().GetTerrain(), pos.posX, pos.posY),
pos.posX, pos.posY, pos.posZ + halfHeight,
destx, desty, destz + halfHeight,
out destx, out desty, out destz, -0.5f);
+3 -4
View File
@@ -615,7 +615,7 @@ namespace Game.Entities
if (!createPosition.TransportGuid.HasValue)
{
homebind.WorldRelocate(createPosition.Loc);
homebindAreaId = Global.MapMgr.GetAreaId(PhasingHandler.EmptyPhaseShift, homebind);
homebindAreaId = Global.TerrainMgr.GetAreaId(PhasingHandler.EmptyPhaseShift, homebind);
saveHomebindToDb();
ok = true;
@@ -631,7 +631,7 @@ namespace Game.Entities
Cypher.Assert(loc != null, "Missing fallback graveyard location for faction {GetTeamId()}");
homebind.WorldRelocate(loc.Loc);
homebindAreaId = Global.MapMgr.GetAreaId(PhasingHandler.EmptyPhaseShift, loc.Loc);
homebindAreaId = Global.TerrainMgr.GetAreaId(PhasingHandler.EmptyPhaseShift, loc.Loc);
saveHomebindToDb();
}
@@ -3806,7 +3806,6 @@ namespace Game.Entities
return 0;
uint zone = result.Read<ushort>(0);
if (zone == 0)
{
// stored zone is zero, use generic and slow zone detection
@@ -3825,7 +3824,7 @@ namespace Game.Entities
if (!CliDB.MapStorage.ContainsKey(map))
return 0;
zone = Global.MapMgr.GetZoneId(PhasingHandler.EmptyPhaseShift, map, posx, posy, posz);
zone = Global.TerrainMgr.GetZoneId(PhasingHandler.EmptyPhaseShift, map, posx, posy, posz);
if (zone > 0)
{
+1 -1
View File
@@ -763,7 +763,7 @@ namespace Game.Entities
mountFlags = (AreaMountFlags)areaTable.MountFlags;
}
ZLiquidStatus liquidStatus = GetMap().GetLiquidStatus(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), LiquidHeaderTypeFlags.AllLiquids, out _);
ZLiquidStatus liquidStatus = GetMap().GetLiquidStatus(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), LiquidHeaderTypeFlags.AllLiquids, null);
isSubmerged = liquidStatus.HasAnyFlag(ZLiquidStatus.UnderWater) || HasUnitMovementFlag(MovementFlag.Swimming);
isInWater = liquidStatus.HasAnyFlag(ZLiquidStatus.InWater | ZLiquidStatus.UnderWater);