[12076] Remove redundant casts in Player.cpp

This commit is contained in:
stfx 2012-08-02 10:26:11 +02:00
parent 32aede1a82
commit e81b605caa
2 changed files with 46 additions and 47 deletions

View file

@ -2353,7 +2353,7 @@ bool Player::IsGroupVisibleFor(Player* p) const
bool Player::IsInSameGroupWith(Player const* p) const bool Player::IsInSameGroupWith(Player const* p) const
{ {
return (p == this || (GetGroup() != NULL && return (p == this || (GetGroup() != NULL &&
GetGroup()->SameSubGroup((Player*)this, (Player*)p))); GetGroup()->SameSubGroup(this, p)));
} }
///- If the player is invited, remove him. If the group if then only 1 person, disband the group. ///- If the player is invited, remove him. If the group if then only 1 person, disband the group.
@ -7631,11 +7631,10 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
if (!pEnchant) continue; if (!pEnchant) continue;
for (int s = 0; s < 3; ++s) for (int s = 0; s < 3; ++s)
{ {
uint32 proc_spell_id = pEnchant->spellid[s];
if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue; continue;
uint32 proc_spell_id = pEnchant->spellid[s];
SpellEntry const* spellInfo = sSpellStore.LookupEntry(proc_spell_id); SpellEntry const* spellInfo = sSpellStore.LookupEntry(proc_spell_id);
if (!spellInfo) if (!spellInfo)
{ {
@ -12640,7 +12639,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
if (!pEnchant) if (!pEnchant)
return; return;
if (!ignore_condition && pEnchant->EnchantmentCondition && !((Player*)this)->EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1)) if (!ignore_condition && pEnchant->EnchantmentCondition && !EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1))
return; return;
if (!item->IsBroken()) if (!item->IsBroken())
@ -12690,7 +12689,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
} }
} }
} }
// Cast custom spell vs all equal basepoints getted from enchant_amount // Cast custom spell vs all equal basepoints got from enchant_amount
if (basepoints) if (basepoints)
CastCustomSpell(this, enchant_spell_id, &basepoints, &basepoints, &basepoints, true, item); CastCustomSpell(this, enchant_spell_id, &basepoints, &basepoints, &basepoints, true, item);
else else
@ -12775,111 +12774,111 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
ApplyStatBuffMod(STAT_STAMINA, float(enchant_amount), apply); ApplyStatBuffMod(STAT_STAMINA, float(enchant_amount), apply);
break; break;
case ITEM_MOD_DEFENSE_SKILL_RATING: case ITEM_MOD_DEFENSE_SKILL_RATING:
((Player*)this)->ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply); ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply);
DEBUG_LOG("+ %u DEFENCE", enchant_amount); DEBUG_LOG("+ %u DEFENCE", enchant_amount);
break; break;
case ITEM_MOD_DODGE_RATING: case ITEM_MOD_DODGE_RATING:
((Player*)this)->ApplyRatingMod(CR_DODGE, enchant_amount, apply); ApplyRatingMod(CR_DODGE, enchant_amount, apply);
DEBUG_LOG("+ %u DODGE", enchant_amount); DEBUG_LOG("+ %u DODGE", enchant_amount);
break; break;
case ITEM_MOD_PARRY_RATING: case ITEM_MOD_PARRY_RATING:
((Player*)this)->ApplyRatingMod(CR_PARRY, enchant_amount, apply); ApplyRatingMod(CR_PARRY, enchant_amount, apply);
DEBUG_LOG("+ %u PARRY", enchant_amount); DEBUG_LOG("+ %u PARRY", enchant_amount);
break; break;
case ITEM_MOD_BLOCK_RATING: case ITEM_MOD_BLOCK_RATING:
((Player*)this)->ApplyRatingMod(CR_BLOCK, enchant_amount, apply); ApplyRatingMod(CR_BLOCK, enchant_amount, apply);
DEBUG_LOG("+ %u SHIELD_BLOCK", enchant_amount); DEBUG_LOG("+ %u SHIELD_BLOCK", enchant_amount);
break; break;
case ITEM_MOD_HIT_MELEE_RATING: case ITEM_MOD_HIT_MELEE_RATING:
((Player*)this)->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
DEBUG_LOG("+ %u MELEE_HIT", enchant_amount); DEBUG_LOG("+ %u MELEE_HIT", enchant_amount);
break; break;
case ITEM_MOD_HIT_RANGED_RATING: case ITEM_MOD_HIT_RANGED_RATING:
((Player*)this)->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
DEBUG_LOG("+ %u RANGED_HIT", enchant_amount); DEBUG_LOG("+ %u RANGED_HIT", enchant_amount);
break; break;
case ITEM_MOD_HIT_SPELL_RATING: case ITEM_MOD_HIT_SPELL_RATING:
((Player*)this)->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
DEBUG_LOG("+ %u SPELL_HIT", enchant_amount); DEBUG_LOG("+ %u SPELL_HIT", enchant_amount);
break; break;
case ITEM_MOD_CRIT_MELEE_RATING: case ITEM_MOD_CRIT_MELEE_RATING:
((Player*)this)->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
DEBUG_LOG("+ %u MELEE_CRIT", enchant_amount); DEBUG_LOG("+ %u MELEE_CRIT", enchant_amount);
break; break;
case ITEM_MOD_CRIT_RANGED_RATING: case ITEM_MOD_CRIT_RANGED_RATING:
((Player*)this)->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
DEBUG_LOG("+ %u RANGED_CRIT", enchant_amount); DEBUG_LOG("+ %u RANGED_CRIT", enchant_amount);
break; break;
case ITEM_MOD_CRIT_SPELL_RATING: case ITEM_MOD_CRIT_SPELL_RATING:
((Player*)this)->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
DEBUG_LOG("+ %u SPELL_CRIT", enchant_amount); DEBUG_LOG("+ %u SPELL_CRIT", enchant_amount);
break; break;
// Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used // Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used
// in Enchantments // in Enchantments
// case ITEM_MOD_HIT_TAKEN_MELEE_RATING: // case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply); // ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
// break; // break;
// case ITEM_MOD_HIT_TAKEN_RANGED_RATING: // case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply); // ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
// break; // break;
// case ITEM_MOD_HIT_TAKEN_SPELL_RATING: // case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply); // ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
// break; // break;
// case ITEM_MOD_CRIT_TAKEN_MELEE_RATING: // case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); // ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
// break; // break;
// case ITEM_MOD_CRIT_TAKEN_RANGED_RATING: // case ITEM_MOD_CRIT_TAKEN_RANGED_RATING:
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); // ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
// break; // break;
// case ITEM_MOD_CRIT_TAKEN_SPELL_RATING: // case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); // ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
// break; // break;
// case ITEM_MOD_HASTE_MELEE_RATING: // case ITEM_MOD_HASTE_MELEE_RATING:
// ((Player*)this)->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply); // ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
// break; // break;
// case ITEM_MOD_HASTE_RANGED_RATING: // case ITEM_MOD_HASTE_RANGED_RATING:
// ((Player*)this)->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); // ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
// break; // break;
case ITEM_MOD_HASTE_SPELL_RATING: case ITEM_MOD_HASTE_SPELL_RATING:
((Player*)this)->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply); ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
break; break;
case ITEM_MOD_HIT_RATING: case ITEM_MOD_HIT_RATING:
((Player*)this)->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
((Player*)this)->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
((Player*)this)->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
DEBUG_LOG("+ %u HIT", enchant_amount); DEBUG_LOG("+ %u HIT", enchant_amount);
break; break;
case ITEM_MOD_CRIT_RATING: case ITEM_MOD_CRIT_RATING:
((Player*)this)->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
((Player*)this)->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
((Player*)this)->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
DEBUG_LOG("+ %u CRITICAL", enchant_amount); DEBUG_LOG("+ %u CRITICAL", enchant_amount);
break; break;
// Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment // Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment
// case ITEM_MOD_HIT_TAKEN_RATING: // case ITEM_MOD_HIT_TAKEN_RATING:
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply); // ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply); // ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply); // ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
// break; // break;
// case ITEM_MOD_CRIT_TAKEN_RATING: // case ITEM_MOD_CRIT_TAKEN_RATING:
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); // ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); // ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); // ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
// break; // break;
case ITEM_MOD_RESILIENCE_RATING: case ITEM_MOD_RESILIENCE_RATING:
((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
DEBUG_LOG("+ %u RESILIENCE", enchant_amount); DEBUG_LOG("+ %u RESILIENCE", enchant_amount);
break; break;
case ITEM_MOD_HASTE_RATING: case ITEM_MOD_HASTE_RATING:
((Player*)this)->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply); ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
((Player*)this)->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
((Player*)this)->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply); ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
DEBUG_LOG("+ %u HASTE", enchant_amount); DEBUG_LOG("+ %u HASTE", enchant_amount);
break; break;
case ITEM_MOD_EXPERTISE_RATING: case ITEM_MOD_EXPERTISE_RATING:
((Player*)this)->ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply); ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply);
DEBUG_LOG("+ %u EXPERTISE", enchant_amount); DEBUG_LOG("+ %u EXPERTISE", enchant_amount);
break; break;
case ITEM_MOD_ATTACK_POWER: case ITEM_MOD_ATTACK_POWER:
@ -12892,15 +12891,15 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
DEBUG_LOG("+ %u RANGED_ATTACK_POWER", enchant_amount); DEBUG_LOG("+ %u RANGED_ATTACK_POWER", enchant_amount);
break; break;
case ITEM_MOD_MANA_REGENERATION: case ITEM_MOD_MANA_REGENERATION:
((Player*)this)->ApplyManaRegenBonus(enchant_amount, apply); ApplyManaRegenBonus(enchant_amount, apply);
DEBUG_LOG("+ %u MANA_REGENERATION", enchant_amount); DEBUG_LOG("+ %u MANA_REGENERATION", enchant_amount);
break; break;
case ITEM_MOD_ARMOR_PENETRATION_RATING: case ITEM_MOD_ARMOR_PENETRATION_RATING:
((Player*)this)->ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply); ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply);
DEBUG_LOG("+ %u ARMOR PENETRATION", enchant_amount); DEBUG_LOG("+ %u ARMOR PENETRATION", enchant_amount);
break; break;
case ITEM_MOD_SPELL_POWER: case ITEM_MOD_SPELL_POWER:
((Player*)this)->ApplySpellPowerBonus(enchant_amount, apply); ApplySpellPowerBonus(enchant_amount, apply);
DEBUG_LOG("+ %u SPELL_POWER", enchant_amount); DEBUG_LOG("+ %u SPELL_POWER", enchant_amount);
break; break;
case ITEM_MOD_BLOCK_VALUE: case ITEM_MOD_BLOCK_VALUE:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12075" #define REVISION_NR "12076"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__