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.
33{
34 unit->StopMoving();
35 float const wander_distance = 4;
36 float x = unit->GetPositionX();
37 float y = unit->GetPositionY();
38 float z = unit->GetPositionZ();
39
40 Map const* map = unit->GetMap();
41
42 bool is_water_ok, is_land_ok;
44
46 {
47 float wanderX = x + (wander_distance * (float)
rand_norm() - wander_distance / 2);
48 float wanderY = y + (wander_distance * (float)
rand_norm() - wander_distance / 2);
49
50
53
54 float new_z = unit->GetMapHeight(wanderX, wanderY, z);
56 {
60 continue;
61 }
62 else if (unit->IsWithinLOS(wanderX, wanderY, z))
63 {
64 bool is_water = map->
IsInWater(unit->GetPhaseMask(), wanderX, wanderY, z, unit->GetCollisionHeight());
65
66 if ((is_water && !is_water_ok) || (!is_water && !is_land_ok))
67 {
72 continue;
73 }
74 }
75 else
76 {
81 continue;
82 }
83
84
85
90 }
91
92
93
96
99}
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:165
#define MAX_CONF_WAYPOINTS
Definition: ConfusedMovementGenerator.h:24
void NormalizeMapCoord(float &c)
Definition: GridDefines.h:208
bool IsInWater(uint32 phaseMask, float x, float y, float z, float collisionHeight) const
Definition: Map.cpp:2500
float i_waypoints[MAX_CONF_WAYPOINTS+1][3]
Definition: ConfusedMovementGenerator.h:41
bool DoUpdate(T *, uint32)
Definition: ConfusedMovementGenerator.cpp:122
uint32 i_nextMove
Definition: ConfusedMovementGenerator.h:42
void _InitSpecific(T *, bool &, bool &)