aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp4
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp39
2 files changed, 28 insertions, 15 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 198f890fb9d..0921c994f12 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -16330,7 +16330,7 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const * a
if (seatId >= 0 && seatId != GetTransSeat())
{
sLog->outDebug("EnterVehicle: %u leave vehicle %u seat %d and enter %d.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
- ChangeSeat(seatId, bool(aurApp));
+ ChangeSeat(seatId, aurApp != NULL);
}
return;
}
@@ -16364,7 +16364,7 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const * a
ASSERT(!m_vehicle);
m_vehicle = vehicle;
- if (!m_vehicle->AddPassenger(this, seatId, bool(aurApp)))
+ if (!m_vehicle->AddPassenger(this, seatId, aurApp != NULL))
{
m_vehicle = NULL;
return;
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index aec536a74d1..4e2da110210 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -116,23 +116,36 @@ void AuraApplication::_InitFlags(Unit * caster, uint8 effMask)
// mark as selfcasted if needed
m_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE;
- // Aura is positive when it is casted by friend and at least one aura is positive
- // or when it is casted by enemy and at least one aura is negative
- bool needManyNegEffects = false;
- if (IsSelfcasted())
- needManyNegEffects = false;
- else if (caster)
- needManyNegEffects = caster->IsFriendlyTo(GetTarget());
-
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ // aura is casted by self or an enemy
+ // one negative effect and we know aura is negative
+ if (IsSelfcasted() || !caster || !caster->IsFriendlyTo(GetTarget()))
{
- if ((1<<i) & effMask)
+ bool negativeFound = false;
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (needManyNegEffects == IsPositiveEffect(GetBase()->GetId(), i))
- m_flags |= needManyNegEffects ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
+ if (((1<<i) & effMask) && !IsPositiveEffect(GetBase()->GetId(), i))
+ {
+ negativeFound = true;
+ break;
+ }
+ }
+ m_flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE;
+ }
+ // aura is casted by friend
+ // one positive effect and we know aura is positive
+ else
+ {
+ bool positiveFound = false;
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (((1<<i) & effMask) && IsPositiveEffect(GetBase()->GetId(), i))
+ {
+ positiveFound = true;
+ break;
+ }
}
+ m_flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
}
- m_flags |= !needManyNegEffects ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
}
void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)