Core/Instances: Fixed and optimized instance id reuse

Port From (https://github.com/TrinityCore/TrinityCore/commit/fbdf8784a5c03dfcb575ef7b760a62d0d9d2acc1)
This commit is contained in:
hondacrx
2020-07-22 14:07:02 -04:00
parent d1ebddbe95
commit df0ee4462c
2 changed files with 40 additions and 22 deletions
@@ -199,11 +199,6 @@ namespace Game.Maps
{
uint instanceId = result.Read<uint>(0);
// Instances are pulled in ascending order from db and nextInstanceId is initialized with 1,
// so if the instance id is used, increment until we find the first unused one for a potential new instance
if (Global.MapMgr.GetNextInstanceId() == instanceId)
Global.MapMgr.SetNextInstanceId(instanceId + 1);
// Mark instance id as being used
Global.MapMgr.RegisterInstanceId(instanceId);
long resettime = result.Read<long>(3);