36 float respX, respY, respZ, respO, destX, destY, destZ, travelDistZ;
43 bool is_air_ok = creature->
CanFly();
45 const float angle = float(
rand_norm()) *
static_cast<float>(
M_PI*2.0f);
47 const float distanceX = range * std::cos(angle);
48 const float distanceY = range * std::sin(angle);
50 destX = respX + distanceX;
51 destY = respY + distanceY;
62 const float distanceZ = float(
rand_norm()) * travelDistZ/2.0f;
63 destZ = respZ + distanceZ;
74 travelDistZ = travelDistZ >= 10.0f ? 10.0f : travelDistZ;
80 if (std::fabs(destZ - respZ) > travelDistZ)
85 if (std::fabs(destZ - respZ) > travelDistZ)
91 if (std::fabs(destZ - respZ) > travelDistZ)
110 init.MoveTo(destX, destY, destZ);
TimeTrackerSmall i_nextMoveTime
Definition: RandomMovementGenerator.h:38
#define M_PI
Definition: Common.h:163
void AddUnitState(uint32 f)
Definition: Unit.h:1394
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2314
Creature * getLeader() const
Definition: CreatureGroups.h:71
float GetWaterOrGroundLevel(float x, float y, float z, float *ground=NULL, bool swim=false) const
Definition: Map.cpp:2296
float wander_distance
Definition: RandomMovementGenerator.h:40
uint32 GetPhaseMask() const
Definition: Object.h:461
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
bool roll_chance_i(int chance)
Definition: Random.h:53
void Reset(uint32 interval)
Definition: Timer.h:153
bool CanFly() const override
Definition: Creature.h:500
void NormalizeMapCoord(float &c)
Definition: GridDefines.h:210
CreatureGroup * GetFormation()
Definition: Creature.h:687
Map const * GetBaseMap() const
Definition: Object.cpp:2199
double rand_norm()
Definition: Random.cpp:69
Definition: MoveSplineInit.h:52
void LeaderMoveTo(float x, float y, float z)
Definition: CreatureGroups.cpp:220
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:672