From 7d4670341387568e89d21a8e0d702230e0ab962d Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 17 May 2013 21:30:02 +0200 Subject: Core/Misc: Another batch of fixes for issues found by static analysis --- src/server/game/AI/SmartScripts/SmartScript.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/server/game/AI/SmartScripts') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b4053da2932..b0b72b8c44a 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1470,8 +1470,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!einfo) { TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry()); + delete targets; return; } + npc->SetCurrentEquipmentId(equipId); slot[0] = einfo->ItemEntry[0]; slot[1] = einfo->ItemEntry[1]; -- cgit v1.2.3 From 98ad7309c960e5c3354d544e520b2f3185675637 Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 17 May 2013 23:08:28 -0500 Subject: * Another small batch of fixes from static analysis tool. --- src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 1 + src/server/game/AI/SmartScripts/SmartScript.cpp | 1 + src/server/game/Battlegrounds/BattlegroundMgr.cpp | 2 ++ src/server/game/Entities/Unit/Unit.cpp | 2 ++ src/server/game/Spells/Auras/SpellAuraEffects.cpp | 13 +++++-------- 5 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/server/game/AI/SmartScripts') diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 01f764bb0da..4d2aa9b469f 100644 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -251,6 +251,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); } + break; default: TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition); break; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b0b72b8c44a..576d77a2e24 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2578,6 +2578,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui return; ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->getVictim()); + break; } case SMART_EVENT_FRIENDLY_HEALTH: { diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index db1956ef0a4..7991df10099 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -327,6 +327,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) *data << uint32(0); break; } + break; case BATTLEGROUND_AV: *data << uint32(0x00000005); // count of next fields *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted @@ -517,6 +518,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original { case BATTLEGROUND_RB: isRandom = true; + /// Intentional fallback, "All Arenas" is random too case BATTLEGROUND_AA: bgTypeId = GetRandomBG(originalBgTypeId); break; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5fb106b4913..a8b17fbf097 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10466,6 +10466,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas default: return false; } + break; case SPELL_DAMAGE_CLASS_MAGIC: { if (schoolMask & SPELL_SCHOOL_MASK_NORMAL) @@ -10612,6 +10613,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas break; } } + /// Intentional fallback. Calculate critical strike chance for both Ranged and Melee spells case SPELL_DAMAGE_CLASS_RANGED: { if (victim) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 53c5da30936..ab971c9f1c4 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1697,22 +1697,19 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo switch (GetMiscValue()) { case FORM_CAT: - { int32 basePoints = int32(std::min(oldPower, FurorChance)); target->SetPower(POWER_ENERGY, 0); target->CastCustomSpell(target, 17099, &basePoints, NULL, NULL, true, NULL, this); - } - break; + break; case FORM_BEAR: case FORM_DIREBEAR: - if (urand(0, 99) < FurorChance) - target->CastSpell(target, 17057, true); + if (urand(0, 99) < FurorChance) + target->CastSpell(target, 17057, true); + break; default: - { uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance); target->SetPower(POWER_ENERGY, newEnergy); - } - break; + break; } break; } -- cgit v1.2.3