More warning fixes

This commit is contained in:
Shauren
2011-03-08 19:11:02 +01:00
parent cbbfb52ca7
commit 9710c41a40
19 changed files with 119 additions and 96 deletions
+19 -11
View File
@@ -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()
@@ -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:
@@ -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,
+4 -1
View File
@@ -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)
{
+2 -2
View File
@@ -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));
+7 -6
View File
@@ -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);
+28 -28
View File
@@ -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:
{
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;
break;
}
// 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;
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 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;
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -324,7 +324,7 @@ void Map::ScriptsProcess()
{
if ((*iter)->GetGUID() == step.sourceGUID)
{
source = reinterpret_cast<Object*>(*iter);
source = *iter;
break;
}
}
@@ -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)
+14 -16
View File
@@ -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())
{
+4 -5
View File
@@ -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];
}
@@ -182,7 +182,7 @@ class npc_azure_ring_captain : public CreatureScript
}
}
void UpdateAI(const uint32 diff)
void UpdateAI(const uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -81,6 +81,10 @@ public:
}
}
void ProcessEvent(GameObject* /*go*/, uint32 /*eventId*/)
{
}
void ProcessEvent(Unit* /*unit*/, uint32 eventId)
{
if (eventId != EVENT_CALL_DRAGON)
@@ -76,8 +76,8 @@ enum eEvents
EVENT_BERSERK = 6,
};
#define ACHIEVEMENT_SMELL_SARONITE RAID_MODE(3181, 3188)
#define ACHIEVEMENT_SHADOWDODGER RAID_MODE(2996, 2997)
#define ACHIEVEMENT_SMELL_SARONITE RAID_MODE<uint32>(3181, 3188)
#define ACHIEVEMENT_SHADOWDODGER RAID_MODE<uint32>(2996, 2997)
class boss_general_vezax : public CreatureScript
{
@@ -156,16 +156,18 @@ public:
events.ScheduleEvent(EVENT_SEARING_FLAMES, urand(14000, 17500));
break;
case EVENT_MARK_OF_THE_FACELESS:
Unit* pTarget;
{
/* He will not cast this on players within 15 yards of him.
However, if there are not at least 9 people outside of 15 yards
he will start casting it on players inside 15 yards melee and tank included.
*/
if (!(pTarget = CheckPlayersInRange(RAID_MODE(4,9), 15.0f, 50.f)))
pTarget = SelectTarget(SELECT_TARGET_RANDOM);
DoCast(pTarget, SPELL_MARK_OF_THE_FACELESS);
Unit* target = CheckPlayersInRange(RAID_MODE<uint32>(4,9), 15.0f, 50.f);
if (!target)
target = SelectTarget(SELECT_TARGET_RANDOM);
DoCast(target, SPELL_MARK_OF_THE_FACELESS);
events.ScheduleEvent(EVENT_MARK_OF_THE_FACELESS, urand(35000, 45000));
break;
}
case EVENT_SURGE_OF_DARKNESS:
DoScriptText(EMOTE_SURGE_OF_DARKNESS, me);
DoScriptText(SAY_SURGE_OF_DARKNESS, me);
@@ -261,9 +263,9 @@ public:
Purpose: If there are uiPlayersMin people within uiRangeMin, uiRangeMax: return a random players in that range.
If not, return NULL and allow other target selection
*/
Unit * CheckPlayersInRange(uint32 uiPlayersMin, float uiRangeMin, float uiRangeMax)
Unit* CheckPlayersInRange(uint32 uiPlayersMin, float uiRangeMin, float uiRangeMax)
{
Map * pMap = me->GetMap();
Map* pMap = me->GetMap();
if (pMap && pMap->IsDungeon())
{
std::list<Player*> PlayerList;
@@ -253,13 +253,13 @@ public:
}
}
void ProcessEvent(GameObject* /*go*/, uint32 uiEventId)
void ProcessEvent(GameObject* /*go*/, uint32 eventId)
{
// Flame Leviathan's Tower Event triggers
Creature* pFlameLeviathan = instance->GetCreature(uiLeviathanGUID);
if (pFlameLeviathan && pFlameLeviathan->isAlive()) //No leviathan, no event triggering ;)
switch(uiEventId)
switch(eventId)
{
case EVENT_TOWER_OF_STORM_DESTROYED:
pFlameLeviathan->AI()->DoAction(1);
@@ -276,6 +276,10 @@ public:
}
}
void ProcessEvent(Unit* /*unit*/, uint32 /*eventId*/)
{
}
bool SetBossState(uint32 type, EncounterState state)
{
if (!InstanceScript::SetBossState(type, state))
@@ -798,16 +798,19 @@ public:
void ProcessEvent(GameObject* /*pGO*/, uint32 uiEventId)
{
switch(uiEventId)
switch (uiEventId)
{
case EVENT_ACTIVATE_CRYSTAL:
bCrystalActivated = true; // Activation by player's will throw event signal
ActivateCrystal();
break;
}
}
}
};
void ProcessEvent(Unit* /*unit*/, uint32 /*eventId*/)
{
}
};
};
+3 -2
View File
@@ -65,8 +65,8 @@ m_length(NULL)
//- This is where we prepare the buffer based on metadata
uint32 i = 0;
MYSQL_FIELD* field;
while ((field = mysql_fetch_field(m_res)))
MYSQL_FIELD* field = mysql_fetch_field(m_res);
while (field)
{
size_t size = Field::SizeForType(field);
@@ -80,6 +80,7 @@ m_length(NULL)
m_rBind[i].is_unsigned = field->flags & UNSIGNED_FLAG;
++i;
field = mysql_fetch_field(m_res);
}
//- This is where we bind the bind the buffer to the statement
@@ -600,14 +600,14 @@ void CliRunnable::run()
if (!*command_str)
{
#if PLATFORM == WINDOWS
#if PLATFORM == PLATFORM_WINDOWS
printf("TC>");
#endif
continue;
}
std::string command;
if (!consoleToUtf8(command_str,command)) // convert from console encoding to utf8
if (!consoleToUtf8(command_str, command)) // convert from console encoding to utf8
{
#if PLATFORM == PLATFORM_WINDOWS
printf("TC>");