diff options
author | leak <leakzx@googlemail.com> | 2011-03-11 13:24:58 +0100 |
---|---|---|
committer | leak <leakzx@googlemail.com> | 2011-03-11 13:24:58 +0100 |
commit | 190ef1c2ef0eac90f90d7f84e8ed20f020b2be11 (patch) | |
tree | 03936f69ece2b53070c59fb3f6b7f68a30ea0a6c /src | |
parent | 3973d1b45444c0c8fcd7aa1e033be4329dce05ae (diff) |
Core/Instances: Fix crash and allocation issue in instance id generation
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Instances/InstanceSaveMgr.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/Maps/MapManager.cpp | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index d3b5ad0f1e1..a13c5b79ac6 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -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) diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 45aeebd7c47..d2f86917b8b 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -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)); } |