diff --git a/src/game/MotionGenerators/RandomMovementGenerator.cpp b/src/game/MotionGenerators/RandomMovementGenerator.cpp index 29b90807..f465c481 100644 --- a/src/game/MotionGenerators/RandomMovementGenerator.cpp +++ b/src/game/MotionGenerators/RandomMovementGenerator.cpp @@ -30,6 +30,17 @@ #include "movement/MoveSplineInit.h" #include "movement/MoveSpline.h" +template<> +RandomMovementGenerator::RandomMovementGenerator(float x, float y, float z, float radius, float verticalZ) : + i_nextMoveTime(0), i_x(x), i_y(y), i_z(z), i_radius(radius), i_verticalZ(verticalZ) +{ + if (radius < 0.1f) + { + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "RandomMovementGenerator constructor: wrong value for spawn distance. Set to 0.1f"); + i_radius = 0.1f; + } +} + template<> RandomMovementGenerator::RandomMovementGenerator(const Creature& creature) { diff --git a/src/game/MotionGenerators/RandomMovementGenerator.h b/src/game/MotionGenerators/RandomMovementGenerator.h index bb9f9da3..777df8fc 100644 --- a/src/game/MotionGenerators/RandomMovementGenerator.h +++ b/src/game/MotionGenerators/RandomMovementGenerator.h @@ -36,8 +36,7 @@ class RandomMovementGenerator { public: explicit RandomMovementGenerator(const Creature&); - explicit RandomMovementGenerator(float x, float y, float z, float radius, float verticalZ = 0.0f) : - i_nextMoveTime(0), i_x(x), i_y(y), i_z(z), i_radius(radius), i_verticalZ(verticalZ) {} + explicit RandomMovementGenerator(float x, float y, float z, float radius, float verticalZ = 0.0f); void _setRandomLocation(T&); void Initialize(T&); diff --git a/src/game/WorldHandlers/Map.cpp b/src/game/WorldHandlers/Map.cpp index ff1f4163..f40d1a86 100644 --- a/src/game/WorldHandlers/Map.cpp +++ b/src/game/WorldHandlers/Map.cpp @@ -2280,21 +2280,19 @@ bool Map::GetReachableRandomPosition(Unit* unit, float& x, float& y, float& z, f isSwimming = static_cast(unit)->IsSwimming(); break; default: - sLog.outError("Map::GetReachableRandomPosition> Unsupported unit type is passed!"); + sLog.outError("Map::GetReachableRandomPosition> Unsupported unit (%s) is passed!", unit->GetGuidStr().c_str()); return false; } if (radius < 0.1f) { - sLog.outError("Map::GetReachableRandomPosition> Unsupported unit type is passed!"); + sLog.outError("Map::GetReachableRandomPosition> Invalid radius (%f) for %s", radius, unit->GetGuidStr().c_str()); return false; } if (isFlying) { newDestAssigned = GetRandomPointInTheAir(i_x, i_y, i_z, radius); - /*if (newDestAssigned) - sLog.outString("Generating air random point for %s", GetGuidStr().c_str());*/ } else { @@ -2303,14 +2301,10 @@ bool Map::GetReachableRandomPosition(Unit* unit, float& x, float& y, float& z, f if (isSwimming && (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER))) { newDestAssigned = GetRandomPointUnderWater(i_x, i_y, i_z, radius, liquid_status); - /*if (newDestAssigned) - sLog.outString("Generating swim random point for %s", GetGuidStr().c_str());*/ } else { newDestAssigned = GetReachableRandomPointOnGround(i_x, i_y, i_z, radius); - /*if (newDestAssigned) - sLog.outString("Generating ground random point for %s", GetGuidStr().c_str());*/ } } diff --git a/src/shared/revision.h b/src/shared/revision.h index d97a34bd..0f4f4f0a 100644 --- a/src/shared/revision.h +++ b/src/shared/revision.h @@ -38,6 +38,6 @@ #define WORLD_DB_VERSION_NR 21 #define WORLD_DB_STRUCTURE_NR 3 - #define WORLD_DB_CONTENT_NR 1 - #define WORLD_DB_UPDATE_DESCRIPTION "Fix SoR paladin" + #define WORLD_DB_CONTENT_NR 2 + #define WORLD_DB_UPDATE_DESCRIPTION "Fix Random MMGen Scripts" #endif // __REVISION_H__