Core/Maps: Fixed possible crash when resetting instances
This commit is contained in:
@@ -543,7 +543,10 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
|
|||||||
if (iMap && iMap->IsDungeon())
|
if (iMap && iMap->IsDungeon())
|
||||||
((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY);
|
((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY);
|
||||||
|
|
||||||
iMap->DeleteRespawnTimes();
|
if (iMap)
|
||||||
|
iMap->DeleteRespawnTimes();
|
||||||
|
else
|
||||||
|
Map::DeleteRespawnTimesInDB(mapid, instanceId);
|
||||||
|
|
||||||
// Free up the instance id and allow it to be reused
|
// Free up the instance id and allow it to be reused
|
||||||
sMapMgr->FreeInstanceId(instanceId);
|
sMapMgr->FreeInstanceId(instanceId);
|
||||||
|
|||||||
@@ -2880,14 +2880,19 @@ void Map::DeleteRespawnTimes()
|
|||||||
_creatureRespawnTimes.clear();
|
_creatureRespawnTimes.clear();
|
||||||
_goRespawnTimes.clear();
|
_goRespawnTimes.clear();
|
||||||
|
|
||||||
|
DeleteRespawnTimesInDB(GetId(), GetInstanceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId)
|
||||||
|
{
|
||||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE);
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE);
|
||||||
stmt->setUInt16(0, GetId());
|
stmt->setUInt16(0, mapId);
|
||||||
stmt->setUInt32(1, GetInstanceId());
|
stmt->setUInt32(1, instanceId);
|
||||||
CharacterDatabase.Execute(stmt);
|
CharacterDatabase.Execute(stmt);
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE);
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE);
|
||||||
stmt->setUInt16(0, GetId());
|
stmt->setUInt16(0, mapId);
|
||||||
stmt->setUInt32(1, GetInstanceId());
|
stmt->setUInt32(1, instanceId);
|
||||||
CharacterDatabase.Execute(stmt);
|
CharacterDatabase.Execute(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2906,3 +2911,4 @@ time_t Map::GetLinkedRespawnTime(uint64 guid) const
|
|||||||
|
|
||||||
return time_t(0);
|
return time_t(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -473,6 +473,8 @@ class Map : public GridRefManager<NGridType>
|
|||||||
void LoadRespawnTimes();
|
void LoadRespawnTimes();
|
||||||
void DeleteRespawnTimes();
|
void DeleteRespawnTimes();
|
||||||
|
|
||||||
|
static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void LoadMapAndVMap(int gx, int gy);
|
void LoadMapAndVMap(int gx, int gy);
|
||||||
void LoadVMap(int gx, int gy);
|
void LoadVMap(int gx, int gy);
|
||||||
|
|||||||
Reference in New Issue
Block a user