mirror of
https://github.com/mangosfour/server.git
synced 2025-12-21 10:37:06 +00:00
[11133] Implement template functions for call functor for all Map/MapPersistentState with some map id.
This commit is contained in:
parent
f4a2a582d9
commit
da1b616312
5 changed files with 76 additions and 7 deletions
|
|
@ -1353,6 +1353,19 @@ bool Creature::HasInvolvedQuest(uint32 quest_id) const
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
struct CreatureRespawnDeleteWorker
|
||||
{
|
||||
explicit CreatureRespawnDeleteWorker(uint32 guid) : i_guid(guid) {}
|
||||
|
||||
void operator() (MapPersistentState* state)
|
||||
{
|
||||
state->SaveCreatureRespawnTime(i_guid, 0);
|
||||
}
|
||||
|
||||
uint32 i_guid;
|
||||
};
|
||||
|
||||
void Creature::DeleteFromDB()
|
||||
{
|
||||
if (!m_DBTableGuid)
|
||||
|
|
@ -1361,9 +1374,7 @@ void Creature::DeleteFromDB()
|
|||
return;
|
||||
}
|
||||
|
||||
// FIXME: this not safe for another map copies can be
|
||||
if (MapPersistentState* save = sMapPersistentStateMgr.GetPersistentState(GetMapId(), GetInstanceId()))
|
||||
save->SaveCreatureRespawnTime(m_DBTableGuid, 0);
|
||||
sMapPersistentStateMgr.DoForAllStatesWithMapId(GetMapId(), CreatureRespawnDeleteWorker(m_DBTableGuid));
|
||||
|
||||
sObjectMgr.DeleteCreatureData(m_DBTableGuid);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue