From 5a86a332ebfefea243dd835f9f88a28796f46b1b Mon Sep 17 00:00:00 2001 From: Olion Date: Sun, 17 May 2015 20:17:26 +0100 Subject: [PATCH] [Core] Fix NPC's running to the first waypoint --- src/game/Object/Object.cpp | 12 ++++++------ src/game/Object/Unit.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/game/Object/Object.cpp b/src/game/Object/Object.cpp index 023a4f2e..4ab78a34 100644 --- a/src/game/Object/Object.cpp +++ b/src/game/Object/Object.cpp @@ -262,11 +262,11 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint8 updateFlags) const moveFlags |= MOVEFLAG_ONTRANSPORT; } - //float x, y, z; - //if (m_objectTypeId == TYPEID_UNIT && ((Unit*)this)->GetMotionMaster()->GetDestination(x, y, z)) - //{ - // moveFlags |= MOVEFLAG_WALK_MODE | MOVEFLAG_FORWARD | MOVEFLAG_SPLINE_ENABLED; - //} + float x; // not used anywhere + if (m_objectTypeId == TYPEID_UNIT && ((Unit*)this)->movespline && ((Unit*)this)->GetMotionMaster()->GetDestination(x, x, x)) + { + moveFlags |= MOVEFLAG_WALK_MODE | MOVEFLAG_FORWARD | MOVEFLAG_SPLINE_ENABLED; + } *data << uint32(moveFlags); // movement flags *data << uint32(WorldTimer::getMSTime()); // time (in milliseconds) @@ -327,7 +327,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint8 updateFlags) const if (m_objectTypeId == TYPEID_UNIT) { - if (moveFlags & MOVEFLAG_SPLINE_ENABLED) // 0x00400000 + if (moveFlags & MOVEFLAG_SPLINE_ENABLED && ((Unit*)this)->movespline) // 0x00400000 { Movement::PacketBuilder::WriteCreate((*((Unit*)this)->movespline), *data); } diff --git a/src/game/Object/Unit.h b/src/game/Object/Unit.h index 2f680fed..f506b337 100644 --- a/src/game/Object/Unit.h +++ b/src/game/Object/Unit.h @@ -593,13 +593,13 @@ enum MovementFlags MOVEFLAG_FALLING = 0x00002000, MOVEFLAG_FALLINGFAR = 0x00004000, MOVEFLAG_SWIMMING = 0x00200000, // appears with fly flag also - MOVEFLAG_ASCENDING = 0x00400000, // [-ZERO] is it really need and correct value + MOVEFLAG_SPLINE_ENABLED = 0x00400000, MOVEFLAG_CAN_FLY = 0x00800000, // [-ZERO] is it really need and correct value MOVEFLAG_FLYING = 0x01000000, // [-ZERO] is it really need and correct value MOVEFLAG_ONTRANSPORT = 0x02000000, // Used for flying on some creatures - MOVEFLAG_SPLINE_ELEVATION = 0x04000000, // used for flight paths - MOVEFLAG_SPLINE_ENABLED = 0x08000000, // used for flight paths + MOVEFLAG_SPLINE_ELEVATION = 0x04000000, // [-ZERO] checkme! used for flight paths + //MOVEFLAG_SPLINE_ENABLED = 0x08000000, // [-ZERO] wrong! MOVEFLAG_WATERWALKING = 0x10000000, // prevent unit from falling through water MOVEFLAG_SAFE_FALL = 0x20000000, // active rogue safe fall spell (passive) MOVEFLAG_HOVER = 0x40000000