From 45cc830eaeb4911622eacda96962f39d268da6e9 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Thu, 11 Mar 2010 00:46:40 +0100 Subject: [PATCH] [9568] Add function to manually start random movement. Signed-off-by: NoFantasy --- src/game/MotionMaster.cpp | 14 ++++++++++++++ src/game/MotionMaster.h | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index 5e473f142..b02188278 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -28,6 +28,7 @@ #include "PointMovementGenerator.h" #include "TargetedMovementGenerator.h" #include "WaypointMovementGenerator.h" +#include "RandomMovementGenerator.h" #include @@ -209,6 +210,19 @@ void MotionMaster::MoveIdle() push(&si_idleMovement); } +void MotionMaster::MoveRandom() +{ + if (i_owner->GetTypeId() == TYPEID_PLAYER) + { + sLog.outError("Player (GUID: %u) attempt to move random.", i_owner->GetGUIDLow()); + } + else + { + DEBUG_LOG("Creature (Entry: %u GUID: %u) move random.", i_owner->GetEntry(), i_owner->GetGUIDLow()); + Mutate(new RandomMovementGenerator(*i_owner)); + } +} + void MotionMaster::MoveTargetedHome() { diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h index 5ed08f72c..139387a71 100644 --- a/src/game/MotionMaster.h +++ b/src/game/MotionMaster.h @@ -95,6 +95,7 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack } void MoveIdle(); + void MoveRandom(); void MoveTargetedHome(); void MoveFollow(Unit* target, float dist, float angle); void MoveChase(Unit* target, float dist = 0.0f, float angle = 0.0f); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d141711e6..81fd4d4bd 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9567" + #define REVISION_NR "9568" #endif // __REVISION_NR_H__