diff options
author | Shauren <shauren.trinity@gmail.com> | 2011-11-23 19:17:33 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2011-11-23 19:17:33 +0100 |
commit | 358b33239aea4e7b5b81f829e0b0079e3ab03830 (patch) | |
tree | 1d18bf9c3269a826dc82dc2542a050068aa3ac88 | |
parent | f091360940322c5b674c93e80b59af66881f9953 (diff) |
Core: Fixed remaining C6246: Local declaration of 'x' hides declaration of the same name in outer scope. from previous commit
30 files changed, 217 insertions, 223 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3585f69fae1..9f4871f4d0e 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3484,7 +3484,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning) if (!rankSpellId || rankSpellId == spell_id) continue; - PlayerTalentMap::iterator itr = m_talents[spec]->find(rankSpellId); + itr = m_talents[spec]->find(rankSpellId); if (itr != m_talents[spec]->end()) itr->second->state = PLAYERSPELL_REMOVED; } @@ -4094,8 +4094,6 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) if (uint32 prev_id = sSpellMgr->GetPrevSpellInChain(spell_id)) { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); - // if talent then lesser rank also talent and need learn if (talentCosts) { @@ -4243,8 +4241,8 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns) if (Pet* pet = GetPet()) { // notify player - for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr) - SendClearCooldown(itr->first, pet); + for (CreatureSpellCooldowns::const_iterator itr2 = pet->m_CreatureSpellCooldowns.begin(); itr2 != pet->m_CreatureSpellCooldowns.end(); ++itr2) + SendClearCooldown(itr2->first, pet); // actually clear cooldowns pet->m_CreatureSpellCooldowns.clear(); @@ -4397,9 +4395,9 @@ bool Player::resetTalents(bool no_cost) RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); - for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) + for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); if (!talentInfo) continue; @@ -4835,14 +4833,14 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC { do { - Field* fields = resultItems->Fetch(); - uint32 item_guidlow = fields[11].GetUInt32(); - uint32 item_template = fields[12].GetUInt32(); + Field* fields2 = resultItems->Fetch(); + uint32 item_guidlow = fields2[11].GetUInt32(); + uint32 item_template = fields2[12].GetUInt32(); ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_template); if (!itemProto) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); stmt->setUInt32(0, item_guidlow); trans->Append(stmt); continue; @@ -15899,9 +15897,9 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template { CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); - for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i) - if (cinfo->KillCredit[i] == reqTarget) - entry = cinfo->KillCredit[i]; + for (uint8 j = 0; j < MAX_KILL_CREDIT; ++j) + if (cinfo->KillCredit[j] == reqTarget) + entry = cinfo->KillCredit[j]; } } } @@ -17538,7 +17536,7 @@ void Player::_LoadMailedItems(Mail* mail) { sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), item_guid_low, item_template, mail->messageID); CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", item_guid_low); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); stmt->setUInt32(0, item_guid_low); CharacterDatabase.Execute(stmt); continue; @@ -20125,9 +20123,9 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc if (sWorld->getBoolConfig(CONFIG_INSTANT_TAXI)) { - TaxiNodesEntry const* lastnode = sTaxiNodesStore.LookupEntry(nodes[nodes.size()-1]); + TaxiNodesEntry const* lastPathNode = sTaxiNodesStore.LookupEntry(nodes[nodes.size()-1]); m_taxi.ClearTaxiDestinations(); - TeleportTo(lastnode->map_id, lastnode->x, lastnode->y, lastnode->z, GetOrientation()); + TeleportTo(lastPathNode->map_id, lastPathNode->x, lastPathNode->y, lastPathNode->z, GetOrientation()); return false; } else @@ -24330,9 +24328,9 @@ void Player::ActivateSpec(uint8 spec) // Let client clear his current Actions SendActionButtons(2); // m_actionButtons.clear() is called in the next _LoadActionButtons - for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) + for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); if (!talentInfo) continue; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b99ccd5f35f..54686fda0ed 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1514,8 +1514,8 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo if (GetTypeId() == TYPEID_PLAYER) { - AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); - for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr) + AuraEffectList const& ArPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); + for (AuraEffectList::const_iterator itr = ArPenAuras.begin(); itr != ArPenAuras.end(); ++itr) { // item neutral spell if ((*itr)->GetSpellInfo()->EquippedItemClass == -1) @@ -1687,12 +1687,12 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe if (currentAbsorb < 0) currentAbsorb = 0; - uint32 absorb = currentAbsorb; + uint32 tempAbsorb = uint32(currentAbsorb); bool defaultPrevented = false; - absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, absorb, defaultPrevented); - currentAbsorb = absorb; + absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented); + currentAbsorb = tempAbsorb; if (defaultPrevented) continue; @@ -1705,8 +1705,8 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe dmgInfo.AbsorbDamage(currentAbsorb); - absorb = currentAbsorb; - absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, absorb); + tempAbsorb = currentAbsorb; + absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb); // Check if our aura is using amount to count damage if (absorbAurEff->GetAmount() >= 0) @@ -1738,12 +1738,12 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe if (currentAbsorb < 0) currentAbsorb = 0; - uint32 absorb = currentAbsorb; + uint32 tempAbsorb = currentAbsorb; bool defaultPrevented = false; - absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb, defaultPrevented); - currentAbsorb = absorb; + absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented); + currentAbsorb = tempAbsorb; if (defaultPrevented) continue; @@ -1766,8 +1766,8 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe dmgInfo.AbsorbDamage(currentAbsorb); - absorb = currentAbsorb; - absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb); + tempAbsorb = currentAbsorb; + absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb); // Check if our aura is using amount to count damage if (absorbAurEff->GetAmount() >= 0) @@ -3744,13 +3744,13 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* // Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration())); - if (Aura* newAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID())) + if (Aura* oldAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID())) { if (stealCharge) - newAura->ModCharges(1); + oldAura->ModCharges(1); else - newAura->ModStackAmount(1); - newAura->SetDuration(int32(dur)); + oldAura->ModStackAmount(1); + oldAura->SetDuration(int32(dur)); } else { @@ -5242,7 +5242,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere break; case CLASS_ROGUE: // 39511, 40997, 40998, 41002, 41005, 41011 case CLASS_WARRIOR: // 39511, 40997, 40998, 41002, 41005, 41011 - case CLASS_DEATH_KNIGHT: + case CLASS_DEATH_KNIGHT: triggered_spell_id = RAND(39511, 40997, 40998, 41002, 41005, 41011); cooldown_spell_id = 39511; break; @@ -11970,7 +11970,7 @@ void Unit::Unmount() if (GetTypeId() == TYPEID_PLAYER && GetVehicleKit()) { // Send other players that we are no longer a vehicle - WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4); + data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8+4); data.appendPackGUID(GetGUID()); data << uint32(0); ToPlayer()->SendMessageToSet(&data, true); @@ -14378,8 +14378,8 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); SpellNonMeleeDamage damageInfo(this, target, spellInfo->Id, spellInfo->SchoolMask); - uint32 damage = SpellDamageBonus(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE); - CalculateSpellDamageTaken(&damageInfo, damage, spellInfo); + uint32 newDamage = SpellDamageBonus(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE); + CalculateSpellDamageTaken(&damageInfo, newDamage, spellInfo); DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); SendSpellNonMeleeDamageLog(&damageInfo); DealSpellDamage(&damageInfo, true); @@ -16589,10 +16589,9 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const if (Player const* player = ToPlayer()) return player->GetRatingBonusValue(cr); // Player's pet get resilience from owner - else if (isPet()) - if (Unit* owner = GetOwner()) - if (Player* player = owner->ToPlayer()) - return player->GetRatingBonusValue(cr); + else if (isPet() && GetOwner()) + if (Player* owner = GetOwner()->ToPlayer()) + return owner->GetRatingBonusValue(cr); return 0.0f; } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 683d7eba638..1047ff90174 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -5392,7 +5392,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) // mail open and then not returned for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); stmt->setUInt32(0, itr2->item_guid); CharacterDatabase.Execute(stmt); } @@ -7084,13 +7084,13 @@ void ObjectMgr::LoadQuestPOI() { // The first result should have the highest questId Field* fields = points->Fetch(); - uint32 questId = fields[0].GetUInt32(); - POIs.resize(questId + 1); + uint32 questIdMax = fields[0].GetUInt32(); + POIs.resize(questIdMax + 1); do { - Field* fields = points->Fetch(); + fields = points->Fetch(); uint32 questId = fields[0].GetUInt32(); uint32 id = fields[1].GetUInt32(); diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 57e5818a9ff..7a2368161d8 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -309,11 +309,11 @@ void InstanceSaveManager::LoadResetTimes() while (result->NextRow()); // update reset time for normal instances with the max creature respawn time + X hours - if (PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_GET_MAX_CREATURE_RESPAWNS))) + if (PreparedQueryResult result2 = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_GET_MAX_CREATURE_RESPAWNS))) { do { - Field* fields = result->Fetch(); + Field* fields = result2->Fetch(); uint32 instance = fields[1].GetUInt32(); time_t resettime = time_t(fields[0].GetUInt32() + 2 * HOUR); InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance); diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index f0e21f7f709..b8987be9adb 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -305,7 +305,6 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData) void InstanceScript::DoSendNotifyToInstance(const char *format, ...) { InstanceMap::PlayerList const &PlayerList = instance->GetPlayers(); - InstanceMap::PlayerList::const_iterator i; if (!PlayerList.isEmpty()) { diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 9c395a2319c..bd419482b5b 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2451,7 +2451,7 @@ bool InstanceMap::Reset(uint8 method) return m_mapRefManager.isEmpty(); } -void InstanceMap::PermBindAllPlayers(Player* player) +void InstanceMap::PermBindAllPlayers(Player* source) { if (!IsDungeon()) return; @@ -2459,11 +2459,11 @@ void InstanceMap::PermBindAllPlayers(Player* player) InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!save) { - sLog->outError("Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", player->GetGUIDLow(), player->GetName(), player->GetMap()->GetMapName(), player->GetMapId(), GetInstanceId()); + sLog->outError("Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId()); return; } - Group* group = player->GetGroup(); + Group* group = source->GetGroup(); // group members outside the instance group don't get bound for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) { diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 58db314deaf..9caef8457b8 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -574,7 +574,7 @@ class InstanceMap : public Map bool Reset(uint8 method); uint32 GetScriptId() { return i_script_id; } InstanceScript* GetInstanceScript() { return i_data; } - void PermBindAllPlayers(Player* player); + void PermBindAllPlayers(Player* source); void UnloadAll(); bool CanEnter(Player* player); void SendResetWarnings(uint32 timeLeft) const; diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 1b1aeefb610..f31f1348b44 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -208,8 +208,8 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) if (corpseMap == mapid) break; - InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(corpseMap); - corpseMap = instance ? instance->Parent : 0; + InstanceTemplate const* corpseInstance = sObjectMgr->GetInstanceTemplate(corpseMap); + corpseMap = corpseInstance ? corpseInstance->Parent : 0; } while (corpseMap); if (!corpseMap) @@ -287,8 +287,8 @@ void MapManager::Update(uint32 diff) iter->second->DelayedUpdate(uint32(i_timer.GetCurrent())); sObjectAccessor->Update(uint32(i_timer.GetCurrent())); - for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter) - (*iter)->Update(uint32(i_timer.GetCurrent())); + for (TransportSet::iterator itr = m_Transports.begin(); itr != m_Transports.end(); ++itr) + (*itr)->Update(uint32(i_timer.GetCurrent())); i_timer.SetCurrent(0); } diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 88c9795e896..4236ef49212 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -321,11 +321,11 @@ void Map::ScriptsProcess() source = HashMapHolder<Corpse>::Find(step.sourceGUID); break; case HIGHGUID_MO_TRANSPORT: - for (MapManager::TransportSet::iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter) + for (MapManager::TransportSet::iterator itr2 = sMapMgr->m_Transports.begin(); itr2 != sMapMgr->m_Transports.end(); ++itr2) { - if ((*iter)->GetGUID() == step.sourceGUID) + if ((*itr2)->GetGUID() == step.sourceGUID) { - source = *iter; + source = *itr2; break; } } diff --git a/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp b/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp index 9bbf98ce3fc..c7299eb0caa 100755 --- a/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp @@ -107,9 +107,9 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target) *Target << uint8(unk1); if (unk1) { - uint8 unk2 = (crc != 0x4c1c776d); // If addon is Standard addon CRC - *Target << uint8(unk2); - if (unk2) + uint8 unk = (crc != 0x4c1c776d); // If addon is Standard addon CRC + *Target << uint8(unk); + if (unk) Target->append(tdata, sizeof(tdata)); *Target << uint32(0); diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp index 6863ef17685..1037bf1e9f2 100755 --- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp @@ -1409,9 +1409,9 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) } CharacterDatabase.EscapeString(newname); - if (QueryResult result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid))) + if (QueryResult oldNameResult = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid))) { - std::string oldname = result->Fetch()[0].GetString(); + std::string oldname = oldNameResult->Fetch()[0].GetString(); std::string IP_str = GetRemoteAddress(); sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), IP_str.c_str(), oldname.c_str(), GUID_LOPART(guid), newname.c_str()); } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 152f94ad420..c4487fbd950 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -563,10 +563,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster) amount += (int32)DoneActualBenefit; // Arena - Dampening - if (AuraEffect const* pAurEff = caster->GetAuraEffect(74410, 0)) - AddPctN(amount, pAurEff->GetAmount()); - // Battleground - Dampening - else if (AuraEffect const* pAurEff = caster->GetAuraEffect(74411, 0)) + AuraEffect const* pAurEff = caster->GetAuraEffect(74410, 0); + if (!pAurEff) + pAurEff = caster->GetAuraEffect(74411, 0); // Battleground - Dampening + if (pAurEff) AddPctN(amount, pAurEff->GetAmount()); return amount; @@ -1508,15 +1508,15 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const // Nurturing Instinct if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, SPELLFAMILY_DRUID, 2254, 0)) { - uint32 spellId = 0; + uint32 spellId3 = 0; switch (aurEff->GetId()) { - case 33872: - spellId = 47179; - break; - case 33873: - spellId = 47180; - break; + case 33872: + spellId3 = 47179; + break; + case 33873: + spellId3 = 47180; + break; } target->CastSpell(target, spellId, true, NULL, this); } @@ -4892,8 +4892,8 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool // Living Bomb if (m_spellInfo->SpellFamilyFlags[1] & 0x20000) { - AuraRemoveMode mode = aurApp->GetRemoveMode(); - if (caster && (mode == AURA_REMOVE_BY_ENEMY_SPELL || mode == AURA_REMOVE_BY_EXPIRE)) + AuraRemoveMode removeMode = aurApp->GetRemoveMode(); + if (caster && (removeMode == AURA_REMOVE_BY_ENEMY_SPELL || removeMode == AURA_REMOVE_BY_EXPIRE)) caster->CastSpell(target, GetAmount(), true); } break; @@ -6019,13 +6019,15 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) case 65923: { Unit* permafrostCaster = NULL; - if (Aura* permafrostAura = target->GetAura(66193)) - permafrostCaster = permafrostAura->GetCaster(); - else if (Aura* permafrostAura = target->GetAura(67855)) - permafrostCaster = permafrostAura->GetCaster(); - else if (Aura* permafrostAura = target->GetAura(67856)) - permafrostCaster = permafrostAura->GetCaster(); - else if (Aura* permafrostAura = target->GetAura(67857)) + Aura* permafrostAura = target->GetAura(66193); + if (!permafrostAura) + permafrostAura = target->GetAura(67855); + if (!permafrostAura) + permafrostAura = target->GetAura(67856); + if (!permafrostAura) + permafrostAura = target->GetAura(67857); + + if (permafrostAura) permafrostCaster = permafrostAura->GetCaster(); if (permafrostCaster) @@ -6461,15 +6463,15 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const // damage caster for heal amount if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL) { - uint32 damage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power - if ((int32)damage > gain) - damage = gain; - uint32 absorb = 0; - caster->DealDamageMods(caster, damage, &absorb); - caster->SendSpellNonMeleeDamageLog(caster, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, 0, false, 0, false); + uint32 funnelDamage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power + if ((int32)funnelDamage > gain) + funnelDamage = gain; + uint32 funnelAbsorb = 0; + caster->DealDamageMods(caster, funnelDamage, &funnelAbsorb); + caster->SendSpellNonMeleeDamageLog(caster, GetId(), funnelDamage, GetSpellInfo()->GetSchoolMask(), funnelAbsorb, 0, false, 0, false); CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); - caster->DealDamage(caster, damage, &cleanDamage, NODAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); + caster->DealDamage(caster, funnelDamage, &cleanDamage, NODAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); } uint32 procAttacker = PROC_FLAG_DONE_PERIODIC; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index a484a4976ac..8a4c0a768d8 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -641,23 +641,24 @@ void Spell::InitExplicitTargets(SpellCastTargets const& targets) // try to select correct unit target if not provided by client or by serverside cast if (neededTargets & (TARGET_FLAG_UNIT_MASK)) { - Unit* target = NULL; + Unit* unit = NULL; // try to use player selection as a target if (Player* playerCaster = m_caster->ToPlayer()) { // selection has to be found and to be valid target for the spell if (Unit* selectedUnit = ObjectAccessor::GetUnit(*m_caster, playerCaster->GetSelection())) if (m_spellInfo->CheckExplicitTarget(m_caster, selectedUnit) == SPELL_CAST_OK) - target = selectedUnit; + unit = selectedUnit; } // try to use attacked unit as a target else if ((m_caster->GetTypeId() == TYPEID_UNIT) && neededTargets & (TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT)) - target = m_caster->getVictim(); + unit = m_caster->getVictim(); + // didn't find anything - let's use self as target - if (!target && neededTargets & (TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY | TARGET_FLAG_UNIT_ALLY)) - target = m_caster; + if (!unit && neededTargets & (TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY | TARGET_FLAG_UNIT_ALLY)) + unit = m_caster; - m_targets.SetUnitTarget(target); + m_targets.SetUnitTarget(unit); } } @@ -1218,11 +1219,11 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) if (spellHitTarget) { - SpellMissInfo missInfo = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura); - if (missInfo != SPELL_MISS_NONE) + SpellMissInfo missInfo2 = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura); + if (missInfo2 != SPELL_MISS_NONE) { - if (missInfo != SPELL_MISS_MISS) - m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo); + if (missInfo2 != SPELL_MISS_MISS) + m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo2); m_damage = 0; spellHitTarget = NULL; } @@ -6798,7 +6799,7 @@ void Spell::SelectTrajTargets() if (!dist2d) return; - float dz = m_targets.GetDst()->m_positionZ - m_targets.GetSrc()->m_positionZ; + float srcToDestDelta = m_targets.GetDst()->m_positionZ - m_targets.GetSrc()->m_positionZ; UnitList unitList; SearchAreaTarget(unitList, dist2d, PUSH_IN_THIN_LINE, SPELL_TARGETS_ANY); @@ -6808,8 +6809,9 @@ void Spell::SelectTrajTargets() unitList.sort(Trinity::ObjectDistanceOrderPred(m_caster)); float b = tangent(m_targets.GetElevation()); - float a = (dz - dist2d * b) / (dist2d * dist2d); - if (a > -0.0001f) a = 0; + float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d); + if (a > -0.0001f) + a = 0; DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);) float bestDist = m_spellInfo->GetMaxRange(false); @@ -6837,9 +6839,14 @@ void Spell::SelectTrajTargets() } #define CHECK_DIST {\ - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ - if (dist > bestDist) continue;\ - if (dist < objDist2d + size && dist > objDist2d - size) { bestDist = dist; break; }\ + DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ + if (dist > bestDist)\ + continue;\ + if (dist < objDist2d + size && dist > objDist2d - size)\ + {\ + bestDist = dist;\ + break;\ + }\ } if (!a) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index db48f2b8693..a4cf8e6a469 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -923,7 +923,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - uint32 spell_id = roll_chance_i(50) + spell_id = roll_chance_i(50) ? 29277 // Summon Purified Helboar Meat : 29278; // Summon Toxic Helboar Meat @@ -951,12 +951,16 @@ void Spell::EffectDummy(SpellEffIndex effIndex) return; case 35745: // Socrethar's Stone { - uint32 spell_id; switch (m_caster->GetAreaId()) { - case 3900: spell_id = 35743; break; // Socrethar Portal - case 3742: spell_id = 35744; break; // Socrethar Portal - default: return; + case 3900: + spell_id = 35743; + break; // Socrethar Portal + case 3742: + spell_id = 35744; + break; // Socrethar Portal + default: + return; } m_caster->CastSpell(m_caster, spell_id, true); @@ -1453,7 +1457,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_STRIKE) { uint32 count = unitTarget->GetDiseasesByCaster(m_caster->GetGUID()); - int32 bp = int32(count * m_caster->CountPctFromMaxHealth(int32(m_spellInfo->Effects[EFFECT_0].DamageMultiplier))); + bp = int32(count * m_caster->CountPctFromMaxHealth(int32(m_spellInfo->Effects[EFFECT_0].DamageMultiplier))); // Improved Death Strike if (AuraEffect const* aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0)) AddPctN(bp, m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellInfo(), 2)); @@ -1465,12 +1469,12 @@ void Spell::EffectDummy(SpellEffIndex effIndex) { if (m_caster->IsFriendlyTo(unitTarget)) { - int32 bp = int32(damage * 1.5f); + bp = int32(damage * 1.5f); m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true); } else { - int32 bp = damage; + bp = damage; m_caster->CastCustomSpell(unitTarget, 47632, &bp, NULL, NULL, true); } return; @@ -6348,13 +6352,13 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex) // remove all quest entries for 'entry' from quest log for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) { - uint32 quest = player->GetQuestSlotQuestId(slot); - if (quest == quest_id) + uint32 logQuest = player->GetQuestSlotQuestId(slot); + if (logQuest == quest_id) { player->SetQuestSlot(slot, 0); - // we ignore unequippable quest items in this case, its' still be equipped - player->TakeQuestSourceItem(quest, false); + // we ignore unequippable quest items in this case, it's still be equipped + player->TakeQuestSourceItem(logQuest, false); } } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index c85758c3897..c382cb56a62 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1005,7 +1005,7 @@ SpellThreatEntry const* SpellMgr::GetSpellThreatEntry(uint32 spellID) const else { uint32 firstSpell = GetFirstSpellInChain(spellID); - SpellThreatMap::const_iterator itr = mSpellThreatMap.find(firstSpell); + itr = mSpellThreatMap.find(firstSpell); if (itr != mSpellThreatMap.end()) return &itr->second; } diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 31d8cd3c8f2..b1a3f55314c 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -128,13 +128,13 @@ public: // remove all quest entries for 'entry' from quest log for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) { - uint32 quest = player->GetQuestSlotQuestId(slot); - if (quest == entry) + uint32 logQuest = player->GetQuestSlotQuestId(slot); + if (logQuest == entry) { player->SetQuestSlot(slot, 0); // we ignore unequippable quest items in this case, its' still be equipped - player->TakeQuestSourceItem(quest, false); + player->TakeQuestSourceItem(logQuest, false); } } diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 8bfa010463a..ef4ddf17476 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -126,7 +126,7 @@ public: return false; if (strcmp(teleStr, "$home") == 0) // References target's homebind - { + { if (target) target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation()); else @@ -140,11 +140,11 @@ public: float posX = fieldsDB[2].GetFloat(); float posY = fieldsDB[3].GetFloat(); float posZ = fieldsDB[4].GetFloat(); - + Player::SavePositionInDB(mapId, posX, posY, posZ, 0, zoneId, target_guid); } } - + return true; } @@ -210,8 +210,8 @@ public: if (!*args) return false; - Player* player = handler->getSelectedPlayer(); - if (!player) + Player* target = handler->getSelectedPlayer(); + if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); handler->SetSentErrorMessage(true); @@ -219,7 +219,7 @@ public: } // check online security - if (handler->HasLowerSecurity(player, 0)) + if (handler->HasLowerSecurity(target, 0)) return false; // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r @@ -239,9 +239,9 @@ public: return false; } - std::string nameLink = handler->GetNameLink(player); + std::string nameLink = handler->GetNameLink(target); - Group* grp = player->GetGroup(); + Group* grp = target->GetGroup(); if (!grp) { handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index f754a32fbfc..ebeb7b8f4f4 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -480,55 +480,43 @@ public: } // The visual waypoint - Creature* wpCreature = NULL; wpGuid = target->GetGUIDLow(); - // Did the user select a visual spawnpoint? - if (wpGuid) - wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); - // attempt check creature existence by DB data - else - { - handler->PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, wpGuid); - return false; - } // User did select a visual waypoint? + // Check the creature - if (wpCreature->GetEntry() == VISUAL_WAYPOINT) - { - QueryResult result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); + QueryResult result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); + if (!result) + { + handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow()); + // Select waypoint number from database + // Since we compare float values, we have to deal with + // some difficulties. + // Here we search for all waypoints that only differ in one from 1 thousand + // (0.001) - There is no other way to compare C++ floats with mySQL floats + // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html + const char* maxDIFF = "0.01"; + result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)", + target->GetPositionX(), maxDIFF, target->GetPositionY(), maxDIFF, target->GetPositionZ(), maxDIFF); if (!result) { - handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow()); - // Select waypoint number from database - // Since we compare float values, we have to deal with - // some difficulties. - // Here we search for all waypoints that only differ in one from 1 thousand - // (0.001) - There is no other way to compare C++ floats with mySQL floats - // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html - const char* maxDIFF = "0.01"; - result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)", - wpCreature->GetPositionX(), maxDIFF, wpCreature->GetPositionY(), maxDIFF, wpCreature->GetPositionZ(), maxDIFF); - if (!result) - { - handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid); - return true; - } - } - - do - { - Field* fields = result->Fetch(); - pathid = fields[0].GetUInt32(); - point = fields[1].GetUInt32(); + handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid); + return true; } - while (result->NextRow()); + } - // We have the waypoint number and the GUID of the "master npc" - // Text is enclosed in "<>", all other arguments not - arg_str = strtok((char*)NULL, " "); + do + { + Field* fields = result->Fetch(); + pathid = fields[0].GetUInt32(); + point = fields[1].GetUInt32(); } + while (result->NextRow()); + + // We have the waypoint number and the GUID of the "master npc" + // Text is enclosed in "<>", all other arguments not + arg_str = strtok((char*)NULL, " "); // Check for argument if (show != "del" && show != "move" && arg_str == NULL) diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 719c42c0a57..55254a3b8ee 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -201,7 +201,8 @@ public: //object already removed, not exist if (!pAdd) { - if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) + pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (pAdd) m_auiLackeyGUID[j] = pAdd->GetGUID(); } ++j; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index aea25af87bf..18316d67cd4 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -497,9 +497,9 @@ public: SetEscortPaused(bOnHold); } - void WaypointReached(uint32 i) + void WaypointReached(uint32 wpId) { - switch (i) + switch (wpId) { case 0: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); @@ -1173,8 +1173,8 @@ public: temp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) - temp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him + if (Creature* lktemp = Unit::GetCreature(*me, uiLichKingGUID)) + lktemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him } JumpToNextStep(1500); break; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 9afbeaa0172..c9ab9084d22 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -504,15 +504,14 @@ public: Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) { Map* map = me->GetMap(); - if (!map->IsDungeon()) return NULL; + if (!map->IsDungeon()) + return NULL; Map::PlayerList const &PlayerList = map->GetPlayers(); - Map::PlayerList::const_iterator i; - if (PlayerList.isEmpty()) return NULL; + if (PlayerList.isEmpty()) + return NULL; std::list<Player*> temp; - std::list<Player*>::const_iterator j; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() && me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) @@ -520,7 +519,7 @@ public: if (!temp.empty()) { - j = temp.begin(); + std::list<Player*>::const_iterator j = temp.begin(); advance(j, rand()%temp.size()); return (*j); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index b29a0c491cc..ca853d5684e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -662,11 +662,13 @@ public: { float x, y, z; Unit* target = NULL; - for (uint8 z = 0; z < 6; ++z) + for (uint8 i = 0; i < 6; ++i) { target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0))break; + if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0)) + break; } + if (target) { target->GetPosition(x, y, z); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index fd11b4a4985..7c14845f060 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -330,14 +330,14 @@ public: else { DarkFiend = false; - for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(CREATURE_DARK_FIENDS, DarkFiends[i][0], DarkFiends[i][1], DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + for (uint8 j = 0; j < 8; ++j) + me->SummonCreature(CREATURE_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0); Timer[TIMER_DARKNESS] = 42000; } break; case TIMER_HUMANOIDES: - for (uint8 i = 0; i < 6; ++i) - me->SummonCreature(uint32(Humanoides[i][0]), Humanoides[i][1], Humanoides[i][2], Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0); + for (uint8 j = 0; j < 6; ++j) + me->SummonCreature(uint32(Humanoides[j][0]), Humanoides[j][1], Humanoides[j][2], Humanoides[j][3], Humanoides[j][4], TEMPSUMMON_CORPSE_DESPAWN, 0); Timer[TIMER_HUMANOIDES] = 60000; break; case TIMER_PHASE: diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 0e5233d6620..338f320dcc2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -205,9 +205,9 @@ public: { if (i->getSource()) { - WorldPacket data(SMSG_MESSAGECHAT, 200); - unit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID()); - i->getSource()->GetSession()->SendPacket(&data); + WorldPacket packet(SMSG_MESSAGECHAT, 200); + unit->BuildMonsterChat(&packet, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID()); + i->getSource()->GetSession()->SendPacket(&packet); WorldPacket data2(SMSG_PLAY_SOUND, 4); data2 << 10986; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 02f9435db49..82f16dd7784 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -579,13 +579,16 @@ public: { //After reset case 0: - if (Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f)) - uiJainaGUID = pJaina->GetGUID(); - else if (Unit* pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000)) + { + Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f); + if (!pJaina) + pJaina = pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000); + if (pJaina) uiJainaGUID = pJaina->GetGUID(); bStepping = false; JumpToNextStep(0); break; + } //After waypoint 0 case 1: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); @@ -829,9 +832,10 @@ public: case 37: if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) { - if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f)) - pZombie->UpdateEntry(NPC_ZOMBIE, 0); - else if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f)) + Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f); + if (!pZombie) + pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f); + if (pZombie) pZombie->UpdateEntry(NPC_ZOMBIE, 0); else //There's no one else to transform uiStep++; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 4cc1069b838..43265cb4430 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -680,12 +680,8 @@ public: //Place all units in threat list on outside of stomach Stomach_Map.clear(); - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) - { - //Outside stomach - Stomach_Map[(*i)->getUnitGuid()] = false; - } + for (std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) + Stomach_Map[(*i)->getUnitGuid()] = false; //Outside stomach //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index 2688005ee22..a1e906e214a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -221,10 +221,9 @@ public: { uiVehicle1GUID = pBoss->GetGUID(); uint64 uiGrandChampionBoss1 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* unit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss1 = unit->GetGUID(); + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss1 = unit->GetGUID(); if (instance) { instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID); @@ -237,10 +236,9 @@ public: { uiVehicle2GUID = pBoss->GetGUID(); uint64 uiGrandChampionBoss2 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* unit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss2 = unit->GetGUID(); + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss2 = unit->GetGUID(); if (instance) { instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID); @@ -253,10 +251,9 @@ public: { uiVehicle3GUID = pBoss->GetGUID(); uint64 uiGrandChampionBoss3 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* unit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss3 = unit->GetGUID(); + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss3 = unit->GetGUID(); if (instance) { instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index d4514dd547e..1ee7bcb4120 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -348,10 +348,10 @@ public: m_bTargetDied = true; me->GetMotionMaster()->MoveJump(gormok->GetPositionX(), gormok->GetPositionY(), gormok->GetPositionZ(), 15.0f, 15.0f); } - else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + else if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - m_uiTargetGUID = target->GetGUID(); - me->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 15.0f, 15.0f); + m_uiTargetGUID = target2->GetGUID(); + me->GetMotionMaster()->MoveJump(target2->GetPositionX(), target2->GetPositionY(), target2->GetPositionZ(), 15.0f, 15.0f); } } } diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index b3f1fb1b8b0..6f9481ec226 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -98,8 +98,7 @@ public: me->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); break; case 28: - if (Player* player = GetPlayerForEscort()) - player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me); + player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me); // me->RestoreFaction(); DoScriptText(SAY_END_IRO, me); SetRun(false); diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index 31aea5ea576..610cf684a77 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -998,8 +998,7 @@ public: case 50: DoScriptText(SAY_WIL_END, me, player); - if (Player* player = GetPlayerForEscort()) - player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me); + player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me); break; } } |