diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index f1e7b35c4..7e284db11 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2487,7 +2487,6 @@ void Creature::SetWalk(bool enable) WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_WALK_MODE : SMSG_SPLINE_MOVE_SET_RUN_MODE, 9); data << GetPackGUID(); SendMessageToSet(&data, true); - UpdateWalkMode(this, false); } void Creature::SetLevitate(bool enable) diff --git a/src/game/Creature.h b/src/game/Creature.h index 22068631a..ca554fca4 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -518,8 +518,6 @@ class MANGOS_DLL_SPEC Creature : public Unit void SetWalk(bool enable); void SetLevitate(bool enable); - bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_LEVITATING);} - bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_WALK_MODE);} uint32 GetShieldBlockValue() const // dunno mob block value { diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 65c79982e..4bfe28ec8 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -286,10 +286,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) if (plMover) plMover->UpdateFallInformationIfNeed(movementInfo, opcode); - // after move info set - if (opcode == MSG_MOVE_SET_WALK_MODE || opcode == MSG_MOVE_SET_RUN_MODE) - mover->UpdateWalkMode(mover, false); - WorldPacket data(opcode, recv_data.size()); data << mover->GetPackGUID(); // write guid movementInfo.Write(data); // write data diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 42b88da41..fbfa951eb 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -283,8 +283,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool SetPower(POWER_MANA, savedmana > GetMaxPower(POWER_MANA) ? GetMaxPower(POWER_MANA) : savedmana); } - UpdateWalkMode(owner); - AIM_Initialize(); map->Add((Creature*)this); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 4218c72e9..3be75dd7a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4719,8 +4719,6 @@ void Spell::DoSummon(SpellEffectIndex eff_idx) spawnCreature->GetCharmInfo()->SetPetNumber(pet_number, false); - spawnCreature->UpdateWalkMode(m_caster); - spawnCreature->AIM_Initialize(); spawnCreature->InitPetCreateSpells(); spawnCreature->InitLevelupSpellsForLevel(); @@ -5640,8 +5638,6 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) NewSummon->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); NewSummon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); - NewSummon->UpdateWalkMode(m_caster); - NewSummon->GetCharmInfo()->SetPetNumber(pet_number, true); // this enables pet details window (Shift+P) diff --git a/src/game/TargetedMovementGenerator.cpp b/src/game/TargetedMovementGenerator.cpp index f6a0cd39c..f56b9ccce 100644 --- a/src/game/TargetedMovementGenerator.cpp +++ b/src/game/TargetedMovementGenerator.cpp @@ -83,6 +83,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) Movement::MoveSplineInit init(owner); init.MoveTo(x,y,z); + init.SetWalk(((D*)this)->EnableWalking()); init.Launch(); } @@ -216,15 +217,15 @@ void ChaseMovementGenerator::Reset(T &owner) //-----------------------------------------------// template<> -void FollowMovementGenerator::_updateWalkMode(Creature &u) +bool FollowMovementGenerator::EnableWalking() const { - if (i_target.isValid() && u.IsPet()) - u.UpdateWalkMode(i_target.getTarget()); + return i_target.isValid() && i_target->IsWalking(); } template<> -void FollowMovementGenerator::_updateWalkMode(Player &) +bool FollowMovementGenerator::EnableWalking() const { + return false; } template<> @@ -249,7 +250,6 @@ template<> void FollowMovementGenerator::Initialize(Player &owner) { owner.addUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE); - _updateWalkMode(owner); _updateSpeed(owner); _setTargetLocation(owner); } @@ -258,7 +258,6 @@ template<> void FollowMovementGenerator::Initialize(Creature &owner) { owner.addUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE); - _updateWalkMode(owner); _updateSpeed(owner); _setTargetLocation(owner); } @@ -267,7 +266,6 @@ template void FollowMovementGenerator::Finalize(T &owner) { owner.clearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE); - _updateWalkMode(owner); _updateSpeed(owner); } @@ -275,7 +273,6 @@ template void FollowMovementGenerator::Interrupt(T &owner) { owner.clearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE); - _updateWalkMode(owner); _updateSpeed(owner); } diff --git a/src/game/TargetedMovementGenerator.h b/src/game/TargetedMovementGenerator.h index ff4d4adec..68bb1f55a 100644 --- a/src/game/TargetedMovementGenerator.h +++ b/src/game/TargetedMovementGenerator.h @@ -80,6 +80,7 @@ class MANGOS_DLL_SPEC ChaseMovementGenerator : public TargetedMovementGeneratorM static void _clearUnitStateMove(T &u) { u.clearUnitState(UNIT_STAT_CHASE_MOVE); } static void _addUnitStateMove(T &u) { u.addUnitState(UNIT_STAT_CHASE_MOVE); } + bool EnableWalking() const { return false;} bool _lostTarget(T &u) const { return u.getVictim() != this->GetTarget(); } void _reachTarget(T &); }; @@ -103,10 +104,10 @@ class MANGOS_DLL_SPEC FollowMovementGenerator : public TargetedMovementGenerator static void _clearUnitStateMove(T &u) { u.clearUnitState(UNIT_STAT_FOLLOW_MOVE); } static void _addUnitStateMove(T &u) { u.addUnitState(UNIT_STAT_FOLLOW_MOVE); } + bool EnableWalking() const; bool _lostTarget(T &) const { return false; } void _reachTarget(T &) {} private: - void _updateWalkMode(T &u); void _updateSpeed(T &u); }; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 86f7ba90c..fa1289f38 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8122,36 +8122,6 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const return false; } -struct UpdateWalkModeHelper -{ - explicit UpdateWalkModeHelper(Unit* _source) : source(_source) {} - void operator()(Unit* unit) const { unit->UpdateWalkMode(source, true); } - Unit* source; -}; - -void Unit::UpdateWalkMode(Unit* source, bool self) -{ - if (GetTypeId() == TYPEID_PLAYER) - CallForAllControlledUnits(UpdateWalkModeHelper(source), CONTROLLED_PET|CONTROLLED_GUARDIANS|CONTROLLED_CHARM|CONTROLLED_MINIPET); - else if (self) - { - bool on = source->m_movementInfo.HasMovementFlag(MOVEFLAG_WALK_MODE); - - if (on) - { - if (((Creature*)this)->IsPet() && hasUnitState(UNIT_STAT_FOLLOW)) - ((Creature*)this)->SetWalk(true); - } - else - { - if (((Creature*)this)->IsPet()) - ((Creature*)this)->SetWalk(false); - } - } - else - CallForAllControlledUnits(UpdateWalkModeHelper(source), CONTROLLED_PET|CONTROLLED_GUARDIANS|CONTROLLED_CHARM|CONTROLLED_MINIPET); -} - void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) { // not in combat pet have same speed as owner diff --git a/src/game/Unit.h b/src/game/Unit.h index 1a5b655e9..6da1c7651 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1467,6 +1467,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject // recommend use MonsterMove/MonsterMoveWithSpeed for most case that correctly work with movegens // if used additional args in ... part then floats must explicitly casted to double void SendHeartBeat(); + bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_LEVITATING);} + bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_WALK_MODE);} void SetInFront(Unit const* target); void SetFacingTo(float ori); @@ -1886,7 +1888,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void CalculateAbsorbResistBlock(Unit *pCaster, SpellNonMeleeDamage *damageInfo, SpellEntry const* spellProto, WeaponAttackType attType = BASE_ATTACK); void CalculateHealAbsorb(uint32 heal, uint32 *absorb); - void UpdateWalkMode(Unit* source, bool self = true); void UpdateSpeed(UnitMoveType mtype, bool forced, float ratio = 1.0f); float GetSpeed( UnitMoveType mtype ) const; float GetSpeedRate( UnitMoveType mtype ) const { return m_speed_rate[mtype]; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2de917d8d..9dd2e893e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11720" + #define REVISION_NR "11721" #endif // __REVISION_NR_H__