Delete obj if it is not successfully added to grid. More to fix.
This commit is contained in:
1 parent
cde7ea260e
commit
529af3cd09
12 files changed
+79
-42
No files matched your search
@@ -578,8 +578,13 @@ public:
|
||||
|
||||
wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
||||
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
||||
wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map);
|
||||
map->AddToMap(wpCreature2);
|
||||
//TODO: Should we first use "Create" then use "LoadFromDB"?
|
||||
if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetDBTableGUIDLow(), map))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
|
||||
delete wpCreature2;
|
||||
return false;
|
||||
}
|
||||
//sMapMgr->GetMap(npcCreature->GetMapId())->Add(wpCreature2);
|
||||
}
|
||||
|
||||
@@ -777,8 +782,12 @@ public:
|
||||
|
||||
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
||||
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
||||
wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(), map);
|
||||
map->AddToMap(wpCreature);
|
||||
if (!wpCreature->LoadCreatureFromDB(wpCreature->GetDBTableGUIDLow(), map))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||
delete wpCreature;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
@@ -824,8 +833,12 @@ public:
|
||||
}
|
||||
|
||||
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
||||
creature->LoadFromDB(creature->GetDBTableGUIDLow(), map);
|
||||
map->AddToMap(creature);
|
||||
if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||
delete creature;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
@@ -872,8 +885,12 @@ public:
|
||||
}
|
||||
|
||||
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
|
||||
creature->LoadFromDB(creature->GetDBTableGUIDLow(), map);
|
||||
map->AddToMap(creature);
|
||||
if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
|
||||
delete creature;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user