mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Core/Instances: Fix crash and allocation issue in instance id generation
This commit is contained in:
@@ -560,7 +560,7 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
|
||||
sObjectMgr->DeleteRespawnTimeForInstance(instanceId); // even if map is not loaded
|
||||
|
||||
// Free up the instance id and allow it to be reused
|
||||
sMapMgr->FreeInstanceId(iMap->GetInstanceId());
|
||||
sMapMgr->FreeInstanceId(instanceId);
|
||||
}
|
||||
|
||||
void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, time_t resetTime)
|
||||
|
||||
@@ -404,16 +404,12 @@ uint32 MapManager::GenerateInstanceId()
|
||||
// Allocate space if necessary
|
||||
if (newInstanceId >= uint32(_instanceIds.size()))
|
||||
{
|
||||
// DEBUG CODE - TO BE REMOVED OR ENABLED DEPENDING ON THIS ASSERT TRIGGERING
|
||||
ASSERT(_instanceIds.size() == _instanceIds.capacity());
|
||||
|
||||
/*
|
||||
// Due to the odd memory allocation behavior of vector<bool> we match size to capacity before triggering a new allocation
|
||||
if (_instanceIds.size() < _instanceIds.capacity())
|
||||
{
|
||||
_instanceIds.resize(_instanceIds.capacity());
|
||||
}
|
||||
else
|
||||
*/
|
||||
_instanceIds.resize(floor(newInstanceId / 32.0f) * 32 + (newInstanceId % 32 > 0 ? 32 : 0));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user