Skip to content

Commit

Permalink
[9568] Add function to manually start random movement.
Browse files Browse the repository at this point in the history
Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
NoFantasy committed Mar 10, 2010
1 parent 44561df commit 73ba284
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/game/MotionMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "PointMovementGenerator.h"
#include "TargetedMovementGenerator.h"
#include "WaypointMovementGenerator.h"
#include "RandomMovementGenerator.h"

#include <cassert>

Expand Down Expand Up @@ -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<Creature>(*i_owner));
}
}

void
MotionMaster::MoveTargetedHome()
{
Expand Down
1 change: 1 addition & 0 deletions src/game/MotionMaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
}

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);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9567"
#define REVISION_NR "9568"
#endif // __REVISION_NR_H__

0 comments on commit 73ba284

Please sign in to comment.