From cc14e18664f50983e52398ec02c9f6b2b770ef85 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 27 Aug 2013 16:06:18 +0100 Subject: [PATCH] Core/Misc: Fix compiler warnings --- src/server/game/Entities/Unit/StatSystem.cpp | 9 ++++----- src/server/game/Entities/Unit/Unit.cpp | 10 +++++----- src/server/game/Globals/ObjectMgr.cpp | 15 +++++++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index e94fb72638..d2b7fc6d8a 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -1109,11 +1109,10 @@ bool Guardian::UpdateStats(Stats stat) float mod = 0.75f; if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH)) { - switch (stat) - { - case STAT_STAMINA: mod = 0.3f; break; // Default Owner's Stamina scale - case STAT_STRENGTH: mod = 0.7f; break; // Default Owner's Strength scale - } + if (stat == STAT_STAMINA) + mod = 0.3f; // Default Owner's Stamina scale + else + mod = 0.7f; // Default Owner's Strength scale // Check just if owner has Ravenous Dead since it's effect is not an aura AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ef4829a878..39d9d4991f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15009,13 +15009,13 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const { if (!isVictim) { - uint32 WeaponSpeed = GetAttackTime(attType); - chance = GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto); + uint32 weaponSpeed = GetAttackTime(attType); + chance = GetPPMProcChance(weaponSpeed, spellProcEvent->ppmRate, spellProto); } - else + else if (victim) { - uint32 WeaponSpeed = victim->GetAttackTime(attType); - chance = victim->GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto); + uint32 weaponSpeed = victim->GetAttackTime(attType); + chance = victim->GetPPMProcChance(weaponSpeed, spellProcEvent->ppmRate, spellProto); } } // Apply chance modifer aura diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index b8899ae0cd..4d6eab411d 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6631,17 +6631,20 @@ void ObjectMgr::LoadPetNumber() std::string ObjectMgr::GeneratePetName(uint32 entry) { - StringVector & list0 = _petHalfName0[entry]; - StringVector & list1 = _petHalfName1[entry]; + StringVector& list0 = _petHalfName0[entry]; + StringVector& list1 = _petHalfName1[entry]; if (list0.empty() || list1.empty()) { CreatureTemplate const* cinfo = GetCreatureTemplate(entry); - char* petname = GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale()); - if (!petname) - return cinfo->Name; + if (!cinfo) + return std::string(); - return std::string(petname); + char* petname = GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale()); + if (petname) + return std::string(petname); + else + return cinfo->Name; } return *(list0.begin()+urand(0, list0.size()-1)) + *(list1.begin()+urand(0, list1.size()-1));