Make some cleanup.

My thank goes to Az@zel for the code analysis.

--HG--
branch : trunk
This commit is contained in:
Anubisss
2010-12-16 18:08:23 +01:00
parent bb7bd9ef45
commit 6d9029c12e
14 changed files with 56 additions and 95 deletions
@@ -188,7 +188,6 @@ Battleground::Battleground()
m_TeamScores[BG_TEAM_HORDE] = 0;
m_PrematureCountDown = false;
m_PrematureCountDown = 0;
m_HonorMode = BG_NORMAL;
@@ -911,19 +911,15 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
if (!trapSpell) // checked at load already
return;
/*** FIXME: this maybe not correct ***/
float range;
SpellRangeEntry const * srentry = sSpellRangeStore.LookupEntry(trapSpell->rangeIndex);
//get owner to check hostility of GameObject
if (GetSpellMaxRangeForHostile(srentry) == GetSpellMaxRangeForHostile(srentry))
range = GetSpellMaxRangeForHostile(srentry);
if (Unit *owner = GetOwner())
range = (float)owner->GetSpellMaxRangeForTarget(target, srentry);
else
{
if (Unit *owner = GetOwner())
range = (float)owner->GetSpellMaxRangeForTarget(target, srentry);
else
//if no owner assume that object is hostile to target
range = GetSpellMaxRangeForHostile(srentry);
}
//if no owner assume that object is hostile to target
range = GetSpellMaxRangeForHostile(srentry);
// search nearest linked GO
GameObject* trapGO = NULL;
@@ -1509,15 +1505,15 @@ void GameObject::Use(Unit* user)
{
case 179785: // Silverwing Flag
// check if it's correct bg
if (bg->GetTypeID(true) == BATTLEGROUND_WS)
if (bg->IsRandom() ? bg->GetTypeID(true) : bg->GetTypeID(false) == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 179786: // Warsong Flag
if (bg->GetTypeID(true) == BATTLEGROUND_WS)
if (bg->IsRandom() ? bg->GetTypeID(true) : bg->GetTypeID(false) == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 184142: // Netherstorm Flag
if (bg->GetTypeID(true) == BATTLEGROUND_EY)
if (bg->IsRandom() ? bg->GetTypeID(true) : bg->GetTypeID(false) == BATTLEGROUND_EY)
bg->EventPlayerClickedOnFlag(player, this);
break;
}
@@ -471,7 +471,6 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
// sLog.outDetail(" Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer);
m_curr = m_WayPoints.begin();
m_curr = GetNextWayPoint();
m_next = GetNextWayPoint();
m_pathTime = timer;
@@ -26,8 +26,7 @@ IdleMovementGenerator si_idleMovement;
// But it should not be sent otherwise there are many redundent packets
void IdleMovementGenerator::Initialize(Unit &owner)
{
if (owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
Reset(owner);
}
void
@@ -283,13 +283,8 @@ void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket)
void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
{
sLog.outDebug("Opcode %u", recvPacket.GetOpcode());
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->List(_player);
// this should be OK because the 2 function _were_ the same
HandleChannelList(recvPacket);
}
void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
@@ -4223,14 +4223,9 @@ void AuraEffect::HandleAuraModIncreaseSpeed(AuraApplication const * aurApp, uint
target->UpdateSpeed(MOVE_RUN, true);
}
void AuraEffect::HandleAuraModIncreaseMountedSpeed(AuraApplication const * aurApp, uint8 mode, bool /*apply*/) const
void AuraEffect::HandleAuraModIncreaseMountedSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
return;
Unit * target = aurApp->GetTarget();
target->UpdateSpeed(MOVE_RUN, true);
HandleAuraModIncreaseSpeed(aurApp, mode, apply);
}
void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -4868,20 +4863,9 @@ void AuraEffect::HandleModPowerRegen(AuraApplication const * aurApp, uint8 mode,
// other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
}
void AuraEffect::HandleModPowerRegenPCT(AuraApplication const * aurApp, uint8 mode, bool /*apply*/) const
void AuraEffect::HandleModPowerRegenPCT(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Update manaregen value
if (GetMiscValue() == POWER_MANA)
target->ToPlayer()->UpdateManaRegen();
// other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
HandleModPowerRegen(aurApp, mode, apply);
}
void AuraEffect::HandleModManaRegen(AuraApplication const * aurApp, uint8 mode, bool /*apply*/) const
@@ -5055,17 +5039,9 @@ void AuraEffect::HandleAuraModBlockPercent(AuraApplication const * aurApp, uint8
target->ToPlayer()->UpdateBlockPercentage();
}
void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const * aurApp, uint8 mode, bool /*apply*/) const
void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->ToPlayer()->UpdateManaRegen();
HandleModManaRegen(aurApp, mode, apply);
}
void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -5362,16 +5338,9 @@ void AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication con
target->ToPlayer()->UpdateAttackPowerAndDamage(true);
}
void AuraEffect::HandleAuraModAttackPowerOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool /*apply*/) const
void AuraEffect::HandleAuraModAttackPowerOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit * target = aurApp->GetTarget();
// Recalculate bonus
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAttackPowerAndDamage(false);
HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
}
void AuraEffect::HandleAuraModAttackPowerOfArmor(AuraApplication const * aurApp, uint8 mode, bool /*apply*/) const
+2 -2
View File
@@ -3228,10 +3228,10 @@ void Spell::EffectDualWield(SpellEffIndex /*effIndex*/)
unitTarget->ToCreature()->UpdateDamagePhysical(OFF_ATTACK);
}
void Spell::EffectPull(SpellEffIndex /*effIndex*/)
void Spell::EffectPull(SpellEffIndex effIndex)
{
// TODO: create a proper pull towards distract spell center for distract
sLog.outDebug("WORLD: Spell Effect DUMMY");
EffectNULL(effIndex);
}
void Spell::EffectDistract(SpellEffIndex /*effIndex*/)