[8102] Simplify code base at new root method WorldObject::CleanupsBeforeDelete

* Call it from Map::AddObjectToRemoveList and remove now not needed explcit calls
* Create Gameobject version to make GO with owner more safe for remove
This commit is contained in:
VladimirMangos 2009-07-01 11:05:55 +04:00
parent dc10620148
commit 9f41772828
15 changed files with 19 additions and 32 deletions

View file

@ -1337,7 +1337,6 @@ bool ChatHandler::HandleNpcDeleteCommand(const char* args)
// Delete the creature
unit->CombatStop();
unit->DeleteFromDB();
unit->CleanupsBeforeDelete();
unit->AddObjectToRemoveList();
SendSysMessage(LANG_COMMAND_DELCREATMESSAGE);
@ -2783,7 +2782,6 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
{
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
wpCreature->DeleteFromDB();
wpCreature->CleanupsBeforeDelete();
wpCreature->AddObjectToRemoveList();
}
@ -2847,7 +2845,6 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
{
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
wpCreature->DeleteFromDB();
wpCreature->CleanupsBeforeDelete();
wpCreature->AddObjectToRemoveList();
// re-create
Creature* wpCreature2 = new Creature;
@ -3127,7 +3124,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
else
{
pCreature->DeleteFromDB();
pCreature->CleanupsBeforeDelete();
pCreature->AddObjectToRemoveList();
}
@ -3325,7 +3321,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
else
{
pCreature->DeleteFromDB();
pCreature->CleanupsBeforeDelete();
pCreature->AddObjectToRemoveList();
}
}while(result->NextRow());