diff options
Diffstat (limited to 'src/game/Traveller.h')
-rw-r--r-- | src/game/Traveller.h | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/game/Traveller.h b/src/game/Traveller.h index 279af30428a..c77be90e38a 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -17,19 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef TRINITY_TRAVELLER_H #define TRINITY_TRAVELLER_H - #include "Creature.h" #include "Player.h" #include <cassert> - /** Traveller is a wrapper for units (creatures or players) that * travel from point A to point B using the destination holder. */ #define PLAYER_FLIGHT_SPEED 32.0f - template<class T> struct TRINITY_DLL_DECL Traveller { @@ -42,23 +38,19 @@ struct TRINITY_DLL_DECL Traveller new (this) Traveller(obj); return *this; } - operator T&(void) { return i_traveller; } operator const T&(void) { return i_traveller; } float GetPositionX() const { return i_traveller.GetPositionX(); } float GetPositionY() const { return i_traveller.GetPositionY(); } float GetPositionZ() const { return i_traveller.GetPositionZ(); } T& GetTraveller(void) { return i_traveller; } - float Speed(void) { assert(false); return 0.0f; } float GetMoveDestinationTo(float x, float y, float z); uint32 GetTotalTrevelTimeTo(float x, float y, float z); - void Relocation(float x, float y, float z, float orientation) {} void Relocation(float x, float y, float z) { Relocation(x, y, z, i_traveller.GetOrientation()); } void MoveTo(float x, float y, float z, uint32 t) {} }; - template<class T> inline uint32 Traveller<T>::GetTotalTrevelTimeTo(float x, float y, float z) { @@ -70,7 +62,6 @@ inline uint32 Traveller<T>::GetTotalTrevelTimeTo(float x, float y, float z) speed *= 0.001f; // speed is in seconds so convert from second to millisecond return static_cast<uint32>(dist/speed); } - // specialization for creatures template<> inline float Traveller<Creature>::Speed() @@ -84,34 +75,29 @@ inline float Traveller<Creature>::Speed() else return i_traveller.GetSpeed(MOVE_RUN); } - template<> inline void Traveller<Creature>::Relocation(float x, float y, float z, float orientation) { i_traveller.GetMap()->CreatureRelocation(&i_traveller, x, y, z, orientation); } - template<> inline float Traveller<Creature>::GetMoveDestinationTo(float x, float y, float z) { float dx = x - GetPositionX(); float dy = y - GetPositionY(); float dz = z - GetPositionZ(); - //if(i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_FLYING)) return sqrt((dx*dx) + (dy*dy) + (dz*dz)); //else //Walking on the ground // return sqrt((dx*dx) + (dy*dy)); } - template<> inline void Traveller<Creature>::MoveTo(float x, float y, float z, uint32 t) { //i_traveller.AI_SendMoveToPacket(x, y, z, t, i_traveller.GetUnitMovementFlags(), 0); i_traveller.SendMonsterMove(x, y, z, t); } - // specialization for players template<> inline float Traveller<Player>::Speed() @@ -123,33 +109,28 @@ inline float Traveller<Player>::Speed() else return i_traveller.GetSpeed(i_traveller.m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALK_MODE) ? MOVE_WALK : MOVE_RUN); } - template<> inline float Traveller<Player>::GetMoveDestinationTo(float x, float y, float z) { float dx = x - GetPositionX(); float dy = y - GetPositionY(); float dz = z - GetPositionZ(); - //if (i_traveller.isInFlight()) return sqrt((dx*dx) + (dy*dy) + (dz*dz)); //else //Walking on the ground // return sqrt((dx*dx) + (dy*dy)); } - template<> inline void Traveller<Player>::Relocation(float x, float y, float z, float orientation) { i_traveller.GetMap()->PlayerRelocation(&i_traveller, x, y, z, orientation); } - template<> inline void Traveller<Player>::MoveTo(float x, float y, float z, uint32 t) { //Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags i_traveller.SendMonsterMove(x, y, z, t); } - typedef Traveller<Creature> CreatureTraveller; typedef Traveller<Player> PlayerTraveller; #endif |