*Implement spell casting on transports (no more out of range error, etc)

*Add MO transports to ObjectAccessor storage
*Add functions Position::RelocateOffset and Position::GetPositionOffsetTo to help offset manipulations - BIG thanks to azazelkon for creating formulas!
*Add function to output debug info for MovementInfo and SpellCastTargets
*Throw ByteBufferException on incorrect packGUID read
*Add rfinish function to finish bytebuffer read.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-08-08 20:32:14 +02:00
parent 48c4d4551c
commit 617a56ba29
19 changed files with 434 additions and 235 deletions
+15 -1
View File
@@ -31,6 +31,7 @@
#include <set>
#include <string>
#include <sstream>
#define CONTACT_DISTANCE 0.5f
#define INTERACTION_DISTANCE 5.0f
@@ -396,6 +397,7 @@ struct Position
{ m_positionX = pos.m_positionX; m_positionY = pos.m_positionY; m_positionZ = pos.m_positionZ; m_orientation = pos.m_orientation; }
void Relocate(const Position *pos)
{ m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; m_orientation = pos->m_orientation; }
void RelocateOffset(const Position &offset);
void SetOrientation(float orientation)
{ m_orientation = orientation; }
@@ -444,6 +446,8 @@ struct Position
float GetExactDist(const Position *pos) const
{ return sqrt(GetExactDistSq(pos)); }
void GetPositionOffsetTo(const Position & endPos, Position & retOffset) const;
float GetAngle(const Position *pos) const;
float GetAngle(float x, float y) const;
float GetRelativeAngle(const Position *pos) const
@@ -461,6 +465,7 @@ struct Position
{ return GetExactDistSq(pos) < dist * dist; }
bool HasInArc(float arcangle, const Position *pos) const;
bool HasInLine(const Unit *target, float distance, float width) const;
std::string ToString() const;
};
ByteBuffer &operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const & streamer);
ByteBuffer & operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const & streamer);
@@ -507,6 +512,7 @@ struct MovementInfo
uint32 GetMovementFlags() { return flags; }
void AddMovementFlag(uint32 flag) { flags |= flag; }
bool HasMovementFlag(uint32 flag) const { return flags & flag; }
void OutDebug();
};
#define MAPID_INVALID 0xFFFFFFFF
@@ -536,6 +542,8 @@ class GridObject
class WorldObject : public Object, public WorldLocation
{
protected:
explicit WorldObject();
public:
virtual ~WorldObject();
@@ -767,11 +775,17 @@ class WorldObject : public Object, public WorldLocation
// Transports
Transport *GetTransport() const { return m_transport; }
virtual float GetTransOffsetX() const { return 0; }
virtual float GetTransOffsetY() const { return 0; }
virtual float GetTransOffsetZ() const { return 0; }
virtual float GetTransOffsetO() const { return 0; }
virtual uint32 GetTransTime() const { return 0; }
virtual int8 GetTransSeat() const { return -1; }
virtual uint64 GetTransGUID() const;
void SetTransport(Transport *t) { m_transport = t; }
MovementInfo m_movementInfo;
protected:
explicit WorldObject();
std::string m_name;
bool m_isActive;
ZoneScript *m_zoneScript;