Skip to content

Commit

Permalink
[12121] Fix more warnings - close #4
Browse files Browse the repository at this point in the history
* Remove warning: enumeration value '<value>' not handled in switch
* Remove warning: enumeral and non-enumeral type in conditional expression
* Remove warning: too many arguments for format

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
  • Loading branch information
Shyax authored and Schmoozerd committed Aug 28, 2012
1 parent e1e4376 commit 8209548
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/game/AuctionHouseMgr.cpp
Expand Up @@ -557,6 +557,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit)
{
case ALLIANCE: houseid = player->GetAuctionAccessMode() == 0 ? 1 : 6; break;
case HORDE: houseid = player->GetAuctionAccessMode() == 0 ? 6 : 1; break;
default: break;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/BattleGround/BattleGround.cpp
Expand Up @@ -73,7 +73,7 @@ namespace MaNGOS
data << ObjectGuid(targetGuid);
data << uint32(strlen(text) + 1);
data << text;
data << uint8(i_source ? i_source->GetChatTag() : CHAT_TAG_NONE);
data << uint8(i_source ? i_source->GetChatTag() : uint8(CHAT_TAG_NONE));
}

ChatMsg i_msgtype;
Expand Down Expand Up @@ -152,7 +152,7 @@ namespace MaNGOS
data << ObjectGuid(targetGuid);
data << uint32(strlen(str) + 1);
data << str;
data << uint8(i_source ? i_source->GetChatTag() : CHAT_TAG_NONE);
data << uint8(i_source ? i_source->GetChatTag() : uint8(CHAT_TAG_NONE));
}
private:

Expand Down
2 changes: 1 addition & 1 deletion src/game/Channel.cpp
Expand Up @@ -574,7 +574,7 @@ void Channel::Say(ObjectGuid p, const char* what, uint32 lang)
data << ObjectGuid(p);
data << uint32(messageLength);
data << what;
data << uint8(plr ? plr->GetChatTag() : CHAT_TAG_NONE);
data << uint8(plr ? plr->GetChatTag() : uint8(CHAT_TAG_NONE));

SendToAll(&data, !m_players[p].IsModerator() ? p : ObjectGuid());
}
Expand Down
1 change: 1 addition & 0 deletions src/game/CharacterHandler.cpp
Expand Up @@ -222,6 +222,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recv_data)
{
case ALLIANCE: disabled = mask & (1 << 0); break;
case HORDE: disabled = mask & (1 << 1); break;
default: break;
}

if (disabled)
Expand Down
2 changes: 2 additions & 0 deletions src/game/GameObject.cpp
Expand Up @@ -434,6 +434,8 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
m_UniqueUsers.clear();
SetLootState(GO_READY);
return; // SetLootState and return because go is treated as "burning flag" due to GetGoAnimProgress() being 100 and would be removed on the client
default:
break;
}

if (!HasStaticDBSpawnData()) // Remove wild summoned after use
Expand Down
2 changes: 1 addition & 1 deletion src/game/MapManager.cpp
Expand Up @@ -401,7 +401,7 @@ BattleGroundMap* MapManager::CreateBattleGroundMap(uint32 id, uint32 InstanceId,

PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), bg->GetMinLevel());

uint8 spawnMode = bracketEntry ? bracketEntry->difficulty : REGULAR_DIFFICULTY;
uint8 spawnMode = bracketEntry ? bracketEntry->difficulty : uint8(REGULAR_DIFFICULTY);

BattleGroundMap* map = new BattleGroundMap(id, i_gridCleanUpDelay, InstanceId, spawnMode);
MANGOS_ASSERT(map->IsBattleGroundOrArena());
Expand Down
5 changes: 5 additions & 0 deletions src/game/Pet.cpp
Expand Up @@ -917,6 +917,11 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
// this enables popup window (pet abandon, cancel)
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
break;
case GUARDIAN_PET:
case MINI_PET:
case PROTECTOR_PET:
default:
break;
}

