Core/Spells: Fixed possible crashes in scaling mounts code when player is not in a valid zone

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-11-13 18:54:33 +01:00
parent 880ef0c398
commit ec49ce5fc3

View File

@@ -4472,7 +4472,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
if (canFly && (pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE) || !pArea)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
@@ -4517,7 +4517,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
if (canFly && (pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE) || !pArea)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
@@ -4842,7 +4842,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
if (canFly && (pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE) || !pArea)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
@@ -4888,7 +4888,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
if (canFly && (pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE) || !pArea)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
@@ -4951,7 +4951,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag);
if (canFly && pArea->flags & AREA_FLAG_NO_FLY_ZONE)
if (canFly && (pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE) || !pArea)
canFly = false;
switch(unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))