diff options
author | megamage <none@none> | 2009-01-17 13:29:26 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-01-17 13:29:26 -0600 |
commit | 88fd7455323b0e58ea2b808510d8c7e5aa1cd599 (patch) | |
tree | 51e263ecf2ef47c64a8f7664598c7d8ba5007095 | |
parent | f414ab1686c300787e3dfb0c397227062b8feea6 (diff) |
*Fix some bugs about movement.
--HG--
branch : trunk
-rw-r--r-- | src/game/Level3.cpp | 3 | ||||
-rw-r--r-- | src/game/MotionMaster.cpp | 5 | ||||
-rw-r--r-- | src/game/MotionMaster.h | 6 | ||||
-rw-r--r-- | src/game/Unit.cpp | 2 | ||||
-rw-r--r-- | src/game/Unit.h | 2 |
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), |