diff options
author | maximius <none@none> | 2009-10-17 15:51:44 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-10-17 15:51:44 -0700 |
commit | e585187b248f48b3c6e9247b49fa07c6565d65e5 (patch) | |
tree | 637c5b7ddacf41040bef4ea4f75a97da64c6a9bc /src/game/WaypointMovementGenerator.h | |
parent | 26b5e033ffde3d161382fc9addbfa99738379641 (diff) |
*Backed out changeset 3be01fb200a5
--HG--
branch : trunk
Diffstat (limited to 'src/game/WaypointMovementGenerator.h')
-rw-r--r-- | src/game/WaypointMovementGenerator.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index 1f0f0b9e2e0..4e64229b524 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -17,45 +17,58 @@ * 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_WAYPOINTMOVEMENTGENERATOR_H #define TRINITY_WAYPOINTMOVEMENTGENERATOR_H + /** @page PathMovementGenerator is used to generate movements * of waypoints and flight paths. Each serves the purpose * of generate activities so that it generates updated * packets for the players. */ + #include "MovementGenerator.h" #include "DestinationHolder.h" #include "WaypointManager.h" #include "Path.h" #include "Traveller.h" + #include "Player.h" + #include <vector> #include <set> + #define FLIGHT_TRAVEL_UPDATE 100 #define STOP_TIME_FOR_PLAYER 3 * MINUTE * IN_MILISECONDS // 3 Minutes + template<class T, class P = Path> class TRINITY_DLL_SPEC PathMovementBase { public: PathMovementBase() : i_currentNode(0) {} virtual ~PathMovementBase() {}; + bool MovementInProgress(void) const { return i_currentNode < i_path.Size(); } + void LoadPath(T &); void ReloadPath(T &); uint32 GetCurrentNode() const { return i_currentNode; } + protected: uint32 i_currentNode; DestinationHolder< Traveller<T> > i_destinationHolder; P i_path; }; + template<class T> + class TRINITY_DLL_SPEC WaypointMovementGenerator : public MovementGeneratorMedium< T, WaypointMovementGenerator<T> >, public PathMovementBase<T> { public: WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : i_nextMoveTime(0), path_id(_path_id), repeating(_repeating), StopedByPlayer(false), node(NULL) {} + void Initialize(T &); void Finalize(T &); void MovementInform(T &); @@ -65,6 +78,7 @@ class TRINITY_DLL_SPEC WaypointMovementGenerator bool Update(T &, const uint32 &); bool GetDestination(float &x, float &y, float &z) const; MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; } + private: WaypointData *node; uint32 path_id; @@ -72,6 +86,7 @@ class TRINITY_DLL_SPEC WaypointMovementGenerator WaypointPath *waypoints; bool repeating, StopedByPlayer; }; + /** FlightPathMovementGenerator generates movement of the player for the paths * and hence generates ground and activities for the player. */ @@ -88,14 +103,17 @@ public PathMovementBase<Player> void Reset(Player &) {} bool Update(Player &, const uint32 &); MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; } + void LoadPath(Player &); void ReloadPath(Player &) { /* don't reload flight path */ } + Path& GetPath() { return i_path; } uint32 GetPathAtMapEnd() const; bool HasArrived() const { return (i_currentNode >= i_path.Size()); } void SetCurrentNodeAfterTeleport(); void SkipCurrentNode() { ++i_currentNode; } bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; } + private: // storage for preloading the flightmaster grid at end // before reaching final waypoint |