Core/vmaps: Stop worldserver startup when gameobject models cannot be loaded

Port From (https://github.com/TrinityCore/TrinityCore/commit/a2ec80b14ced0d32e5929af6286667de63e9d0ae)
This commit is contained in:
hondacrx
2023-01-04 16:41:58 -05:00
parent 4718f88ed5
commit c686484ce5
2 changed files with 10 additions and 4 deletions
@@ -225,14 +225,14 @@ namespace Game.Collision
public bool IsMapObject() { return isWmo; }
public byte GetNameSetId() { return owner.GetNameSetId(); }
public static void LoadGameObjectModelList()
public static bool LoadGameObjectModelList()
{
uint oldMSTime = Time.GetMSTime();
var filename = Global.WorldMgr.GetDataPath() + "/vmaps/GameObjectModels.dtree";
if (!File.Exists(filename))
{
Log.outWarn(LogFilter.Server, "Unable to open '{0}' file.", filename);
return;
return false;
}
try
{
@@ -241,7 +241,7 @@ namespace Game.Collision
if (magic != MapConst.VMapMagic)
{
Log.outError(LogFilter.Misc, $"File '{filename}' has wrong header, expected {MapConst.VMapMagic}.");
return;
return false;
}
long length = reader.BaseStream.Length;
@@ -266,6 +266,7 @@ namespace Game.Collision
}
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} GameObject models in {1} ms", StaticModelList.models.Count, Time.GetMSTimeDiffToNow(oldMSTime));
return true;
}
bool _collisionEnabled;