diff options
| author | Shauren <shauren.trinity@gmail.com> | 2011-03-08 19:11:02 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2011-03-08 19:11:02 +0100 |
| commit | 9710c41a40a311d363304853b33d0fee3f751383 (patch) | |
| tree | 8d98282b74329fa225af85b42678d6ffbddb1da7 /src/server/game | |
| parent | cbbfb52ca766cb3b9e8cb2a6e9cf04f42d356ab1 (diff) | |
More warning fixes
Diffstat (limited to 'src/server/game')
| -rwxr-xr-x | src/server/game/AI/CoreAI/PetAI.cpp | 30 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 3 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 | ||||
| -rwxr-xr-x | src/server/game/Chat/Commands/Level3.cpp | 5 | ||||
| -rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 4 | ||||
| -rwxr-xr-x | src/server/game/Entities/Player/Player.h | 13 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 54 | ||||
| -rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 6 | ||||
| -rwxr-xr-x | src/server/game/Scripting/MapScripts.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Server/Protocol/Handlers/SpellHandler.cpp | 5 | ||||
| -rwxr-xr-x | src/server/game/Skills/SkillDiscovery.cpp | 30 | ||||
| -rwxr-xr-x | src/server/game/Spells/SpellMgr.h | 9 |
12 files changed, 86 insertions, 77 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 115f65311b9..db6aa16910b 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -317,20 +317,28 @@ Unit *PetAI::SelectNextTarget() if (me->HasReactState(REACT_PASSIVE)) return NULL; - Unit *target = NULL; + Unit *target = me->getAttackerForHelper(); targetHasCC = false; - // Check pet's attackers first to prevent dragging mobs back - // to owner - if ((target = me->getAttackerForHelper()) && !_CheckTargetCC(target)) {} - // Check owner's attackers if pet didn't have any - else if (me->GetCharmerOrOwner() && (target = me->GetCharmerOrOwner()->getAttackerForHelper()) && !_CheckTargetCC(target)) {} - // 3.0.2 - Pets now start attacking their owners target in defensive mode as soon as the hunter does - else if (me->GetCharmerOrOwner() && (target = me->GetCharmerOrOwner()->getVictim()) && !_CheckTargetCC(target)) {} - // Default - else return NULL; + // Check pet's attackers first to prevent dragging mobs back to owner + if (target && !_CheckTargetCC(target)) + return target; - return target; + if (me->GetCharmerOrOwner()) + { + // Check owner's attackers if pet didn't have any + target = me->GetCharmerOrOwner()->getAttackerForHelper(); + if (target && !_CheckTargetCC(target)) + return target; + + // 3.0.2 - Pets now start attacking their owners target in defensive mode as soon as the hunter does + target = me->GetCharmerOrOwner()->getVictim(); + if (target && !_CheckTargetCC(target)) + return target; + } + + // Default + return NULL; } void PetAI::HandleReturnMovement() diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 127994648cc..31fedb11699 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -316,7 +316,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e) } else { - switch (e.event.type) + uint32 type = e.event.type; + switch (type) { case SMART_EVENT_UPDATE: case SMART_EVENT_UPDATE_IC: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index ec02d44b607..01568ee41f0 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -149,7 +149,7 @@ enum SMART_EVENT SMART_EVENT_GOSSIP_SELECT = 62, //1 // menuID, actionID SMART_EVENT_JUST_CREATED = 63, //1 // none SMART_EVENT_GOSSIP_HELLO = 64, //1 // none - SMART_EVENT_FOLLOW_COMPLETED = 65, //1 // none + SMART_EVENT_FOLLOW_COMPLETED = 65, //1 // none SMART_EVENT_DUMMY_EFFECT = 66, //1 // spellId, effectIndex SMART_EVENT_END = 67, diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 6625d954127..a50fae33b19 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -4122,8 +4122,11 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char *args) uint16 MapId = 0; if (strcmp(pMap, "all")) - if (!(MapId = uint16(atoi(pMap)))) + { + MapId = uint16(atoi(pMap)); + if (!MapId) return false; + } for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 52f24381d96..e3e3936009c 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2753,10 +2753,10 @@ void Player::GiveLevel(uint8 level) sScriptMgr->OnPlayerLevelChanged(this, level); PlayerLevelInfo info; - sObjectMgr->GetPlayerLevelInfo(getRace(),getClass(),level,&info); + sObjectMgr->GetPlayerLevelInfo(getRace(), getClass(), level, &info); PlayerClassLevelInfo classInfo; - sObjectMgr->GetPlayerClassLevelInfo(getClass(),level,&classInfo); + sObjectMgr->GetPlayerClassLevelInfo(getClass(), level, &classInfo); // send levelup info to client WorldPacket data(SMSG_LEVELUP_INFO, (4+4+MAX_POWERS*4+MAX_STATS*4)); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 8ee626d18bb..3052e98f9ce 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2732,10 +2732,11 @@ void AddItemsSetItem(Player*player,Item *item); void RemoveItemsSetItem(Player*player,ItemPrototype const *proto); // "the bodies of template functions must be made available in a header file" -template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell * spell) +template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if (!spellInfo) return 0; + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (!spellInfo) + return 0; float totalmul = 1.0f; int32 totalflat = 0; @@ -2751,7 +2752,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas if (!mod->ownerAura) ASSERT(mod->charges == 0); - if (!IsAffectedBySpellmod(spellInfo,mod,spell)) + if (!IsAffectedBySpellmod(spellInfo, mod, spell)) continue; if (mod->type == SPELLMOD_FLAT) @@ -2762,8 +2763,8 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas if (basevalue == T(0)) continue; - // special case (skip >10sec spell casts for instant cast setting) - if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) + // special case (skip > 10sec spell casts for instant cast setting) + if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) continue; AddPctN(totalmul, mod->value); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3afd186ae65..2ddce4bd1a4 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16178,7 +16178,7 @@ uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float c uint32 Unit::GetModelForForm(ShapeshiftForm form) { - switch(form) + switch (form) { case FORM_CAT: // Based on Hair color @@ -16347,39 +16347,39 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form) return 21243; return 21244; default: + break; + } + + uint32 modelid = 0; + SpellShapeshiftEntry const* formEntry = sSpellShapeshiftStore.LookupEntry(form); + if (formEntry && formEntry->modelID_A) + { + // Take the alliance modelid as default + if (GetTypeId() != TYPEID_PLAYER) + return formEntry->modelID_A; + else { - uint32 modelid = 0; - SpellShapeshiftEntry const* formEntry = sSpellShapeshiftStore.LookupEntry(form); - if (formEntry && formEntry->modelID_A) - { - // Take the alliance modelid as default - if (GetTypeId() != TYPEID_PLAYER) - return formEntry->modelID_A; - else - { - if (Player::TeamForRace(getRace()) == ALLIANCE) - modelid = formEntry->modelID_A; - else - modelid = formEntry->modelID_H; + if (Player::TeamForRace(getRace()) == ALLIANCE) + modelid = formEntry->modelID_A; + else + modelid = formEntry->modelID_H; - // If the player is horde but there are no values for the horde modelid - take the alliance modelid - if (!modelid && Player::TeamForRace(getRace()) == HORDE) - modelid = formEntry->modelID_A; - } - } - return modelid; + // If the player is horde but there are no values for the horde modelid - take the alliance modelid + if (!modelid && Player::TeamForRace(getRace()) == HORDE) + modelid = formEntry->modelID_A; } } - return 0; + + return modelid; } uint32 Unit::GetModelForTotem(PlayerTotemType totemType) { - switch(getRace()) + switch (getRace()) { case RACE_ORC: { - switch(totemType) + switch (totemType) { case SUMMON_TYPE_TOTEM_FIRE: //fire return 30758; @@ -16394,7 +16394,7 @@ uint32 Unit::GetModelForTotem(PlayerTotemType totemType) } case RACE_DWARF: { - switch(totemType) + switch (totemType) { case SUMMON_TYPE_TOTEM_FIRE: //fire return 30754; @@ -16409,7 +16409,7 @@ uint32 Unit::GetModelForTotem(PlayerTotemType totemType) } case RACE_TROLL: { - switch(totemType) + switch (totemType) { case SUMMON_TYPE_TOTEM_FIRE: //fire return 30762; @@ -16424,7 +16424,7 @@ uint32 Unit::GetModelForTotem(PlayerTotemType totemType) } case RACE_TAUREN: { - switch(totemType) + switch (totemType) { case SUMMON_TYPE_TOTEM_FIRE: //fire return 4589; @@ -16439,7 +16439,7 @@ uint32 Unit::GetModelForTotem(PlayerTotemType totemType) } case RACE_DRAENEI: { - switch(totemType) + switch (totemType) { case SUMMON_TYPE_TOTEM_FIRE: //fire return 19074; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 9e5350124b0..ae028b7b7a1 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -197,8 +197,8 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang) bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clickee) const { - Player const* playerClicker = NULL; - if (playerClicker = clicker->ToPlayer()) + Player const* playerClicker = clicker->ToPlayer(); + if (playerClicker) { if (questStart) { @@ -6736,7 +6736,7 @@ uint32 ObjectMgr::GenerateAuctionID() uint64 ObjectMgr::GenerateEquipmentSetGuid() { - if (m_equipmentSetGuid >= 0xFFFFFFFFFFFFFFFEll) + if (m_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL)) { sLog->outError("EquipmentSet guid overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 507e40b67d3..7460acf43ef 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -324,7 +324,7 @@ void Map::ScriptsProcess() { if ((*iter)->GetGUID() == step.sourceGUID) { - source = reinterpret_cast<Object*>(*iter); + source = *iter; break; } } diff --git a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp index 062d7fae437..862a2ed0e27 100755 --- a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp @@ -544,7 +544,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recv_data*/) } } -void WorldSession::HandleSpellClick(WorldPacket & recv_data) +void WorldSession::HandleSpellClick(WorldPacket& recv_data) { uint64 guid; recv_data >> guid; @@ -559,8 +559,7 @@ void WorldSession::HandleSpellClick(WorldPacket & recv_data) if (!unit->IsInWorld()) return; - bool unusedReturnValue = unit->HandleSpellClick(_player); - // ^ ignore compiler warning + unit->HandleSpellClick(_player); } void WorldSession::HandleMirrrorImageDataRequest(WorldPacket & recv_data) diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index c2af8dd1e48..973d37b90cc 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -70,7 +70,7 @@ void LoadSkillDiscoveryTable() uint32 spellId = fields[0].GetUInt32(); int32 reqSkillOrSpell = fields[1].GetInt32(); - uint32 reqSkillValue = fields[2].GetInt32(); + uint32 reqSkillValue = fields[2].GetUInt32(); float chance = fields[3].GetFloat(); if (chance <= 0) // chance @@ -82,13 +82,14 @@ void LoadSkillDiscoveryTable() if (reqSkillOrSpell > 0) // spell case { - SpellEntry const* reqSpellEntry = sSpellStore.LookupEntry(reqSkillOrSpell); + uint32 absReqSkillOrSpell = uint32(reqSkillOrSpell); + SpellEntry const* reqSpellEntry = sSpellStore.LookupEntry(absReqSkillOrSpell); if (!reqSpellEntry) { - if (reportedReqSpells.find(reqSkillOrSpell) == reportedReqSpells.end()) + if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end()) { sLog->outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table",spellId,reqSkillOrSpell); - reportedReqSpells.insert(reqSkillOrSpell); + reportedReqSpells.insert(absReqSkillOrSpell); } continue; } @@ -98,12 +99,12 @@ void LoadSkillDiscoveryTable() // explicit discovery ability !IsExplicitDiscoverySpell(reqSpellEntry)) { - if (reportedReqSpells.find(reqSkillOrSpell) == reportedReqSpells.end()) + if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end()) { sLog->outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table", - reqSkillOrSpell,spellId); - reportedReqSpells.insert(reqSkillOrSpell); + absReqSkillOrSpell, spellId); + reportedReqSpells.insert(absReqSkillOrSpell); } continue; } @@ -146,7 +147,7 @@ void LoadSkillDiscoveryTable() if (!IsExplicitDiscoverySpell(spellEntry)) continue; - if (SkillDiscoveryStore.find(spell_id) == SkillDiscoveryStore.end()) + if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end()) sLog->outErrorDb("Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table",spell_id); } @@ -158,12 +159,12 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) { // explicit discovery spell chances (always success if case exist) // in this case we have both skill and spell - SkillDiscoveryMap::const_iterator tab = SkillDiscoveryStore.find(spellId); + SkillDiscoveryMap::const_iterator tab = SkillDiscoveryStore.find(int32(spellId)); if (tab == SkillDiscoveryStore.end()) return 0; SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId); - uint32 skillvalue = bounds.first != bounds.second ? player->GetSkillValue(bounds.first->second->skillId) : 0; + uint32 skillvalue = bounds.first != bounds.second ? player->GetSkillValue(bounds.first->second->skillId) : uint32(0); float full_chance = 0; for (SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) @@ -193,13 +194,10 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) bool HasDiscoveredAllSpells(uint32 spellId, Player* player) { - SkillDiscoveryMap::const_iterator tab = SkillDiscoveryStore.find(spellId); + SkillDiscoveryMap::const_iterator tab = SkillDiscoveryStore.find(int32(spellId)); if (tab == SkillDiscoveryStore.end()) return true; - SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId); - uint32 skillvalue = bounds.first != bounds.second ? player->GetSkillValue(bounds.first->second->skillId) : 0; - for (SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) if (!player->HasSpell(item_iter->spellId)) return false; @@ -209,10 +207,10 @@ bool HasDiscoveredAllSpells(uint32 spellId, Player* player) uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player) { - uint32 skillvalue = skillId ? player->GetSkillValue(skillId) : 0; + uint32 skillvalue = skillId ? player->GetSkillValue(skillId) : uint32(0); // check spell case - SkillDiscoveryMap::const_iterator tab = SkillDiscoveryStore.find(spellId); + SkillDiscoveryMap::const_iterator tab = SkillDiscoveryStore.find(int32(spellId)); if (tab != SkillDiscoveryStore.end()) { diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 1e2e6035a7e..031b77f0bd6 100755 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -537,7 +537,7 @@ inline uint32 GetDispellMask(DispelType dispel) if (dispel == DISPEL_ALL) return DISPEL_ALL_MASK; else - return (1 << dispel); + return uint32(1 << dispel); } // Diminishing Returns interaction with spells @@ -1087,16 +1087,15 @@ class SpellMgr } if (SpellDiff->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC) { - uint8 baseMode = mode; + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "GetSpellForDifficultyFromSpell: spell %u mode %u spell is NULL, using mode %u", spell->Id, mode, mode-2); mode -= 2; - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "GetSpellForDifficultyFromSpell: spell %u mode %u spell is NULL, using mode %u", spell->Id, baseMode, mode); } if (SpellDiff->SpellID[mode] <= 0) { sLog->outErrorDb("GetSpellForDifficultyFromSpell: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spell->Id, mode); return spell; } - SpellEntry const* newSpell = sSpellStore.LookupEntry(SpellDiff->SpellID[mode]); + SpellEntry const* newSpell = sSpellStore.LookupEntry(uint32(SpellDiff->SpellID[mode])); if (!newSpell) { sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "GetSpellForDifficultyFromSpell: spell %u not found in SpellStore. Check spelldifficulty_dbc!", SpellDiff->SpellID[mode]); @@ -1198,7 +1197,7 @@ class SpellMgr return spell_id; } - uint32 IsArenaAllowedEnchancment(uint32 ench_id) const + bool IsArenaAllowedEnchancment(uint32 ench_id) const { return mEnchantCustomAttr[ench_id]; } |
