Fix build
This commit is contained in:
@@ -540,7 +540,7 @@ namespace Game
|
|||||||
uint avgTime = 0;
|
uint avgTime = 0;
|
||||||
GroupQueueInfo ginfo = null;
|
GroupQueueInfo ginfo = null;
|
||||||
|
|
||||||
ObjectGuid errorGuid;
|
ObjectGuid errorGuid = ObjectGuid.Empty;
|
||||||
GroupJoinBattlegroundResult err = GroupJoinBattlegroundResult.None;
|
GroupJoinBattlegroundResult err = GroupJoinBattlegroundResult.None;
|
||||||
if (!Global.BattlegroundMgr.IsArenaTesting())
|
if (!Global.BattlegroundMgr.IsArenaTesting())
|
||||||
err = group.CanJoinBattlegroundQueue(bgTemplate, bgQueueTypeId, (uint)arenatype, (uint)arenatype, true, packet.TeamSizeIndex, out errorGuid);
|
err = group.CanJoinBattlegroundQueue(bgTemplate, bgQueueTypeId, (uint)arenatype, (uint)arenatype, true, packet.TeamSizeIndex, out errorGuid);
|
||||||
|
|||||||
@@ -27,18 +27,18 @@ namespace Game
|
|||||||
return loadedMMaps.LookupByKey(mapId);
|
return loadedMMaps.LookupByKey(mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadResult LoadMapData(string basePath, uint mapId)
|
MMapLoadResult LoadMapData(string basePath, uint mapId)
|
||||||
{
|
{
|
||||||
// we already have this map loaded?
|
// we already have this map loaded?
|
||||||
if (loadedMMaps.ContainsKey(mapId) && loadedMMaps[mapId] != null)
|
if (loadedMMaps.ContainsKey(mapId) && loadedMMaps[mapId] != null)
|
||||||
return LoadResult.AlreadyLoaded;
|
return MMapLoadResult.AlreadyLoaded;
|
||||||
|
|
||||||
// load and init dtNavMesh - read parameters from file
|
// load and init dtNavMesh - read parameters from file
|
||||||
string filename = string.Format(MAP_FILE_NAME_FORMAT, basePath, mapId);
|
string filename = string.Format(MAP_FILE_NAME_FORMAT, basePath, mapId);
|
||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Maps, $"Could not open mmap file {filename}");
|
Log.outError(LogFilter.Maps, $"Could not open mmap file {filename}");
|
||||||
return LoadResult.FileNotFound;
|
return MMapLoadResult.FileNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
using BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.UTF8);
|
using BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.UTF8);
|
||||||
@@ -56,14 +56,14 @@ namespace Game
|
|||||||
if (Detour.dtStatusFailed(mesh.init(Params)))
|
if (Detour.dtStatusFailed(mesh.init(Params)))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Maps, "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap {0:D4} from file {1}", mapId, filename);
|
Log.outError(LogFilter.Maps, "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap {0:D4} from file {1}", mapId, filename);
|
||||||
return LoadResult.LibraryError;
|
return MMapLoadResult.LibraryError;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.outInfo(LogFilter.Maps, "MMAP:loadMapData: Loaded {0:D4}.mmap", mapId);
|
Log.outInfo(LogFilter.Maps, "MMAP:loadMapData: Loaded {0:D4}.mmap", mapId);
|
||||||
|
|
||||||
// store inside our map list
|
// store inside our map list
|
||||||
loadedMMaps[mapId] = new MMapData(mesh);
|
loadedMMaps[mapId] = new MMapData(mesh);
|
||||||
return LoadResult.Success;
|
return MMapLoadResult.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint PackTileID(int x, int y)
|
uint PackTileID(int x, int y)
|
||||||
@@ -71,14 +71,14 @@ namespace Game
|
|||||||
return (uint)(x << 16 | y);
|
return (uint)(x << 16 | y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoadResult LoadMap(string basePath, uint mapId, int x, int y)
|
public MMapLoadResult LoadMap(string basePath, uint mapId, int x, int y)
|
||||||
{
|
{
|
||||||
// make sure the mmap is loaded and ready to load tiles
|
// make sure the mmap is loaded and ready to load tiles
|
||||||
LoadResult mapResult = LoadMapData(basePath, mapId);
|
MMapLoadResult mapResult = LoadMapData(basePath, mapId);
|
||||||
switch (mapResult)
|
switch (mapResult)
|
||||||
{
|
{
|
||||||
case LoadResult.Success:
|
case MMapLoadResult.Success:
|
||||||
case LoadResult.AlreadyLoaded:
|
case MMapLoadResult.AlreadyLoaded:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return mapResult;
|
return mapResult;
|
||||||
@@ -91,7 +91,7 @@ namespace Game
|
|||||||
// check if we already have this tile loaded
|
// check if we already have this tile loaded
|
||||||
uint packedGridPos = PackTileID(x, y);
|
uint packedGridPos = PackTileID(x, y);
|
||||||
if (mmap.loadedTileRefs.ContainsKey(packedGridPos))
|
if (mmap.loadedTileRefs.ContainsKey(packedGridPos))
|
||||||
return LoadResult.AlreadyLoaded;
|
return MMapLoadResult.AlreadyLoaded;
|
||||||
|
|
||||||
// load this tile . mmaps/MMMXXYY.mmtile
|
// load this tile . mmaps/MMMXXYY.mmtile
|
||||||
string fileName = string.Format(TILE_FILE_NAME_FORMAT, basePath, mapId, x, y);
|
string fileName = string.Format(TILE_FILE_NAME_FORMAT, basePath, mapId, x, y);
|
||||||
@@ -104,7 +104,7 @@ namespace Game
|
|||||||
if (!File.Exists(fileName))
|
if (!File.Exists(fileName))
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Maps, "MMAP:loadMap: Could not open mmtile file '{0}'", fileName);
|
Log.outDebug(LogFilter.Maps, "MMAP:loadMap: Could not open mmtile file '{0}'", fileName);
|
||||||
return LoadResult.FileNotFound;
|
return MMapLoadResult.FileNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
using BinaryReader reader = new(new FileStream(fileName, FileMode.Open, FileAccess.Read));
|
using BinaryReader reader = new(new FileStream(fileName, FileMode.Open, FileAccess.Read));
|
||||||
@@ -112,13 +112,13 @@ namespace Game
|
|||||||
if (fileHeader.mmapMagic != MapConst.mmapMagic)
|
if (fileHeader.mmapMagic != MapConst.mmapMagic)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Maps, "MMAP:loadMap: Bad header in mmap {0:D4}{1:D2}{2:D2}.mmtile", mapId, x, y);
|
Log.outError(LogFilter.Maps, "MMAP:loadMap: Bad header in mmap {0:D4}{1:D2}{2:D2}.mmtile", mapId, x, y);
|
||||||
return LoadResult.VersionMismatch;
|
return MMapLoadResult.VersionMismatch;
|
||||||
}
|
}
|
||||||
if (fileHeader.mmapVersion != MapConst.mmapVersion)
|
if (fileHeader.mmapVersion != MapConst.mmapVersion)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Maps, "MMAP:loadMap: {0:D4}{1:D2}{2:D2}.mmtile was built with generator v{3}, expected v{4}",
|
Log.outError(LogFilter.Maps, "MMAP:loadMap: {0:D4}{1:D2}{2:D2}.mmtile was built with generator v{3}, expected v{4}",
|
||||||
mapId, x, y, fileHeader.mmapVersion, MapConst.mmapVersion);
|
mapId, x, y, fileHeader.mmapVersion, MapConst.mmapVersion);
|
||||||
return LoadResult.VersionMismatch;
|
return MMapLoadResult.VersionMismatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bytes = reader.ReadBytes((int)fileHeader.size);
|
var bytes = reader.ReadBytes((int)fileHeader.size);
|
||||||
@@ -132,19 +132,19 @@ namespace Game
|
|||||||
mmap.loadedTileRefs.Add(packedGridPos, tileRef);
|
mmap.loadedTileRefs.Add(packedGridPos, tileRef);
|
||||||
++loadedTiles;
|
++loadedTiles;
|
||||||
Log.outInfo(LogFilter.Maps, "MMAP:loadMap: Loaded mmtile {0:D4}[{1:D2}, {2:D2}]", mapId, x, y);
|
Log.outInfo(LogFilter.Maps, "MMAP:loadMap: Loaded mmtile {0:D4}[{1:D2}, {2:D2}]", mapId, x, y);
|
||||||
return LoadResult.Success;
|
return MMapLoadResult.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.outError(LogFilter.Maps, "MMAP:loadMap: Could not load {0:D4}{1:D2}{2:D2}.mmtile into navmesh", mapId, x, y);
|
Log.outError(LogFilter.Maps, "MMAP:loadMap: Could not load {0:D4}{1:D2}{2:D2}.mmtile into navmesh", mapId, x, y);
|
||||||
return LoadResult.LibraryError;
|
return MMapLoadResult.LibraryError;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadMapInstance(string basePath, uint meshMapId, uint instanceMapId, uint instanceId)
|
public bool LoadMapInstance(string basePath, uint meshMapId, uint instanceMapId, uint instanceId)
|
||||||
{
|
{
|
||||||
switch (LoadMapData(basePath, meshMapId))
|
switch (LoadMapData(basePath, meshMapId))
|
||||||
{
|
{
|
||||||
case LoadResult.Success:
|
case MMapLoadResult.Success:
|
||||||
case LoadResult.AlreadyLoaded:
|
case MMapLoadResult.AlreadyLoaded:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@@ -311,7 +311,7 @@ namespace Game
|
|||||||
public byte usesLiquids;
|
public byte usesLiquids;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum LoadResult
|
public enum MMapLoadResult
|
||||||
{
|
{
|
||||||
Success,
|
Success,
|
||||||
AlreadyLoaded,
|
AlreadyLoaded,
|
||||||
|
|||||||
@@ -346,15 +346,15 @@ namespace Game.Maps
|
|||||||
if (!Global.DisableMgr.IsPathfindingEnabled(GetId()))
|
if (!Global.DisableMgr.IsPathfindingEnabled(GetId()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LoadResult mmapLoadResult = Global.MMapMgr.LoadMap(Global.WorldMgr.GetDataPath(), GetId(), gx, gy);
|
MMapLoadResult mmapLoadResult = Global.MMapMgr.LoadMap(Global.WorldMgr.GetDataPath(), GetId(), gx, gy);
|
||||||
switch (mmapLoadResult)
|
switch (mmapLoadResult)
|
||||||
{
|
{
|
||||||
case LoadResult.Success:
|
case MMapLoadResult.Success:
|
||||||
Log.outDebug(LogFilter.Maps, $"MMAP loaded name:{GetMapName()}, id:{GetId()}, x:{gx}, y:{gy} (mmap rep.: x:{gx}, y:{gy})");
|
Log.outDebug(LogFilter.Maps, $"MMAP loaded name:{GetMapName()}, id:{GetId()}, x:{gx}, y:{gy} (mmap rep.: x:{gx}, y:{gy})");
|
||||||
break;
|
break;
|
||||||
case LoadResult.AlreadyLoaded:
|
case MMapLoadResult.AlreadyLoaded:
|
||||||
break;
|
break;
|
||||||
case LoadResult.FileNotFound:
|
case MMapLoadResult.FileNotFound:
|
||||||
if (_parentTerrain != null)
|
if (_parentTerrain != null)
|
||||||
break; // don't log tile not found errors for child maps
|
break; // don't log tile not found errors for child maps
|
||||||
goto default;
|
goto default;
|
||||||
|
|||||||
Reference in New Issue
Block a user