Cannot use coordinates outside our InhabitType. Use the current or previous position.
Trying to access path outside line of sight. Skip this by using the current or previous position.
31{
32 unit->StopMoving();
33 float const wander_distance = 4;
34 float x = unit->GetPositionX();
35 float y = unit->GetPositionY();
36 float z = unit->GetPositionZ();
37
38 Map const* map = unit->GetMap();
39
40 bool is_water_ok, is_land_ok;
42
44 {
45 float wanderX = x + (wander_distance * (float)
rand_norm() - wander_distance / 2);
46 float wanderY = y + (wander_distance * (float)
rand_norm() - wander_distance / 2);
47
48
51
52 float new_z = unit->GetMapHeight(wanderX, wanderY, z);
54 {
58 continue;
59 }
60 else if (unit->IsWithinLOS(wanderX, wanderY, z))
61 {
62 bool is_water = map->
IsInWater(unit->GetPhaseMask(), wanderX, wanderY, z, unit->GetCollisionHeight());
63
64 if ((is_water && !is_water_ok) || (!is_water && !is_land_ok))
65 {
70 continue;
71 }
72 }
73 else
74 {
79 continue;
80 }
81
82
83
88 }
89
90
91
94
97}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
double rand_norm()
Definition: Random.cpp:77
std::uint8_t uint8
Definition: Define.h:109
#define INVALID_HEIGHT
Definition: Map.h:163
#define MAX_CONF_WAYPOINTS
Definition: ConfusedMovementGenerator.h:24
void NormalizeMapCoord(float &c)
Definition: GridDefines.h:207
bool IsInWater(uint32 phaseMask, float x, float y, float z, float collisionHeight) const
Definition: Map.cpp:2503
float i_waypoints[MAX_CONF_WAYPOINTS+1][3]
Definition: ConfusedMovementGenerator.h:41
bool DoUpdate(T *, uint32)
Definition: ConfusedMovementGenerator.cpp:120
uint32 i_nextMove
Definition: ConfusedMovementGenerator.h:42
void _InitSpecific(T *, bool &, bool &)