[6922] Whitespace and newline fixes
[getmangos.git] / src / game / MotionMaster.h
blobb4a19cd86f16227aa651c8dc84d78a3e79c3b78f
1 /*
2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOS_MOTIONMASTER_H
20 #define MANGOS_MOTIONMASTER_H
22 #include "Common.h"
23 #include <stack>
25 class MovementGenerator;
26 class Unit;
28 // Creature Entry ID used for waypoints show, visible only for GMs
29 #define VISUAL_WAYPOINT 1
31 // values 0 ... MAX_DB_MOTION_TYPE-1 used in DB
32 enum MovementGeneratorType
34 IDLE_MOTION_TYPE = 0, // IdleMovementGenerator.h
35 RANDOM_MOTION_TYPE = 1, // RandomMovementGenerator.h
36 WAYPOINT_MOTION_TYPE = 2, // WaypointMovementGenerator.h
37 MAX_DB_MOTION_TYPE = 3, // *** this and below motion types can't be set in DB.
38 ANIMAL_RANDOM_MOTION_TYPE = MAX_DB_MOTION_TYPE, // AnimalRandomMovementGenerator.h
39 CONFUSED_MOTION_TYPE = 4, // ConfusedMovementGenerator.h
40 TARGETED_MOTION_TYPE = 5, // TargetedMovementGenerator.h
41 HOME_MOTION_TYPE = 6, // HomeMovementGenerator.h
42 FLIGHT_MOTION_TYPE = 7, // WaypointMovementGenerator.h
43 POINT_MOTION_TYPE = 8, // PointMovementGenerator.h
44 FLEEING_MOTION_TYPE = 9, // FleeingMovementGenerator.h
45 DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h
48 class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
50 private:
51 typedef std::stack<MovementGenerator *> Impl;
52 public:
54 explicit MotionMaster(Unit *unit) : i_owner(unit) {}
55 ~MotionMaster();
57 void Initialize();
59 MovementGenerator* operator->(void) { return top(); }
61 using Impl::top;
62 using Impl::empty;
64 typedef Impl::container_type::const_iterator const_iterator;
65 const_iterator begin() const { return Impl::c.begin(); }
66 const_iterator end() const { return Impl::c.end(); }
68 void UpdateMotion(const uint32 &diff);
69 void Clear(bool reset = true);
70 void MovementExpired(bool reset = true);
72 void MoveIdle();
73 void MoveTargetedHome();
74 void MoveFollow(Unit* target, float dist, float angle);
75 void MoveChase(Unit* target, float dist = 0.0f, float angle = 0.0f);
76 void MoveConfused();
77 void MoveFleeing(Unit* enemy);
78 void MovePoint(uint32 id, float x,float y,float z);
79 void MoveTaxiFlight(uint32 path, uint32 pathnode);
80 void MoveDistract(uint32 time);
82 MovementGeneratorType GetCurrentMovementGeneratorType() const;
84 void propagateSpeedChange();
86 bool GetDestination(float &x, float &y, float &z);
87 private:
88 void Mutate(MovementGenerator *m); // use Move* functions instead
90 Unit *i_owner;
92 #endif