void MotionMaster::UpdateMotion(uint32 diff) { if (i_owner->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) // what about UNIT_STAT_DISTRACTED? Why is this not included? return; ASSERT(!empty()); m_cleanFlag |= MMCF_UPDATE; if (!top()->Update(*i_owner, diff)) { m_cleanFlag &= ~MMCF_UPDATE; MovementExpired(); } else m_cleanFlag &= ~MMCF_UPDATE; if (m_expList) { for (size_t i = 0; i < m_expList->size(); ++i) { MovementGenerator* mg = (*m_expList)[i]; DirectDelete(mg); } delete m_expList; m_expList = NULL; if (empty()) Initialize(); else if (needInitTop()) InitTop(); else if (m_cleanFlag & MMCF_RESET) top()->Reset(*i_owner); m_cleanFlag &= ~MMCF_RESET; } }
void MotionMaster::DirectClean(bool reset) { while (size() > 1) { MovementGenerator *curr = top(); pop(); if (curr) DirectDelete(curr); } if (needInitTop()) InitTop(); else if (reset) top()->Reset(*_owner); }
void MotionMaster::UpdateMotion(uint32 diff) { if (!_owner) return; // zhang hong chao add flee condition if (_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED) && GetCurrentMovementGeneratorType() != ASSISTANCE_MOTION_TYPE && GetCurrentMovementGeneratorType() != TIMED_FLEEING_MOTION_TYPE && GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE) { // what about UNIT_STATE_DISTRACTED? Why is this not included? return; } ASSERT(!empty()); _cleanFlag |= MMCF_UPDATE; if (!top()->Update(_owner, diff)) { _cleanFlag &= ~MMCF_UPDATE; MovementExpired(); } else _cleanFlag &= ~MMCF_UPDATE; if (_expList) { for (size_t i = 0; i < _expList->size(); ++i) { MovementGenerator* mg = (*_expList)[i]; DirectDelete(mg); } delete _expList; _expList = NULL; if (empty()) Initialize(); else if (needInitTop()) InitTop(); else if (_cleanFlag & MMCF_RESET) top()->Reset(_owner); _cleanFlag &= ~MMCF_RESET; } // probably not the best place to pu this but im not really sure where else to put it. _owner->UpdateUnderwaterState(_owner->GetMap(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); }
void MotionMaster::DirectExpire(bool reset) { if (size() > 1) { MovementGenerator *curr = top(); pop(); removeEmptyTops(); DirectDelete(curr); } while (!top()) --i_top; if (empty()) Initialize(); else if (needInitTop()) InitTop(); else if (reset) top()->Reset(*i_owner); }
void MotionMaster::UpdateMotion(uint32 diff) { if (!_owner) return; if (_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) // what about UNIT_STATE_DISTRACTED? Why is this not included? return; ASSERT(!empty()); _cleanFlag |= MMCF_UPDATE; if (!top()->Update(_owner, diff)) { _cleanFlag &= ~MMCF_UPDATE; MovementExpired(); } else _cleanFlag &= ~MMCF_UPDATE; if (!_expList.empty()) { for (ExpireList::iterator i = _expList.begin(); i != _expList.end(); ++i) DirectDelete(*i); _expList.clear(); if (empty()) Initialize(); else if (needInitTop()) InitTop(); else if (_cleanFlag & MMCF_RESET) top()->Reset(_owner); _cleanFlag &= ~MMCF_RESET; } #if 0 // probably not the best place to pu this but im not really sure where else to put it. _owner->UpdateUnderwaterState(_owner->GetMap(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); #endif }
void MotionMaster::UpdateMotion(uint32 diff) { if( i_owner->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) ) return; assert( !empty() ); m_cleanFlag |= MMCF_UPDATE; if (!top()->Update(*i_owner, diff)) { m_cleanFlag &= ~MMCF_UPDATE; MovementExpired(); } else m_cleanFlag &= ~MMCF_UPDATE; if (m_expList) { for (int i = 0; i < m_expList->size(); ++i) { MovementGenerator* mg = (*m_expList)[i]; DirectDelete(mg); } delete m_expList; m_expList = NULL; if(empty()) Initialize(); else if(needInitTop()) InitTop(); else if (m_cleanFlag & MMCF_RESET) top()->Reset(*i_owner); m_cleanFlag &= ~MMCF_RESET; } }