diff options
| author | Machiavelli <none@none> | 2010-06-23 00:57:16 +0200 |
|---|---|---|
| committer | Machiavelli <none@none> | 2010-06-23 00:57:16 +0200 |
| commit | d50cb473cbb1ad0e276b6fc31b477a54d37b2255 (patch) | |
| tree | 6ae8d2fd311f861b7c40cfd618d52ba652509a15 /src/server/game/Entities/Object | |
| parent | 1daa1c09f9c03fdc99bafb14886160f13870e277 (diff) | |
Use original taxipath data in taxi flight movement generator. Author: Vladimir
+ Cleanup
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Entities/Object')
| -rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 38356bf8034..e401051b7cb 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -295,7 +295,11 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const { //WPAssert(this->ToPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE); - FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(const_cast<Player*>(this->ToPlayer())->GetMotionMaster()->top()); + Player *player = const_cast<Object*>(this)->ToPlayer(); + if (!player) + return; + + FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(player->GetMotionMaster()->top()); uint32 flags3 = MOVEFLAG_GLIDE; @@ -320,10 +324,10 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const } } - Path &path = fmg->GetPath(); + TaxiPathNodeList& path = const_cast<TaxiPathNodeList&>(fmg->GetPath()); float x, y, z; - this->ToPlayer()->GetPosition(x, y, z); + player->GetPosition(x, y, z); uint32 inflighttime = uint32(path.GetPassedLength(fmg->GetCurrentNode(), x, y, z) * 32); uint32 traveltime = uint32(path.GetTotalLength() * 32); @@ -338,21 +342,21 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const *data << uint32(0); // added in 3.1 - uint32 poscount = uint32(path.Size()); + uint32 poscount = uint32(path.size()); *data << uint32(poscount); // points count for (uint32 i = 0; i < poscount; ++i) { - *data << path.GetNodes()[i].x; - *data << path.GetNodes()[i].y; - *data << path.GetNodes()[i].z; + *data << float(path[i].x); + *data << float(path[i].y); + *data << float(path[i].z); } *data << uint8(0); // added in 3.0.8 - *data << path.GetNodes()[poscount-1].x; - *data << path.GetNodes()[poscount-1].y; - *data << path.GetNodes()[poscount-1].z; + *data << float(path[poscount-1].x); + *data << float(path[poscount-1].y); + *data << float(path[poscount-1].z); } } else |
