*Fix some bugs about movement.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-17 13:29:26 -06:00
parent f414ab1686
commit 88fd745532
5 changed files with 14 additions and 4 deletions
+3
View File
@@ -5766,7 +5766,10 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
{ {
MovementGenerator* mg = mm->GetMotionSlot(i); MovementGenerator* mg = mm->GetMotionSlot(i);
if(!mg) if(!mg)
{
SendSysMessage("Empty"); SendSysMessage("Empty");
continue;
}
switch(mg->GetMovementGeneratorType()) switch(mg->GetMovementGeneratorType())
{ {
case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break; case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
+3
View File
@@ -392,8 +392,11 @@ void MotionMaster::propagateSpeedChange()
(*it)->unitSpeedChanged(); (*it)->unitSpeedChanged();
}*/ }*/
for(int i = 0; i <= i_top; ++i) for(int i = 0; i <= i_top; ++i)
{
if(Impl[i])
Impl[i]->unitSpeedChanged(); Impl[i]->unitSpeedChanged();
} }
}
MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
{ {
+5 -1
View File
@@ -68,7 +68,11 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *>
void push(_Ty _Val) { ++i_top; Impl[i_top] = _Val; } void push(_Ty _Val) { ++i_top; Impl[i_top] = _Val; }
public: 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(); ~MotionMaster();
void Initialize(); void Initialize();
+1 -1
View File
@@ -12865,7 +12865,7 @@ void Unit::SetFeared(bool apply)
} }
else else
{ {
if(isAlive() && GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE)) if(isAlive() && GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE)
GetMotionMaster()->MovementExpired(); GetMotionMaster()->MovementExpired();
} }
+1 -1
View File
@@ -367,7 +367,7 @@ enum UnitState
UNIT_STAT_ATTACK_PLAYER = 0x00004000, UNIT_STAT_ATTACK_PLAYER = 0x00004000,
UNIT_STAT_CASTING = 0x00008000, UNIT_STAT_CASTING = 0x00008000,
UNIT_STAT_POSSESSED = 0x00010000, 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_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_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING),
UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING), UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING),