| 1 | /* |
|---|
| 2 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
|---|
| 3 | * |
|---|
| 4 | * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef TRINITY_POINTMOVEMENTGENERATOR_H |
|---|
| 22 | #define TRINITY_POINTMOVEMENTGENERATOR_H |
|---|
| 23 | |
|---|
| 24 | #include "MovementGenerator.h" |
|---|
| 25 | #include "DestinationHolder.h" |
|---|
| 26 | #include "Traveller.h" |
|---|
| 27 | #include "FollowerReference.h" |
|---|
| 28 | |
|---|
| 29 | template<class T> |
|---|
| 30 | class TRINITY_DLL_SPEC PointMovementGenerator |
|---|
| 31 | : public MovementGeneratorMedium< T, PointMovementGenerator<T> > |
|---|
| 32 | { |
|---|
| 33 | public: |
|---|
| 34 | PointMovementGenerator(uint32 _id, float _x, float _y, float _z) : id(_id), |
|---|
| 35 | i_x(_x), i_y(_y), i_z(_z), i_nextMoveTime(0) {} |
|---|
| 36 | |
|---|
| 37 | void Initialize(T &); |
|---|
| 38 | void Finalize(T &){} |
|---|
| 39 | void Reset(T &unit){unit.StopMoving();} |
|---|
| 40 | bool Update(T &, const uint32 &diff); |
|---|
| 41 | |
|---|
| 42 | void MovementInform(T &); |
|---|
| 43 | |
|---|
| 44 | MovementGeneratorType GetMovementGeneratorType() { return POINT_MOTION_TYPE; } |
|---|
| 45 | |
|---|
| 46 | bool GetDestination(float& x, float& y, float& z) const { x=i_x; y=i_y; z=i_z; return true; } |
|---|
| 47 | private: |
|---|
| 48 | TimeTracker i_nextMoveTime; |
|---|
| 49 | float i_x,i_y,i_z; |
|---|
| 50 | uint32 id; |
|---|
| 51 | DestinationHolder< Traveller<T> > i_destinationHolder; |
|---|
| 52 | }; |
|---|
| 53 | #endif |
|---|