SetLevel(petlevel);
Expand Down
5 changes: 3 additions & 2 deletions src/game/Player.cpp
Expand Up @@ -174,6 +174,7 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 leve
{
case ALLIANCE: SetTaximaskNode(100); break;
case HORDE: SetTaximaskNode(99); break;
default: break;
}
// level dependent taxi hubs
if (level >= 68)
Expand Down Expand Up @@ -2299,7 +2300,7 @@ void Player::SetGameMaster(bool on)

// restore phase
AuraList const& phases = GetAurasByType(SPELL_AURA_PHASE);
SetPhaseMask(!phases.empty() ? phases.front()->GetMiscValue() : PHASEMASK_NORMAL, false);
SetPhaseMask(!phases.empty() ? phases.front()->GetMiscValue() : uint32(PHASEMASK_NORMAL), false);

CallForAllControlledUnits(SetGameMasterOffHelper(getFaction()), CONTROLLED_PET | CONTROLLED_TOTEMS | CONTROLLED_GUARDIANS | CONTROLLED_CHARM);

Expand Down Expand Up @@ -10706,7 +10707,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
return EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE;

// if swap ignore item (equipped also)
if (InventoryResult res2 = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT))
if (InventoryResult res2 = CanEquipUniqueItem(pItem, swap ? eslot : uint8(NULL_SLOT)))
return res2;

// check unique-equipped special item classes
Expand Down
2 changes: 1 addition & 1 deletion src/game/QuestHandler.cpp
Expand Up @@ -238,7 +238,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recv_data)

if (reward >= QUEST_REWARD_CHOICES_COUNT)
{
sLog.outError("Error in CMSG_QUESTGIVER_CHOOSE_REWARD - %s tried to get invalid reward (%u) (probably packet hacking)", _player->GetGuidStr().c_str(), _player->GetGUIDLow(), reward);
sLog.outError("Error in CMSG_QUESTGIVER_CHOOSE_REWARD - %s tried to get invalid reward (%u) (probably packet hacking)", _player->GetGuidStr().c_str(), reward);
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/game/Spell.cpp
Expand Up @@ -1079,7 +1079,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
if (m_canTrigger && missInfo != SPELL_MISS_REFLECT)
{
caster->ProcDamageAndSpell(unitTarget, real_caster ? procAttacker : PROC_FLAG_NONE, procVictim, procEx, addhealth, m_attackType, m_spellInfo);
caster->ProcDamageAndSpell(unitTarget, real_caster ? procAttacker : uint32(PROC_FLAG_NONE), procVictim, procEx, addhealth, m_attackType, m_spellInfo);
}

int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit, absorb);
Expand Down Expand Up @@ -1114,7 +1114,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)

// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
if (m_canTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unitTarget, real_caster ? procAttacker : PROC_FLAG_NONE, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo);
caster->ProcDamageAndSpell(unitTarget, real_caster ? procAttacker : uint32(PROC_FLAG_NONE), procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo);

// trigger weapon enchants for weapon based spells; exclude spells that stop attack, because may break CC
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON &&
Expand Down Expand Up @@ -1158,7 +1158,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
procEx = createProcExtendMask(&damageInfo, missInfo);
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
if (m_canTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unit, real_caster ? procAttacker : PROC_FLAG_NONE, procVictim, procEx, 0, m_attackType, m_spellInfo);
caster->ProcDamageAndSpell(unit, real_caster ? procAttacker : uint32(PROC_FLAG_NONE), procVictim, procEx, 0, m_attackType, m_spellInfo);
}

// Call scripted function for AI if this spell is casted upon a creature
Expand Down
12 changes: 11 additions & 1 deletion src/game/SpellAuras.cpp
Expand Up @@ -6625,6 +6625,16 @@ void Aura::HandleShapeshiftBoosts(bool apply)
case FORM_STEALTH:
case FORM_CREATURECAT:
case FORM_CREATUREBEAR:
case FORM_STEVES_GHOUL:
case FORM_THARONJA_SKELETON:
case FORM_TEST_OF_STRENGTH:
case FORM_BLB_PLAYER:
case FORM_SHADOW_DANCE:
case FORM_TEST:
case FORM_ZOMBIE:
case FORM_UNDEAD:
case FORM_FRENZY:
case FORM_NONE:
break;
}

