From 4bfc02f1f3c106138147e1f0a66f8af113310cae Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 9 Feb 2021 10:33:35 -0500 Subject: [PATCH] Misc fixes. --- Source/Framework/Networking/AsyncAcceptor.cs | 7 ++++--- .../Game/BattleGrounds/BattleGroundManager.cs | 2 +- Source/Game/Handlers/MiscHandler.cs | 2 +- Source/Game/Maps/Map.cs | 21 +++++++++++++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Source/Framework/Networking/AsyncAcceptor.cs b/Source/Framework/Networking/AsyncAcceptor.cs index f99b0e184..6633848c6 100644 --- a/Source/Framework/Networking/AsyncAcceptor.cs +++ b/Source/Framework/Networking/AsyncAcceptor.cs @@ -64,8 +64,10 @@ namespace Framework.Networking AsyncAcceptSocket(mgrHandler); } } - catch (ObjectDisposedException) - { } + catch (ObjectDisposedException ex) + { + Log.outException(ex); + } } public void Close() @@ -74,7 +76,6 @@ namespace Framework.Networking return; _closed = true; - _listener.Stop(); } } } diff --git a/Source/Game/BattleGrounds/BattleGroundManager.cs b/Source/Game/BattleGrounds/BattleGroundManager.cs index 77c77ad6b..0018406c1 100644 --- a/Source/Game/BattleGrounds/BattleGroundManager.cs +++ b/Source/Game/BattleGrounds/BattleGroundManager.cs @@ -38,7 +38,7 @@ namespace Game.BattleGrounds public void DeleteAllBattlegrounds() { foreach (var data in bgDataStore.Values.ToList()) - while(data.m_Battlegrounds.Empty()) + while(!data.m_Battlegrounds.Empty()) data.m_Battlegrounds.First().Value.Dispose(); bgDataStore.Clear(); diff --git a/Source/Game/Handlers/MiscHandler.cs b/Source/Game/Handlers/MiscHandler.cs index 9d87960ea..0cfa0abc1 100644 --- a/Source/Game/Handlers/MiscHandler.cs +++ b/Source/Game/Handlers/MiscHandler.cs @@ -829,7 +829,7 @@ namespace Game { AdventureJournalDataInfo dataInfo; dataInfo.AdventureJournalID = (int)adventureJournal.Id; - dataInfo.Priority = (int)adventureJournal.PriorityMax; + dataInfo.Priority = adventureJournal.PriorityMax; response.AdventureJournalDatas.Add(dataInfo); count++; } diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 10db969d2..943b8dc4e 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -115,6 +115,27 @@ namespace Game.Maps public void DiscoverGridMapFiles() { + string tileListName = $"{Global.WorldMgr.GetDataPath()}/maps/{GetId():D4}.tilelist"; + // tile list is optional + if (File.Exists(tileListName)) + { + using (var reader = new BinaryReader(new FileStream(tileListName, FileMode.Open, FileAccess.Read))) + { + var mapMagic = reader.ReadUInt32(); + var versionMagic = reader.ReadUInt32(); + if (mapMagic == MapConst.MapMagic && versionMagic == MapConst.MapVersionMagic) + { + var build = reader.ReadUInt32(); + byte[] tilesData = reader.ReadArray(MapConst.MaxGrids * MapConst.MaxGrids); + for (uint gx = 0; gx < MapConst.MaxGrids; ++gx) + for (uint gy = 0; gy < MapConst.MaxGrids; ++gy) + i_gridFileExists[(int)(gx * MapConst.MaxGrids + gy)] = tilesData[(int)(gx * MapConst.MaxGrids + gy)] == 49; // char of 1 + + return; + } + } + } + for (uint gx = 0; gx < MapConst.MaxGrids; ++gx) for (uint gy = 0; gy < MapConst.MaxGrids; ++gy) i_gridFileExists[(int)(gx * MapConst.MaxGrids + gy)] = ExistMap(GetId(), gx, gy);