*Fix a crash caused by gm command .object move and so on

--HG--
branch : trunk
This commit is contained in:
megamage committed 2009-08-28 14:19:14 -05:00
1 parent 3d9326c4b7
commit 6de6557bf0
5 files changed
+37 -36

No files matched your search

+6 -16
View File
@@ -638,13 +638,10 @@ bool ChatHandler::HandleGameObjectTurnCommand(const char* args)
o = chr->GetOrientation();
}
Map* map = obj->GetMap();
map->Remove(obj,false);
obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o);
obj->UpdateRotationFields();
map->Add(obj);
obj->DestroyForNearbyPlayers();
ObjectAccessor::UpdateObjectVisibility(obj);
obj->SaveToDB();
obj->Refresh();
@@ -686,13 +683,9 @@ bool ChatHandler::HandleGameObjectMoveCommand(const char* args)
if (!px)
{
Player *chr = m_session->GetPlayer();
Map* map = obj->GetMap();
map->Remove(obj,false);
obj->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), obj->GetOrientation());
map->Add(obj);
obj->DestroyForNearbyPlayers();
ObjectAccessor::UpdateObjectVisibility(obj);
}
else
{
@@ -710,12 +703,9 @@ bool ChatHandler::HandleGameObjectMoveCommand(const char* args)
return false;
}
Map* map = obj->GetMap();
map->Remove(obj,false);
obj->Relocate(x, y, z, obj->GetOrientation());
map->Add(obj);
obj->DestroyForNearbyPlayers();
ObjectAccessor::UpdateObjectVisibility(obj);
}
obj->SaveToDB();