diff options
| author | Shauren <shauren.trinity@gmail.com> | 2012-02-23 13:01:16 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2012-02-23 13:01:16 +0100 |
| commit | dc28b924151374776aefa04935379ad095eb4c06 (patch) | |
| tree | 011094e08fea11d09cc6643a8284702f43c948f6 /src/server/game/Entities/Unit | |
| parent | dbd8cbcfc4e5f89da98551db90e34a91ed339f3d (diff) | |
Core: Random cleanup + compile fix
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 30 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.h | 3 |
2 files changed, 26 insertions, 7 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 69fb9906efb..41d13f38cc8 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1469,8 +1469,8 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo if (GetTypeId() == TYPEID_PLAYER) { float bonusPct = 0; - AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); - for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr) + AuraEffectList const& armorPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); + for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr) { if ((*itr)->GetSpellInfo()->EquippedItemClass == -1) { @@ -15459,7 +15459,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // Inform pets (if any) when player kills target) // MUST come after victim->setDeathState(JUST_DIED); or pet next target // selection will get stuck on same target and break pet react state - if (Player* player = ToPlayer()) + if (player) { Pet* pet = player->GetPet(); if (pet && pet->isAlive() && pet->isControlled()) @@ -17003,7 +17003,7 @@ void Unit::ExitVehicle(Position const* exitPosition) return; GetVehicleBase()->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, GetGUID()); - //! The following call would not even be executed successfully as the + //! The following call would not even be executed successfully as the //! SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without //! specifying an exitposition. The subsequent call below would return on if (!m_vehicle). /*_ExitVehicle(exitPosition);*/ @@ -17456,10 +17456,28 @@ void Unit::SetFacingToObject(WorldObject* pObject) SetFacingTo(GetAngle(pObject)); } -void Unit::SetWalk(bool enable) +bool Unit::SetWalk(bool enable) +{ + if (enable == IsWalking()) + return false; + + if (enable) + AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + else + RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + + return true; +} + +bool Unit::SetLevitate(bool enable) { + if (enable == IsLevitating()) + return false; + if (enable) AddUnitMovementFlag(MOVEMENTFLAG_WALKING); else RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); -}
\ No newline at end of file + + return true; +} diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 00f96f15a2c..0fe5f3d8ca3 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1627,7 +1627,8 @@ class Unit : public WorldObject void SendMovementFlagUpdate(); bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_LEVITATING);} bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);} - virtual void SetWalk(bool enable); + virtual bool SetWalk(bool enable); + virtual bool SetLevitate(bool enable); void SetInFront(Unit const* target); void SetFacingTo(float ori); |
