[7489] Update gameobject rotation fields if need.

* Fixed update absent in ".gobject turn" command
* Propetly set rotation fields for summoned objects
* Check rotation/coordinates fields values at server loading
This commit is contained in:
VladimirMangos 2009-03-18 20:48:22 +03:00
parent 071a24562a
commit 7589bf7263
6 changed files with 54 additions and 45 deletions

View file

@ -1787,17 +1787,11 @@ bool ChatHandler::HandleTurnObjectCommand(const char* args)
o = chr->GetOrientation();
}
float rot2 = sin(o/2);
float rot3 = cos(o/2);
Map* map = obj->GetMap();
map->Remove(obj,false);
obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o);
obj->SetFloatValue(GAMEOBJECT_FACING, o);
obj->SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rot2);
obj->SetFloatValue(GAMEOBJECT_PARENTROTATION+3, rot3);
obj->UpdateRotationFields();
map->Add(obj);
@ -3660,13 +3654,10 @@ bool ChatHandler::HandleGameObjectCommand(const char* args)
float o = float(chr->GetOrientation());
Map *map = chr->GetMap();
float rot2 = sin(o/2);
float rot3 = cos(o/2);
GameObject* pGameObj = new GameObject;
uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT);
if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0, 0, rot2, rot3, 0, 1))
if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, 1))
{
delete pGameObj;
return false;