Expand Down Expand Up @@ -8559,7 +8569,7 @@ void Aura::HandlePhase(bool apply, bool Real)
target->RemoveAurasDueToSpell(phases.front()->GetId(), GetHolder());
}

target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, true);
target->SetPhaseMask(apply ? GetMiscValue() : uint32(PHASEMASK_NORMAL), true);
// no-phase is also phase state so same code for apply and remove
if (GetEffIndex() == EFFECT_INDEX_0 && target->GetTypeId() == TYPEID_PLAYER)
{
Expand Down
6 changes: 6 additions & 0 deletions src/game/SpellEffects.cpp
Expand Up @@ -7913,6 +7913,12 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
unitTarget->CastSpell(unitTarget, 59815, true);
break;
}
// These are not restored
case POWER_FOCUS:
case POWER_HAPPINESS:
case POWER_RUNE:
case POWER_HEALTH:
break;
}
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/game/Unit.cpp
Expand Up @@ -3486,7 +3486,7 @@ uint32 Unit::GetWeaponSkillValue(WeaponAttackType attType, Unit const* target) c
return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact

// weapon skill or (unarmed for base attack)
uint32 skill = item ? item->GetSkill() : SKILL_UNARMED;
uint32 skill = item ? item->GetSkill() : uint32(SKILL_UNARMED);

// in PvP use full skill instead current skill value
value = (target && target->GetTypeId() == TYPEID_PLAYER)
Expand Down Expand Up @@ -7373,7 +7373,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAttackTyp
bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || IsSpellHaveEffect(spellProto, SPELL_EFFECT_SCHOOL_DAMAGE)));
Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(attType, true, false) : NULL;
uint32 creatureTypeMask = pVictim->GetCreatureTypeMask();
uint32 schoolMask = spellProto ? spellProto->SchoolMask : GetMeleeDamageSchoolMask();
uint32 schoolMask = spellProto ? spellProto->SchoolMask : uint32(GetMeleeDamageSchoolMask());

// FLAT damage bonus auras
// =======================
Expand Down Expand Up @@ -7626,7 +7626,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* pCaster, uint32 pdamage, WeaponAttackTy

// differentiate for weapon damage based spells
bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || IsSpellHaveEffect(spellProto, SPELL_EFFECT_SCHOOL_DAMAGE)));
uint32 schoolMask = spellProto ? spellProto->SchoolMask : GetMeleeDamageSchoolMask();
uint32 schoolMask = spellProto ? spellProto->SchoolMask : uint32(GetMeleeDamageSchoolMask());
uint32 mechanicMask = spellProto ? GetAllSpellMechanicMask(spellProto) : 0;

// Shred also have bonus as MECHANIC_BLEED damages
Expand Down
2 changes: 1 addition & 1 deletion src/game/World.cpp
Expand Up @@ -957,7 +957,7 @@ void World::SetInitialWorldSettings()
// No SQL injection as values are treated as integers

// not send custom type REALM_FFA_PVP to realm list
uint32 server_type = IsFFAPvPRealm() ? REALM_TYPE_PVP : getConfig(CONFIG_UINT32_GAME_TYPE);
uint32 server_type = IsFFAPvPRealm() ? uint32(REALM_TYPE_PVP) : getConfig(CONFIG_UINT32_GAME_TYPE);
uint32 realm_zone = getConfig(CONFIG_UINT32_REALM_ZONE);
LoginDatabase.PExecute("UPDATE realmlist SET icon = %u, timezone = %u WHERE id = '%u'", server_type, realm_zone, realmID);

Expand Down
1 change: 1 addition & 0 deletions src/shared/Database/SqlPreparedStatement.cpp
Expand Up @@ -152,6 +152,7 @@ void SqlPlainPreparedStatement::DataToString(const SqlStmtFieldData& data, std::
m_pConn.DB().escape_string(tmp);
fmt << "'" << tmp << "'";
}
case FIELD_NONE: break;
break;
}
}
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12120"
#define REVISION_NR "12121"
#endif // __REVISION_NR_H__

0 comments on commit 8209548

Please sign in to comment.