From 8e32c8ca76aa9d88b5dabade6f6a71e1f2990a64 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Wed, 19 Nov 2008 16:39:09 +0300 Subject: [PATCH] Speedup map checks --- src/game/Player.cpp | 5 ++--- src/game/Spell.cpp | 5 ++--- src/game/SpellEffects.cpp | 3 ++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 02a915e18..90219e524 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -18378,9 +18378,8 @@ void Player::SetClientControl(Unit* target, uint8 allowMove) void Player::UpdateZoneDependentAuras( uint32 newZone ) { // remove new continent flight forms - if( !isGameMaster() && - GetVirtualMapForMapAndZone(GetMapId(),newZone) != 530 && - GetVirtualMapForMapAndZone(GetMapId(),newZone) != 571) + uint32 v_map = GetVirtualMapForMapAndZone(GetMapId(), newZone); + if( !isGameMaster() && v_map != 530 && v_map != 571) { RemoveSpellsCausingAura(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED); RemoveSpellsCausingAura(SPELL_AURA_FLY); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 88a6f4bd7..f2a858dfc 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4062,9 +4062,8 @@ uint8 Spell::CanCast(bool strict) // not allow cast fly spells at old maps by players (all spells is self target) if(m_caster->GetTypeId()==TYPEID_PLAYER) { - if( !((Player*)m_caster)->isGameMaster() && - GetVirtualMapForMapAndZone(m_caster->GetMapId(),m_caster->GetZoneId()) != 530 && - !(GetVirtualMapForMapAndZone(m_caster->GetMapId(),m_caster->GetZoneId()) == 571 && ((Player*)m_caster)->HasSpell(54197))) + uint32 v_map = GetVirtualMapForMapAndZone(m_caster->GetMapId(), m_caster->GetZoneId()); + if( !((Player*)m_caster)->isGameMaster() && v_map != 530 && !(v_map == 571 && ((Player*)m_caster)->HasSpell(54197))) return SPELL_FAILED_NOT_HERE; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 2722e477f..e39a16c4f 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4942,7 +4942,8 @@ void Spell::EffectDuel(uint32 i) // Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities) // Don't have to check the target's map since you cannot challenge someone across maps - if( caster->GetMapId() != 0 && caster->GetMapId() != 1 && caster->GetMapId() != 530 && caster->GetMapId() != 571) + uint32 mapid = caster->GetMapId(); + if( mapid != 0 && mapid != 1 && mapid != 530 && mapid != 571 && mapid != 609) { SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here return;