aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Level3.cpp3
-rw-r--r--src/game/MotionMaster.cpp5
-rw-r--r--src/game/MotionMaster.h6
-rw-r--r--src/game/Unit.cpp2
-rw-r--r--src/game/Unit.h2
5 files changed, 14 insertions, 4 deletions
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 62dc4ab2bd3..b896164cade 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -5766,7 +5766,10 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
{
MovementGenerator* mg = mm->GetMotionSlot(i);
if(!mg)
+ {
SendSysMessage("Empty");
+ continue;
+ }
switch(mg->GetMovementGeneratorType())
{
case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp
index 551383d985a..5d9059b468d 100644
--- a/src/game/MotionMaster.cpp
+++ b/src/game/MotionMaster.cpp
@@ -392,7 +392,10 @@ void MotionMaster::propagateSpeedChange()
(*it)->unitSpeedChanged();
}*/
for(int i = 0; i <= i_top; ++i)
- Impl[i]->unitSpeedChanged();
+ {
+ if(Impl[i])
+ Impl[i]->unitSpeedChanged();
+ }
}
MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h
index 31694e91420..4d9953c9d15 100644
--- a/src/game/MotionMaster.h
+++ b/src/game/MotionMaster.h
@@ -68,7 +68,11 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *>
void push(_Ty _Val) { ++i_top; Impl[i_top] = _Val; }
public:
- explicit MotionMaster(Unit *unit) : i_owner(unit), i_top(-1) {}
+ explicit MotionMaster(Unit *unit) : i_owner(unit), i_top(-1)
+ {
+ for(int i = 0; i < MAX_MOTION_SLOT; ++i)
+ Impl[i] = NULL;
+ }
~MotionMaster();
void Initialize();
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index be573338a66..c415d0a9d1b 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -12865,7 +12865,7 @@ void Unit::SetFeared(bool apply)
}
else
{
- if(isAlive() && GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE))
+ if(isAlive() && GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE)
GetMotionMaster()->MovementExpired();
}
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 5d5b0d492f6..09c7130c92a 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -367,7 +367,7 @@ enum UnitState
UNIT_STAT_ATTACK_PLAYER = 0x00004000,
UNIT_STAT_CASTING = 0x00008000,
UNIT_STAT_POSSESSED = 0x00010000,
- UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING),
+ UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FOLLOW),
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING),
UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING),