diff options
Diffstat (limited to 'src/server/game/Movement/MotionMaster.cpp')
-rwxr-xr-x | src/server/game/Movement/MotionMaster.cpp | 209 |
1 files changed, 103 insertions, 106 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 4945ae2a014..27816753ca7 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -53,9 +53,9 @@ void MotionMaster::Initialize() // set new default movement generator void MotionMaster::InitDefault() { - if (i_owner->GetTypeId() == TYPEID_UNIT) + if (_owner->GetTypeId() == TYPEID_UNIT) { - MovementGenerator* movement = FactorySelector::selectMovementGenerator(i_owner->ToCreature()); + MovementGenerator* movement = FactorySelector::selectMovementGenerator(_owner->ToCreature()); Mutate(movement == NULL ? &si_idleMovement : movement, MOTION_SLOT_IDLE); } else @@ -77,42 +77,42 @@ MotionMaster::~MotionMaster() void MotionMaster::UpdateMotion(uint32 diff) { - if (!i_owner) + if (!_owner) return; - if (i_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) // what about UNIT_STATE_DISTRACTED? Why is this not included? + if (_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) // what about UNIT_STATE_DISTRACTED? Why is this not included? return; ASSERT(!empty()); - m_cleanFlag |= MMCF_UPDATE; - if (!top()->Update(*i_owner, diff)) + _cleanFlag |= MMCF_UPDATE; + if (!top()->Update(*_owner, diff)) { - m_cleanFlag &= ~MMCF_UPDATE; + _cleanFlag &= ~MMCF_UPDATE; MovementExpired(); } else - m_cleanFlag &= ~MMCF_UPDATE; + _cleanFlag &= ~MMCF_UPDATE; - if (m_expList) + if (_expList) { - for (size_t i = 0; i < m_expList->size(); ++i) + for (size_t i = 0; i < _expList->size(); ++i) { - MovementGenerator* mg = (*m_expList)[i]; + MovementGenerator* mg = (*_expList)[i]; DirectDelete(mg); } - delete m_expList; - m_expList = NULL; + delete _expList; + _expList = NULL; if (empty()) Initialize(); else if (needInitTop()) InitTop(); - else if (m_cleanFlag & MMCF_RESET) - top()->Reset(*i_owner); + else if (_cleanFlag & MMCF_RESET) + top()->Reset(*_owner); - m_cleanFlag &= ~MMCF_RESET; + _cleanFlag &= ~MMCF_RESET; } } @@ -128,7 +128,7 @@ void MotionMaster::DirectClean(bool reset) if (needInitTop()) InitTop(); else if (reset) - top()->Reset(*i_owner); + top()->Reset(*_owner); } void MotionMaster::DelayedClean() @@ -152,14 +152,14 @@ void MotionMaster::DirectExpire(bool reset) } while (!top()) - --i_top; + --_top; if (empty()) Initialize(); else if (needInitTop()) InitTop(); else if (reset) - top()->Reset(*i_owner); + top()->Reset(*_owner); } void MotionMaster::DelayedExpire() @@ -172,7 +172,7 @@ void MotionMaster::DelayedExpire() } while (!top()) - --i_top; + --_top; } void MotionMaster::MoveIdle() @@ -184,9 +184,9 @@ void MotionMaster::MoveIdle() void MotionMaster::MoveRandom(float spawndist) { - if (i_owner->GetTypeId() == TYPEID_UNIT) + if (_owner->GetTypeId() == TYPEID_UNIT) { - sLog->outStaticDebug("Creature (GUID: %u) start moving random", i_owner->GetGUIDLow()); + sLog->outStaticDebug("Creature (GUID: %u) start moving random", _owner->GetGUIDLow()); Mutate(new RandomMovementGenerator<Creature>(spawndist), MOTION_SLOT_IDLE); } } @@ -195,15 +195,15 @@ void MotionMaster::MoveTargetedHome() { Clear(false); - if (i_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)i_owner)->GetCharmerOrOwnerGUID()) + if (_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)_owner)->GetCharmerOrOwnerGUID()) { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", i_owner->GetEntry(), i_owner->GetGUIDLow()); + sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow()); Mutate(new HomeMovementGenerator<Creature>(), MOTION_SLOT_ACTIVE); } - else if (i_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)i_owner)->GetCharmerOrOwnerGUID()) + else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID()) { - sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", i_owner->GetEntry(), i_owner->GetGUIDLow() ); - Unit *target = ((Creature*)i_owner)->GetCharmerOrOwner(); + sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow() ); + Unit *target = ((Creature*)_owner)->GetCharmerOrOwner(); if (target) { sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() ); @@ -212,21 +212,21 @@ void MotionMaster::MoveTargetedHome() } else { - sLog->outError("Player (GUID: %u) attempt targeted home", i_owner->GetGUIDLow()); + sLog->outError("Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow()); } } void MotionMaster::MoveConfused() { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) move confused", i_owner->GetGUIDLow()); + sLog->outStaticDebug("Player (GUID: %u) move confused", _owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) move confused", - i_owner->GetEntry(), i_owner->GetGUIDLow()); + _owner->GetEntry(), _owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator<Creature>(), MOTION_SLOT_CONTROLLED); } } @@ -234,14 +234,14 @@ void MotionMaster::MoveConfused() void MotionMaster::MoveChase(Unit* target, float dist, float angle) { // ignore movement request if target not exist - if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + if (!target || target == _owner || _owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) return; - //i_owner->ClearUnitState(UNIT_STATE_FOLLOW); - if (i_owner->GetTypeId() == TYPEID_PLAYER) + //_owner->ClearUnitState(UNIT_STATE_FOLLOW); + if (_owner->GetTypeId() == TYPEID_PLAYER) { sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)", - i_owner->GetGUIDLow(), + _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new ChaseMovementGenerator<Player>(*target,dist,angle), MOTION_SLOT_ACTIVE); @@ -249,7 +249,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), + _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new ChaseMovementGenerator<Creature>(*target,dist,angle), MOTION_SLOT_ACTIVE); @@ -259,13 +259,13 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slot) { // ignore movement request if target not exist - if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + if (!target || target == _owner || _owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) return; - //i_owner->AddUnitState(UNIT_STATE_FOLLOW); - if (i_owner->GetTypeId() == TYPEID_PLAYER) + //_owner->AddUnitState(UNIT_STATE_FOLLOW); + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(), + sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator<Player>(*target,dist,angle), slot); @@ -273,7 +273,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), + _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator<Creature>(*target,dist,angle), slot); @@ -282,15 +282,15 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo void MotionMaster::MovePoint(uint32 id, float x, float y, float z) { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z); + sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator<Player>(id, x, y, z), MOTION_SLOT_ACTIVE); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), id, x, y, z); + _owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator<Creature>(id, x, y, z), MOTION_SLOT_ACTIVE); } } @@ -300,9 +300,9 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed) float x, y, z; pos.GetPosition(x, y, z); - sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", i_owner->GetEntry(), id, x, y, z); + sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); - Movement::MoveSplineInit init(*i_owner); + Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); init.SetVelocity(speed); init.SetAnimation(Movement::ToGround); @@ -315,9 +315,9 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) float x, y, z; pos.GetPosition(x, y, z); - sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", i_owner->GetEntry(), id, x, y, z); + sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); - Movement::MoveSplineInit init(*i_owner); + Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); init.SetVelocity(speed); init.SetAnimation(Movement::ToFly); @@ -328,66 +328,63 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ) { //this function may make players fall below map - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) return; float x, y, z; float moveTimeHalf = speedZ / Movement::gravity; float dist = 2 * moveTimeHalf * speedXY; - i_owner->GetNearPoint(i_owner, x, y, z, i_owner->GetObjectSize(), dist, i_owner->GetAngle(srcX, srcY) + M_PI); + _owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + M_PI); MoveJump(x, y, z, speedXY, speedZ); } void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) { //this function may make players fall below map - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) return; float x, y, z; float moveTimeHalf = speedZ / Movement::gravity; float dist = 2 * moveTimeHalf * speedXY; - i_owner->GetClosePoint(x, y, z, i_owner->GetObjectSize(), dist, angle); + _owner->GetClosePoint(x, y, z, _owner->GetObjectSize(), dist, angle); MoveJump(x, y, z, speedXY, speedZ); } void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id) { - sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z); + sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); float moveTimeHalf = speedZ / Movement::gravity; float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ); - Movement::MoveSplineInit init(*i_owner); + Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); init.SetParabolic(max_height,0); init.SetVelocity(speedXY); init.Launch(); - if (i_owner->GetTypeId() == TYPEID_PLAYER) - Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); - else - Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE); + Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); } void MotionMaster::MoveFall(uint32 id/*=0*/) { // use larger distance for vmap height search than in most other cases - float tz = i_owner->GetMap()->GetHeight(i_owner->GetPositionX(), i_owner->GetPositionY(), i_owner->GetPositionZ(), true, MAX_FALL_DISTANCE); + float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE); if (tz <= INVALID_HEIGHT) { sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", - i_owner->GetMap()->GetId(), i_owner->GetPositionX(), i_owner->GetPositionX(), i_owner->GetPositionZ()); + _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ()); return; } // Abort too if the ground is very near - if (fabs(i_owner->GetPositionZ() - tz) < 0.1f) + if (fabs(_owner->GetPositionZ() - tz) < 0.1f) return; - Movement::MoveSplineInit init(*i_owner); - init.MoveTo(i_owner->GetPositionX(),i_owner->GetPositionY(),tz); + Movement::MoveSplineInit init(*_owner); + init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz); init.SetFall(); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); @@ -398,45 +395,45 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id) if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE) return; - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z); + sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed), MOTION_SLOT_CONTROLLED); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z); + _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator<Creature>(id, x, y, z, speed), MOTION_SLOT_CONTROLLED); } } void MotionMaster::MoveSeekAssistance(float x, float y, float z) { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outError("Player (GUID: %u) attempt to seek assistance", i_owner->GetGUIDLow()); + sLog->outError("Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow()); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z); - i_owner->AttackStop(); - i_owner->ToCreature()->SetReactState(REACT_PASSIVE); + _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); + _owner->AttackStop(); + _owner->ToCreature()->SetReactState(REACT_PASSIVE); Mutate(new AssistanceMovementGenerator(x, y, z), MOTION_SLOT_ACTIVE); } } void MotionMaster::MoveSeekAssistanceDistract(uint32 time) { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outError("Player (GUID: %u) attempt to call distract after assistance", i_owner->GetGUIDLow()); + sLog->outError("Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow()); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), time); + _owner->GetEntry(), _owner->GetGUIDLow(), time); Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE); } } @@ -446,12 +443,12 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) if (!enemy) return; - if (i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) + if (_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) return; - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(), + sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow()); Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED); @@ -459,7 +456,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s", - i_owner->GetEntry(), i_owner->GetGUIDLow(), + _owner->GetEntry(), _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(), time ? " for a limited time" : ""); @@ -472,24 +469,24 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { if (path < sTaxiPathNodesByPath.size()) { - sLog->outStaticDebug("%s taxi to (Path %u node %u)", i_owner->GetName(), path, pathnode); + sLog->outStaticDebug("%s taxi to (Path %u node %u)", _owner->GetName(), path, pathnode); FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode); Mutate(mgen, MOTION_SLOT_CONTROLLED); } else { sLog->outError("%s attempt taxi to (not existed Path %u node %u)", - i_owner->GetName(), path, pathnode); + _owner->GetName(), path, pathnode); } } else { sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), path, pathnode); + _owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode); } } @@ -498,14 +495,14 @@ void MotionMaster::MoveDistract(uint32 timer) if (Impl[MOTION_SLOT_CONTROLLED]) return; - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer); + sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) (timer: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), timer); + _owner->GetEntry(), _owner->GetGUIDLow(), timer); } DistractMovementGenerator* mgen = new DistractMovementGenerator(timer); @@ -517,23 +514,23 @@ void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot) if (MovementGenerator *curr = Impl[slot]) { Impl[slot] = NULL; // in case a new one is generated in this slot during directdelete - if (i_top == slot && (m_cleanFlag & MMCF_UPDATE)) + if (_top == slot && (_cleanFlag & MMCF_UPDATE)) DelayedDelete(curr); else DirectDelete(curr); } - else if (i_top < slot) + else if (_top < slot) { - i_top = slot; + _top = slot; } Impl[slot] = m; - if (i_top > slot) - needInit[slot] = true; + if (_top > slot) + _needInit[slot] = true; else { - needInit[slot] = false; - m->Initialize(*i_owner); + _needInit[slot] = false; + m->Initialize(*_owner); } } @@ -546,19 +543,19 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) /*while (!empty()) { MovementGenerator *curr = top(); - curr->Finalize(*i_owner); + curr->Finalize(*_owner); pop(); if (!isStatic(curr)) delete curr; }*/ - //i_owner->GetTypeId() == TYPEID_PLAYER ? + //_owner->GetTypeId() == TYPEID_PLAYER ? //Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)): Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE); sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", - i_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", - i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO"); + _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", + _owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO"); } void MotionMaster::MoveRotate(uint32 time, RotateDirection direction) @@ -576,7 +573,7 @@ void MotionMaster::propagateSpeedChange() { (*it)->unitSpeedChanged(); }*/ - for (int i = 0; i <= i_top; ++i) + for (int i = 0; i <= _top; ++i) { if (Impl[i]) Impl[i]->unitSpeedChanged(); @@ -601,34 +598,34 @@ MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const void MotionMaster::InitTop() { - top()->Initialize(*i_owner); - needInit[i_top] = false; + top()->Initialize(*_owner); + _needInit[_top] = false; } void MotionMaster::DirectDelete(_Ty curr) { if (isStatic(curr)) return; - curr->Finalize(*i_owner); + curr->Finalize(*_owner); delete curr; } void MotionMaster::DelayedDelete(_Ty curr) { - sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", i_owner->GetEntry(), curr->GetMovementGeneratorType()); + sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType()); if (isStatic(curr)) return; - if (!m_expList) - m_expList = new ExpireList(); - m_expList->push_back(curr); + if (!_expList) + _expList = new ExpireList(); + _expList->push_back(curr); } bool MotionMaster::GetDestination(float &x, float &y, float &z) { - if (i_owner->movespline->Finalized()) + if (_owner->movespline->Finalized()) return false; - const G3D::Vector3& dest = i_owner->movespline->FinalDestination(); + const G3D::Vector3& dest = _owner->movespline->FinalDestination(); x = dest.x; y = dest.y; z = dest.z; |