mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[10692] Fixed some GCC warnings and code errors.
Thanks to freghar for provide cleaned list of warning messages.
This commit is contained in:
parent
349719e520
commit
10d3d3ce24
33 changed files with 363 additions and 306 deletions
|
|
@ -492,9 +492,9 @@ void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage)
|
|||
|
||||
void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
|
||||
{
|
||||
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
|
||||
{
|
||||
if(absorb)
|
||||
if (absorb)
|
||||
*absorb += damage;
|
||||
damage = 0;
|
||||
return;
|
||||
|
|
@ -1332,7 +1332,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
|
|||
if(!this || !pVictim)
|
||||
return;
|
||||
|
||||
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
|
||||
return;
|
||||
|
||||
SpellEntry const *spellProto = sSpellStore.LookupEntry(damageInfo->SpellID);
|
||||
|
|
@ -1639,7 +1639,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||
if(!this || !pVictim)
|
||||
return;
|
||||
|
||||
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
|
||||
return;
|
||||
|
||||
//You don't lose health from damage taken from another player while in a sanctuary
|
||||
|
|
@ -2380,7 +2380,7 @@ void Unit::CalculateAbsorbResistBlock(Unit *pCaster, SpellNonMeleeDamage *damage
|
|||
if (blocked)
|
||||
{
|
||||
damageInfo->blocked = GetShieldBlockValue();
|
||||
if (damageInfo->damage < (int32)damageInfo->blocked)
|
||||
if (damageInfo->damage < damageInfo->blocked)
|
||||
damageInfo->blocked = damageInfo->damage;
|
||||
damageInfo->damage-=damageInfo->blocked;
|
||||
}
|
||||
|
|
@ -2679,8 +2679,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
|||
// mobs can score crushing blows if they're 4 or more levels above victim
|
||||
if (GetLevelForTarget(pVictim) >= pVictim->GetLevelForTarget(this) + 4 &&
|
||||
// can be from by creature (if can) or from controlled player that considered as creature
|
||||
(GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->IsPet() &&
|
||||
!(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) ||
|
||||
((GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->IsPet() &&
|
||||
!(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH)) ||
|
||||
GetTypeId()==TYPEID_PLAYER && !GetCharmerOrOwnerGuid().IsEmpty()))
|
||||
{
|
||||
// when their weapon skill is 15 or more above victim's defense skill
|
||||
|
|
@ -3926,7 +3926,7 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder)
|
|||
}
|
||||
|
||||
// passive and persistent auras can stack with themselves any number of times
|
||||
if (!holder->IsPassive() && !holder->IsPersistent() || holder->IsAreaAura())
|
||||
if ((!holder->IsPassive() && !holder->IsPersistent()) || holder->IsAreaAura())
|
||||
{
|
||||
SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(aurSpellInfo->Id);
|
||||
|
||||
|
|
@ -4181,7 +4181,7 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder)
|
|||
// single allowed spell specific from same caster or from any caster at target
|
||||
bool is_spellSpecPerTargetPerCaster = IsSingleFromSpellSpecificPerTargetPerCaster(spellId_spec,i_spellId_spec);
|
||||
bool is_spellSpecPerTarget = IsSingleFromSpellSpecificPerTarget(spellId_spec,i_spellId_spec);
|
||||
if( is_spellSpecPerTarget || is_spellSpecPerTargetPerCaster && holder->GetCasterGUID() == (*i).second->GetCasterGUID() )
|
||||
if (is_spellSpecPerTarget || (is_spellSpecPerTargetPerCaster && holder->GetCasterGUID() == (*i).second->GetCasterGUID()))
|
||||
{
|
||||
// cannot remove higher rank
|
||||
if (sSpellMgr.IsRankSpellDueToSpell(spellProto, i_spellId))
|
||||
|
|
@ -5741,7 +5741,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
|
|||
if(itr->second.state == PLAYERSPELL_REMOVED) continue;
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
|
||||
if (!spellInfo || !IsPassiveSpell(spellInfo)) continue;
|
||||
if (spellInfo->CasterAuraState == flag)
|
||||
if (AuraState(spellInfo->CasterAuraState) == flag)
|
||||
CastSpell(this, itr->first, true, NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -5759,7 +5759,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
|
|||
for (Unit::SpellAuraHolderMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
|
||||
{
|
||||
SpellEntry const* spellProto = (*itr).second->GetSpellProto();
|
||||
if (spellProto->CasterAuraState == flag)
|
||||
if (AuraState(spellProto->CasterAuraState) == flag)
|
||||
{
|
||||
RemoveSpellAuraHolder(itr->second);
|
||||
itr = tAuras.begin();
|
||||
|
|
@ -7107,10 +7107,10 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
|
|||
AuraList const& mModDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
|
||||
for(AuraList::const_iterator i = mModDamageDone.begin(); i != mModDamageDone.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school
|
||||
if (((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school
|
||||
(*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask() && // AND schoolmask has to fit with weapon damage school (essential for non-physical spells)
|
||||
((*i)->GetSpellProto()->EquippedItemClass == -1 || // general, weapon independent
|
||||
pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto()))) // OR used weapon fits aura requirements
|
||||
((*i)->GetSpellProto()->EquippedItemClass == -1) || // general, weapon independent
|
||||
(pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto())))) // OR used weapon fits aura requirements
|
||||
{
|
||||
DoneFlat += (*i)->GetModifier()->m_amount;
|
||||
}
|
||||
|
|
@ -7146,10 +7146,10 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
|
|||
AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for(AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school
|
||||
if (((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school
|
||||
(*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask() && // AND schoolmask has to fit with weapon damage school (essential for non-physical spells)
|
||||
((*i)->GetSpellProto()->EquippedItemClass == -1 || // general, weapon independent
|
||||
pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto()))) // OR used weapon fits aura requirements
|
||||
((*i)->GetSpellProto()->EquippedItemClass == -1) || // general, weapon independent
|
||||
(pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto())))) // OR used weapon fits aura requirements
|
||||
{
|
||||
DonePercent *= ((*i)->GetModifier()->m_amount+100.0f) / 100.0f;
|
||||
}
|
||||
|
|
@ -7280,8 +7280,8 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
|
|||
{
|
||||
// search for glyph dummy aura
|
||||
if (Aura *aur = GetDummyAura(56826))
|
||||
// check for Serpent Sting
|
||||
if (Aura *serpentSting = pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, UI64LIT(0x0000000000004000)))
|
||||
// check for Serpent Sting at target
|
||||
if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, UI64LIT(0x0000000000004000)))
|
||||
DonePercent *= (aur->GetModifier()->m_amount+100.0f) / 100.0f;
|
||||
}
|
||||
}
|
||||
|
|
@ -8000,7 +8000,7 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
|
|||
{
|
||||
if(uint32 mask = (m_detectInvisibilityMask & u->m_invisibilityMask))
|
||||
{
|
||||
for(uint32 i = 0; i < 10; ++i)
|
||||
for(int32 i = 0; i < 10; ++i)
|
||||
{
|
||||
if(((1 << i) & mask)==0)
|
||||
continue;
|
||||
|
|
@ -8009,22 +8009,20 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
|
|||
int32 invLevel = 0;
|
||||
Unit::AuraList const& iAuras = u->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
|
||||
for(Unit::AuraList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
|
||||
if(((*itr)->GetModifier()->m_miscvalue)==i && invLevel < (*itr)->GetModifier()->m_amount)
|
||||
if ((*itr)->GetModifier()->m_miscvalue==i && invLevel < (*itr)->GetModifier()->m_amount)
|
||||
invLevel = (*itr)->GetModifier()->m_amount;
|
||||
|
||||
// find invisibility detect level
|
||||
int32 detectLevel = 0;
|
||||
Unit::AuraList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION);
|
||||
for(Unit::AuraList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr)
|
||||
if(((*itr)->GetModifier()->m_miscvalue)==i && detectLevel < (*itr)->GetModifier()->m_amount)
|
||||
if ((*itr)->GetModifier()->m_miscvalue==i && detectLevel < (*itr)->GetModifier()->m_amount)
|
||||
detectLevel = (*itr)->GetModifier()->m_amount;
|
||||
|
||||
if(i==6 && GetTypeId()==TYPEID_PLAYER) // special drunk detection case
|
||||
{
|
||||
if (i==6 && GetTypeId()==TYPEID_PLAYER) // special drunk detection case
|
||||
detectLevel = ((Player*)this)->GetDrunkValue();
|
||||
}
|
||||
|
||||
if(invLevel <= detectLevel)
|
||||
if (invLevel <= detectLevel)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -8081,6 +8079,8 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
|
|||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int32 main_speed_mod = 0;
|
||||
|
|
@ -9698,6 +9698,8 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
|||
case SPELL_AURA_PROC_FAILED:
|
||||
procSuccess = false;
|
||||
break;
|
||||
case SPELL_AURA_PROC_OK:
|
||||
break;
|
||||
}
|
||||
|
||||
anyAuraProc = true;
|
||||
|
|
@ -10254,18 +10256,20 @@ void Unit::SetContestedPvP(Player *attackedPlayer)
|
|||
{
|
||||
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
if(!player || attackedPlayer && (attackedPlayer == player || player->duel && player->duel->opponent == attackedPlayer))
|
||||
if (!player || (attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->opponent == attackedPlayer))))
|
||||
return;
|
||||
|
||||
player->SetContestedPvPTimer(30000);
|
||||
if(!player->hasUnitState(UNIT_STAT_ATTACK_PLAYER))
|
||||
|
||||
if (!player->hasUnitState(UNIT_STAT_ATTACK_PLAYER))
|
||||
{
|
||||
player->addUnitState(UNIT_STAT_ATTACK_PLAYER);
|
||||
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP);
|
||||
// call MoveInLineOfSight for nearby contested guards
|
||||
SetVisibility(GetVisibility());
|
||||
}
|
||||
if(!hasUnitState(UNIT_STAT_ATTACK_PLAYER))
|
||||
|
||||
if (!hasUnitState(UNIT_STAT_ATTACK_PLAYER))
|
||||
{
|
||||
addUnitState(UNIT_STAT_ATTACK_PLAYER);
|
||||
// call MoveInLineOfSight for nearby contested guards
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue