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_TARGETEDMOVEMENTGENERATOR_H
20 #define MANGOS_TARGETEDMOVEMENTGENERATOR_H
22 #include "MovementGenerator.h"
23 #include "DestinationHolder.h"
24 #include "Traveller.h"
25 #include "FollowerReference.h"
27 class MANGOS_DLL_SPEC TargetedMovementGeneratorBase
30 TargetedMovementGeneratorBase(Unit
&target
) { i_target
.link(&target
, this); }
31 void stopFollowing() { }
33 FollowerReference i_target
;
37 class MANGOS_DLL_SPEC TargetedMovementGenerator
38 : public MovementGeneratorMedium
< T
, TargetedMovementGenerator
<T
> >, public TargetedMovementGeneratorBase
42 TargetedMovementGenerator(Unit
&target
)
43 : TargetedMovementGeneratorBase(target
), i_offset(0), i_angle(0), i_recalculateTravel(false) {}
44 TargetedMovementGenerator(Unit
&target
, float offset
, float angle
)
45 : TargetedMovementGeneratorBase(target
), i_offset(offset
), i_angle(angle
), i_recalculateTravel(false) {}
46 ~TargetedMovementGenerator() {}
51 bool Update(T
&, const uint32
&);
52 MovementGeneratorType
GetMovementGeneratorType() { return TARGETED_MOTION_TYPE
; }
54 Unit
* GetTarget() const;
56 bool GetDestination(float &x
, float &y
, float &z
) const
58 if(!i_destinationHolder
.HasDestination()) return false;
59 i_destinationHolder
.GetDestination(x
,y
,z
);
63 void unitSpeedChanged() { i_recalculateTravel
=true; }
66 void _setTargetLocation(T
&);
70 DestinationHolder
< Traveller
<T
> > i_destinationHolder
;
71 bool i_recalculateTravel
;