[9324] Fix some gcc warnings

This commit is contained in:
AlexDereka 2010-02-08 02:25:23 +03:00
parent 2a01c79609
commit 4338c9105d
27 changed files with 102 additions and 103 deletions

View file

@ -156,17 +156,17 @@ uint32 AccountMgr::GetId(std::string username)
} }
} }
uint32 AccountMgr::GetSecurity(uint32 acc_id) AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
{ {
QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id); QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id);
if(result) if(result)
{ {
uint32 sec = (*result)[0].GetUInt32(); AccountTypes sec = AccountTypes((*result)[0].GetInt32());
delete result; delete result;
return sec; return sec;
} }
return 0; return SEC_PLAYER;
} }
bool AccountMgr::GetName(uint32 acc_id, std::string &name) bool AccountMgr::GetName(uint32 acc_id, std::string &name)

View file

@ -48,7 +48,7 @@ class AccountMgr
bool CheckPassword(uint32 accid, std::string passwd); bool CheckPassword(uint32 accid, std::string passwd);
uint32 GetId(std::string username); uint32 GetId(std::string username);
uint32 GetSecurity(uint32 acc_id); AccountTypes GetSecurity(uint32 acc_id);
bool GetName(uint32 acc_id, std::string &name); bool GetName(uint32 acc_id, std::string &name);
std::string CalculateShaPassHash(std::string& name, std::string& password); std::string CalculateShaPassHash(std::string& name, std::string& password);

View file

@ -729,7 +729,7 @@ bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_account, bool strong) bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_account, bool strong)
{ {
uint32 target_sec; AccountTypes target_sec;
// allow everything from console and RA console // allow everything from console and RA console
if (!m_session) if (!m_session)
@ -746,7 +746,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
else else
return true; // caller must report error for (target==NULL && target_account==0) return true; // caller must report error for (target==NULL && target_account==0)
if (m_session->GetSecurity() < target_sec || (strong && (uint32)m_session->GetSecurity() <= target_sec)) if (m_session->GetSecurity() < target_sec || (strong && m_session->GetSecurity() <= target_sec))
{ {
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage(true); SetSentErrorMessage(true);

View file

@ -391,32 +391,37 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl
data << Title; data << Title;
data << uint32(eEmote._Delay ); // player emote data << uint32(eEmote._Delay ); // player emote
data << uint32(eEmote._Emote ); // NPC emote data << uint32(eEmote._Emote ); // NPC emote
data << uint8 ( mQuestMenu.MenuItemCount() );
for (uint32 iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI ) size_t count_pos = data.wpos();
data << uint8 ( mQuestMenu.MenuItemCount() );
uint32 count = 0;
for (; count < mQuestMenu.MenuItemCount(); ++count )
{ {
QuestMenuItem const& qmi = mQuestMenu.GetItem(iI); QuestMenuItem const& qmi = mQuestMenu.GetItem(count);
uint32 questID = qmi.m_qId; uint32 questID = qmi.m_qId;
Quest const *pQuest = sObjectMgr.GetQuestTemplate(questID); Quest const *pQuest = sObjectMgr.GetQuestTemplate(questID);
if(pQuest)
std::string title = pQuest ? pQuest->GetTitle() : "";
int loc_idx = pSession->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{ {
if(QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID)) std::string title = pQuest->GetTitle();
{
if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty())
title=ql->Title[loc_idx];
}
}
data << uint32(questID); int loc_idx = pSession->GetSessionDbLocaleIndex();
data << uint32(qmi.m_qIcon); if (loc_idx >= 0)
data << int32(pQuest->GetQuestLevel()); {
data << title; if(QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID))
{
if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty())
title=ql->Title[loc_idx];
}
}
data << uint32(questID);
data << uint32(qmi.m_qIcon);
data << int32(pQuest->GetQuestLevel());
data << title;
}
} }
data.put<uint8>(count_pos,count);
pSession->SendPacket( &data ); pSession->SendPacket( &data );
sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID));
} }

View file

@ -595,7 +595,7 @@ namespace MaNGOS
if(go->GetGOInfo()->spellFocus.focusId != i_focusId) if(go->GetGOInfo()->spellFocus.focusId != i_focusId)
return false; return false;
float dist = go->GetGOInfo()->spellFocus.dist; float dist = (float)go->GetGOInfo()->spellFocus.dist;
return go->IsWithinDistInMap(i_unit, dist); return go->IsWithinDistInMap(i_unit, dist);
} }
@ -611,7 +611,7 @@ namespace MaNGOS
NearestGameObjectFishingHole(WorldObject const& obj, float range) : i_obj(obj), i_range(range) {} NearestGameObjectFishingHole(WorldObject const& obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(GameObject* go) bool operator()(GameObject* go)
{ {
if(go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, go->GetGOInfo()->fishinghole.radius)) if(go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, (float)go->GetGOInfo()->fishinghole.radius))
{ {
i_range = i_obj.GetDistance(go); i_range = i_obj.GetDistance(go);
return true; return true;

View file

@ -843,7 +843,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
uint8 maxresul = 0; uint8 maxresul = 0;
uint64 maxguid = (*roll->playerVote.begin()).first; uint64 maxguid = (*roll->playerVote.begin()).first;
Player *player; Player *player;
RollVote rollvote; RollVote rollvote = PASS; //Fixed: Using uninitialized memory 'rollvote'
Roll::PlayerVote::iterator itr; Roll::PlayerVote::iterator itr;
for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr) for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)

View file

@ -158,7 +158,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
for(; itr != m.end(); ++itr) for(; itr != m.end(); ++itr)
{ {
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) && if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= (AccountTypes)sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) &&
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer()))) (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
{ {
if(first) if(first)

View file

@ -2159,7 +2159,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
std::string username = GetMangosString(LANG_ERROR); std::string username = GetMangosString(LANG_ERROR);
std::string last_ip = GetMangosString(LANG_ERROR); std::string last_ip = GetMangosString(LANG_ERROR);
uint32 security = 0; AccountTypes security = SEC_PLAYER;
std::string last_login = GetMangosString(LANG_ERROR); std::string last_login = GetMangosString(LANG_ERROR);
QueryResult* result = loginDatabase.PQuery("SELECT username,gmlevel,last_ip,last_login FROM account WHERE id = '%u'",accId); QueryResult* result = loginDatabase.PQuery("SELECT username,gmlevel,last_ip,last_login FROM account WHERE id = '%u'",accId);
@ -2167,7 +2167,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
username = fields[0].GetCppString(); username = fields[0].GetCppString();
security = fields[1].GetUInt32(); security = (AccountTypes)fields[1].GetUInt32();
if(!m_session || m_session->GetSecurity() >= security) if(!m_session || m_session->GetSecurity() >= security)
{ {
@ -3681,7 +3681,7 @@ bool ChatHandler::HandleHonorAddCommand(const char* args)
if (HasLowerSecurity(target, 0)) if (HasLowerSecurity(target, 0))
return false; return false;
uint32 amount = (uint32)atoi(args); float amount = (float)atof(args);
target->RewardHonor(NULL, 1, amount); target->RewardHonor(NULL, 1, amount);
return true; return true;
} }

View file

@ -5550,7 +5550,7 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args)
return false; return false;
} }
guid = sObjectMgr.GetPlayerGUIDByName(name); guid = GUID_LOPART(sObjectMgr.GetPlayerGUIDByName(name));
} }
if(!sObjectMgr.GetPlayerAccountIdByGUID(guid)) if(!sObjectMgr.GetPlayerAccountIdByGUID(guid))

View file

@ -350,7 +350,7 @@ void WorldSession::DoLootRelease( uint64 lguid )
else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE) else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
{ // The fishing hole used once more { // The fishing hole used once more
go->AddUse(); // if the max usage is reached, will be despawned in next tick go->AddUse(); // if the max usage is reached, will be despawned in next tick
if (go->GetUseCount() >= irand(go->GetGOInfo()->fishinghole.minSuccessOpens,go->GetGOInfo()->fishinghole.maxSuccessOpens)) if (go->GetUseCount() >= urand(go->GetGOInfo()->fishinghole.minSuccessOpens,go->GetGOInfo()->fishinghole.maxSuccessOpens))
{ {
go->SetLootState(GO_JUST_DEACTIVATED); go->SetLootState(GO_JUST_DEACTIVATED);
} }

View file

@ -1584,7 +1584,7 @@ float GridMap::getLiquidLevel(float x, float y)
uint8 GridMap::getTerrainType(float x, float y) uint8 GridMap::getTerrainType(float x, float y)
{ {
if (!m_liquid_type) if (!m_liquid_type)
return m_liquidType; return (uint8)m_liquidType;
x = 16 * (32 - x/SIZE_OF_GRIDS); x = 16 * (32 - x/SIZE_OF_GRIDS);
y = 16 * (32 - y/SIZE_OF_GRIDS); y = 16 * (32 - y/SIZE_OF_GRIDS);

View file

@ -280,7 +280,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
//instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in mangosd.conf //instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in mangosd.conf
if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) || GetPlayer()->isInFlight() || if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) || GetPlayer()->isInFlight() ||
GetSecurity() >= sWorld.getConfig(CONFIG_INSTANT_LOGOUT)) GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_INSTANT_LOGOUT))
{ {
LogoutPlayer(true); LogoutPlayer(true);
return; return;
@ -588,7 +588,7 @@ void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data )
uint64 guid; uint64 guid;
std::string note; std::string note;
recv_data >> guid >> note; recv_data >> guid >> note;
_player->GetSocial()->SetFriendNote(guid, note); _player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note);
} }
void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) void WorldSession::HandleBugOpcode( WorldPacket & recv_data )

View file

@ -743,7 +743,6 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
WorldPacket data(SMSG_STABLE_RESULT, 200); // guess size
Pet* pet = _player->GetPet(); Pet* pet = _player->GetPet();
@ -782,6 +781,8 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
// move alive pet to slot or delete dead pet // move alive pet to slot or delete dead pet
_player->RemovePet(pet,pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED); _player->RemovePet(pet,pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED);
WorldPacket data(SMSG_STABLE_RESULT, 1); // guess size
// summon unstabled pet // summon unstabled pet
Pet *newpet = new Pet; Pet *newpet = new Pet;
if(!newpet->LoadPetFromDB(_player,creature_id,pet_number)) if(!newpet->LoadPetFromDB(_player,creature_id,pet_number))

View file

@ -189,7 +189,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse)
CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY());
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
sObjectMgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID()); sObjectMgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID()));
corpse->RemoveFromWorld(); corpse->RemoveFromWorld();
i_player2corpse.erase(iter); i_player2corpse.erase(iter);

View file

@ -519,8 +519,8 @@ void Pet::Update(uint32 diff)
if(m_duration > 0) if(m_duration > 0)
{ {
if(m_duration > diff) if(m_duration > (int32)diff)
m_duration -= diff; m_duration -= (int32)diff;
else else
{ {
Remove(getPetType() != SUMMON_PET ? PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT); Remove(getPetType() != SUMMON_PET ? PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT);
@ -1184,7 +1184,7 @@ void Pet::_LoadAuras(uint32 timediff)
// prevent wrong values of remaincharges // prevent wrong values of remaincharges
if(spellproto->procCharges) if(spellproto->procCharges)
{ {
if(remaincharges <= 0 || remaincharges > spellproto->procCharges) if(remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges)
remaincharges = spellproto->procCharges; remaincharges = spellproto->procCharges;
} }
else else
@ -1774,7 +1774,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
PetSpellMap::iterator itr = m_spells.find(spellid); PetSpellMap::iterator itr = m_spells.find(spellid);
int i; uint32 i;
if(apply) if(apply)
{ {

View file

@ -265,7 +265,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
// result==NULL also correct in case no sign yet // result==NULL also correct in case no sign yet
if(result) if(result)
signs = result->GetRowCount(); signs = (uint8)result->GetRowCount();
sLog.outDebug("CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid_low); sLog.outDebug("CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid_low);
@ -674,7 +674,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
// result==NULL also correct charter without signs // result==NULL also correct charter without signs
if(result) if(result)
signs = result->GetRowCount(); signs = (uint8)result->GetRowCount();
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12)); WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
data << petitionguid; // petition guid data << petitionguid; // petition guid
@ -762,7 +762,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
uint8 signs; uint8 signs;
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
if(result) if(result)
signs = result->GetRowCount(); signs = (uint8)result->GetRowCount();
else else
signs = 0; signs = 0;

View file

@ -707,7 +707,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
continue; continue;
// BuyCount by default // BuyCount by default
uint32 count = iProto->BuyCount; int32 count = iProto->BuyCount;
// special amount for foor/drink // special amount for foor/drink
if(iProto->Class==ITEM_CLASS_CONSUMABLE && iProto->SubClass==ITEM_SUBCLASS_FOOD) if(iProto->Class==ITEM_CLASS_CONSUMABLE && iProto->SubClass==ITEM_SUBCLASS_FOOD)
@ -901,13 +901,13 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
switch (timer) switch (timer)
{ {
case FATIGUE_TIMER: case FATIGUE_TIMER:
if (GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_TIMERBAR_FATIGUE_GMLEVEL)) if (GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_TIMERBAR_FATIGUE_GMLEVEL))
return DISABLED_MIRROR_TIMER; return DISABLED_MIRROR_TIMER;
return sWorld.getConfig(CONFIG_TIMERBAR_FATIGUE_MAX)*IN_MILISECONDS; return sWorld.getConfig(CONFIG_TIMERBAR_FATIGUE_MAX)*IN_MILISECONDS;
case BREATH_TIMER: case BREATH_TIMER:
{ {
if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) ||
GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_TIMERBAR_BREATH_GMLEVEL)) GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_TIMERBAR_BREATH_GMLEVEL))
return DISABLED_MIRROR_TIMER; return DISABLED_MIRROR_TIMER;
int32 UnderWaterTime = sWorld.getConfig(CONFIG_TIMERBAR_BREATH_MAX)*IN_MILISECONDS; int32 UnderWaterTime = sWorld.getConfig(CONFIG_TIMERBAR_BREATH_MAX)*IN_MILISECONDS;
AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING); AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING);
@ -917,7 +917,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
} }
case FIRE_TIMER: case FIRE_TIMER:
{ {
if (!isAlive() || GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_TIMERBAR_FIRE_GMLEVEL)) if (!isAlive() || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_TIMERBAR_FIRE_GMLEVEL))
return DISABLED_MIRROR_TIMER; return DISABLED_MIRROR_TIMER;
return sWorld.getConfig(CONFIG_TIMERBAR_FIRE_MAX)*IN_MILISECONDS; return sWorld.getConfig(CONFIG_TIMERBAR_FIRE_MAX)*IN_MILISECONDS;
} }
@ -2090,7 +2090,7 @@ void Player::RegenerateHealth(uint32 diff)
// polymorphed case // polymorphed case
if ( IsPolymorphed() ) if ( IsPolymorphed() )
addvalue = GetMaxHealth()/3; addvalue = (float)GetMaxHealth()/3;
// normal regen case (maybe partly in combat case) // normal regen case (maybe partly in combat case)
else if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ) else if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) )
{ {
@ -5980,7 +5980,7 @@ int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, in
if (rate != 1.0f && creatureOrQuestLevel <= MaNGOS::XP::GetGrayLevel(getLevel())) if (rate != 1.0f && creatureOrQuestLevel <= MaNGOS::XP::GetGrayLevel(getLevel()))
percent *= rate; percent *= rate;
float repMod = GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN); float repMod = (float)GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN);
if (!for_quest) if (!for_quest)
repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction); repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
@ -6648,7 +6648,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
if (only_level_scale && !ssv) if (only_level_scale && !ssv)
return; return;
for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i) for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
{ {
uint32 statType = 0; uint32 statType = 0;
int32 val = 0; int32 val = 0;
@ -7142,7 +7142,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
return; return;
float chance = spellInfo->procChance; float chance = (float)spellInfo->procChance;
if(spellData.SpellPPMRate) if(spellData.SpellPPMRate)
{ {
@ -8627,7 +8627,7 @@ Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const
Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool nonbroken, bool useable) const Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool nonbroken, bool useable) const
{ {
uint16 slot; uint8 slot;
switch (attackType) switch (attackType)
{ {
case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break; case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
@ -11483,7 +11483,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
uint32 count = 0; uint32 count = 0;
for(int i=0; i < fullBag->GetBagSize(); ++i) for(uint32 i=0; i < fullBag->GetBagSize(); ++i)
{ {
Item *bagItem = fullBag->GetItemByPos(i); Item *bagItem = fullBag->GetItemByPos(i);
if (!bagItem) if (!bagItem)
@ -11510,7 +11510,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
// Items swap // Items swap
count = 0; // will pos in new bag count = 0; // will pos in new bag
for(int i = 0; i< fullBag->GetBagSize(); ++i) for(uint32 i = 0; i< fullBag->GetBagSize(); ++i)
{ {
Item *bagItem = fullBag->GetItemByPos(i); Item *bagItem = fullBag->GetItemByPos(i);
if (!bagItem) if (!bagItem)
@ -15222,10 +15222,10 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
uint32 spellid = fields[1].GetUInt32(); uint32 spellid = fields[1].GetUInt32();
uint32 effindex = fields[2].GetUInt32(); uint32 effindex = fields[2].GetUInt32();
uint32 stackcount = fields[3].GetUInt32(); uint32 stackcount = fields[3].GetUInt32();
int32 damage = (int32)fields[4].GetUInt32(); int32 damage = fields[4].GetInt32();
int32 maxduration = (int32)fields[5].GetUInt32(); int32 maxduration = fields[5].GetInt32();
int32 remaintime = (int32)fields[6].GetUInt32(); int32 remaintime = fields[6].GetInt32();
int32 remaincharges = (int32)fields[7].GetUInt32(); int32 remaincharges = fields[7].GetInt32();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid); SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if(!spellproto) if(!spellproto)
@ -15252,7 +15252,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
// prevent wrong values of remaincharges // prevent wrong values of remaincharges
if(spellproto->procCharges) if(spellproto->procCharges)
{ {
if(remaincharges <= 0 || remaincharges > spellproto->procCharges) if(remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges)
remaincharges = spellproto->procCharges; remaincharges = spellproto->procCharges;
} }
else else
@ -20679,7 +20679,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
return; return;
// find current max talent rank // find current max talent rank
int32 curtalent_maxrank = 0; uint32 curtalent_maxrank = 0;
for(int32 k = MAX_TALENT_RANK-1; k > -1; --k) for(int32 k = MAX_TALENT_RANK-1; k > -1; --k)
{ {
if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k])) if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k]))

View file

@ -499,7 +499,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
} }
DumpTableType type; DumpTableType type = DTT_CHARACTER; //Fixed: Using uninitialized memory 'type'
DumpTable* dTable = &dumpTables[0]; DumpTable* dTable = &dumpTables[0];
for(; dTable->isValid(); ++dTable) for(; dTable->isValid(); ++dTable)
{ {

View file

@ -499,7 +499,7 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4+(4+4)*count); WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4+(4+4)*count);
data << uint32(count); // count data << uint32(count); // count
for(int i = 0; i < count; ++i) for(uint32 i = 0; i < count; ++i)
{ {
uint32 questId; uint32 questId;
recv_data >> questId; // quest id recv_data >> questId; // quest id

View file

@ -5348,7 +5348,7 @@ SpellCastResult Spell::CheckPower()
// health as power used - need check health amount // health as power used - need check health amount
if(m_spellInfo->powerType == POWER_HEALTH) if(m_spellInfo->powerType == POWER_HEALTH)
{ {
if(m_caster->GetHealth() <= m_powerCost) if((int32)m_caster->GetHealth() <= m_powerCost)
return SPELL_FAILED_CASTER_AURASTATE; return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_CAST_OK; return SPELL_CAST_OK;
} }
@ -5369,7 +5369,7 @@ SpellCastResult Spell::CheckPower()
// Check power amount // Check power amount
Powers powerType = Powers(m_spellInfo->powerType); Powers powerType = Powers(m_spellInfo->powerType);
if(m_caster->GetPower(powerType) < m_powerCost) if((int32)m_caster->GetPower(powerType) < m_powerCost)
return SPELL_FAILED_NO_POWER; return SPELL_FAILED_NO_POWER;
else else
return SPELL_CAST_OK; return SPELL_CAST_OK;

View file

@ -1300,7 +1300,7 @@ bool Aura::modStackAmount(int32 num)
// Modify stack but limit it // Modify stack but limit it
int32 stackAmount = m_stackAmount + num; int32 stackAmount = m_stackAmount + num;
if (stackAmount > m_spellProto->StackAmount) if (stackAmount > (int32)m_spellProto->StackAmount)
stackAmount = m_spellProto->StackAmount; stackAmount = m_spellProto->StackAmount;
else if (stackAmount <=0) // Last aura from stack removed else if (stackAmount <=0) // Last aura from stack removed
{ {
@ -2359,7 +2359,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
SpellEntry const* buffEntry = sSpellStore.LookupEntry(55166); SpellEntry const* buffEntry = sSpellStore.LookupEntry(55166);
if (!buffEntry) if (!buffEntry)
return; return;
for(int k = 0; k < buffEntry->StackAmount; ++k) for(uint32 k = 0; k < buffEntry->StackAmount; ++k)
m_target->CastSpell(m_target, buffEntry, true, NULL, this); m_target->CastSpell(m_target, buffEntry, true, NULL, this);
} }
// Earth Shield // Earth Shield
@ -2526,7 +2526,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if (!spell || !caster) if (!spell || !caster)
return; return;
for (int i=0; i < spell->StackAmount; ++i) for (uint32 i = 0; i < spell->StackAmount; ++i)
caster->CastSpell(m_target, spellId, true, NULL, NULL, GetCasterGUID()); caster->CastSpell(m_target, spellId, true, NULL, NULL, GetCasterGUID());
return; return;
} }
@ -2543,7 +2543,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if (!spell || !caster) if (!spell || !caster)
return; return;
for (int i=0; i < spell->StackAmount; ++i) for (uint32 i=0; i < spell->StackAmount; ++i)
caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID()); caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID());
return; return;
} }
@ -3097,7 +3097,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
{ {
// Furor chance is now amount allowed to save energy for cat form // Furor chance is now amount allowed to save energy for cat form
// without talent it reset to 0 // without talent it reset to 0
if (m_target->GetPower(POWER_ENERGY) > furorChance) if ((int32)m_target->GetPower(POWER_ENERGY) > furorChance)
{ {
m_target->SetPower(POWER_ENERGY, 0); m_target->SetPower(POWER_ENERGY, 0);
m_target->CastCustomSpell(m_target, 17099, &furorChance, NULL, NULL, this); m_target->CastCustomSpell(m_target, 17099, &furorChance, NULL, NULL, this);
@ -3106,7 +3106,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
else if(furorChance) // only if talent known else if(furorChance) // only if talent known
{ {
m_target->SetPower(POWER_RAGE, 0); m_target->SetPower(POWER_RAGE, 0);
if(urand(1,100) <= furorChance) if(irand(1,100) <= furorChance)
m_target->CastSpell(m_target, 17057, true, NULL, this); m_target->CastSpell(m_target, 17057, true, NULL, this);
} }
break; break;

View file

@ -296,7 +296,7 @@ class MANGOS_DLL_SPEC Aura
void SetAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); } void SetAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); }
void SendAuraUpdate(bool remove); void SendAuraUpdate(bool remove);
int8 GetStackAmount() {return m_stackAmount;} uint8 GetStackAmount() {return m_stackAmount;}
void SetStackAmount(uint8 num); void SetStackAmount(uint8 num);
bool modStackAmount(int32 num); // return true if last charge dropped bool modStackAmount(int32 num); // return true if last charge dropped
void RefreshAura(); void RefreshAura();

View file

@ -563,7 +563,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
uint32 doses = poison->GetStackAmount(); uint32 doses = poison->GetStackAmount();
if (doses > combo) if (doses > combo)
doses = combo; doses = combo;
for (int i=0; i< doses; i++) for (uint32 i = 0; i < doses; ++i)
unitTarget->RemoveSingleSpellAurasFromStack(spellId); unitTarget->RemoveSingleSpellAurasFromStack(spellId);
damage *= doses; damage *= doses;
damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.09f * doses); damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.09f * doses);
@ -1877,7 +1877,7 @@ void Spell::EffectDummy(uint32 i)
Unit::AttackerSet attackers = friendTarget->getAttackers(); Unit::AttackerSet attackers = friendTarget->getAttackers();
// selected from list 3 // selected from list 3
for(int i = 0; i < std::min(size_t(3),attackers.size()); ++i) for(uint32 i = 0; i < std::min(size_t(3),attackers.size()); ++i)
{ {
Unit::AttackerSet::iterator aItr = attackers.begin(); Unit::AttackerSet::iterator aItr = attackers.begin();
std::advance(aItr, rand() % attackers.size()); std::advance(aItr, rand() % attackers.size());
@ -2171,7 +2171,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
if (!spell) if (!spell)
return; return;
for (int j=0; j < spell->StackAmount; ++j) for (uint32 j=0; j < spell->StackAmount; ++j)
m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID);
return; return;
} }
@ -2183,7 +2183,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
if (!spell) if (!spell)
return; return;
for (int j=0; j < spell->StackAmount; ++j) for (uint32 j=0; j < spell->StackAmount; ++j)
m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID);
return; return;
} }
@ -2641,15 +2641,16 @@ void Spell::EffectPowerBurn(uint32 i)
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn) // burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
if (m_spellInfo->ManaCostPercentage) if (m_spellInfo->ManaCostPercentage)
{ {
uint32 maxdamage = m_caster->GetMaxPower(powertype) * damage * 2 / 100; int32 maxdamage = m_caster->GetMaxPower(powertype) * damage * 2 / 100;
damage = unitTarget->GetMaxPower(powertype) * damage / 100; damage = unitTarget->GetMaxPower(powertype) * damage / 100;
if(damage > maxdamage) damage = maxdamage; if(damage > maxdamage)
damage = maxdamage;
} }
int32 curPower = int32(unitTarget->GetPower(powertype)); int32 curPower = int32(unitTarget->GetPower(powertype));
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
uint32 power = damage; int32 power = damage;
if (powertype == POWER_MANA) if (powertype == POWER_MANA)
power -= unitTarget->GetSpellCritDamageReduction(power); power -= unitTarget->GetSpellCritDamageReduction(power);
@ -2794,7 +2795,7 @@ void Spell::EffectHealthLeech(uint32 i)
uint32 curHealth = unitTarget->GetHealth(); uint32 curHealth = unitTarget->GetHealth();
damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damage ); damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damage );
if (curHealth < damage) if ((int32)curHealth < damage)
damage = curHealth; damage = curHealth;
float multiplier = m_spellInfo->EffectMultipleValue[i]; float multiplier = m_spellInfo->EffectMultipleValue[i];
@ -4531,7 +4532,7 @@ void Spell::EffectWeaponDmg(uint32 i)
// multiple weapon dmg effect workaround // multiple weapon dmg effect workaround
// execute only the last weapon damage // execute only the last weapon damage
// and handle all effects at once // and handle all effects at once
for (int j = 0; j < 3; ++j) for (uint32 j = 0; j < 3; ++j)
{ {
switch(m_spellInfo->Effect[j]) switch(m_spellInfo->Effect[j])
{ {

View file

@ -364,7 +364,7 @@ bool Unit::haveOffhandWeapon() const
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, SplineFlags flags, uint32 Time, Player* player) void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, SplineFlags flags, uint32 Time, Player* player)
{ {
float moveTime = Time; float moveTime = (float)Time;
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) ); WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID()); data.append(GetPackGUID());
@ -1251,8 +1251,8 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S
// block (only for damage class ranged and -melee, also non-physical damage possible) // block (only for damage class ranged and -melee, also non-physical damage possible)
if (blocked) if (blocked)
{ {
damageInfo->blocked = uint32(pVictim->GetShieldBlockValue()); damageInfo->blocked = pVictim->GetShieldBlockValue();
if (damage < damageInfo->blocked) if (damage < (int32)damageInfo->blocked)
damageInfo->blocked = damage; damageInfo->blocked = damage;
damage-=damageInfo->blocked; damage-=damageInfo->blocked;
} }
@ -2248,7 +2248,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
} }
// Apply death prevention spells effects // Apply death prevention spells effects
if (preventDeathSpell && RemainingDamage >= pVictim->GetHealth()) if (preventDeathSpell && RemainingDamage >= (int32)pVictim->GetHealth())
{ {
switch(preventDeathSpell->SpellFamilyName) switch(preventDeathSpell->SpellFamilyName)
{ {
@ -2894,7 +2894,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
int32 tmp = 10000 - HitChance; int32 tmp = 10000 - HitChance;
uint32 rand = urand(0,10000); int32 rand = irand(0,10000);
if (rand < tmp) if (rand < tmp)
return SPELL_MISS_MISS; return SPELL_MISS_MISS;
@ -4815,7 +4815,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo)
data << uint32(0); // overkill value data << uint32(0); // overkill value
data << uint8(count); // Sub damage count data << uint8(count); // Sub damage count
for(int i = 0; i < count; ++i) for(uint32 i = 0; i < count; ++i)
{ {
data << uint32(damageInfo->damageSchoolMask); // School of sub damage data << uint32(damageInfo->damageSchoolMask); // School of sub damage
data << float(damageInfo->damage); // sub damage data << float(damageInfo->damage); // sub damage
@ -4824,13 +4824,13 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo)
if(damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2)) if(damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2))
{ {
for(int i = 0; i < count; ++i) for(uint32 i = 0; i < count; ++i)
data << uint32(damageInfo->absorb); // Absorb data << uint32(damageInfo->absorb); // Absorb
} }
if(damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2)) if(damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2))
{ {
for(int i = 0; i < count; ++i) for(uint32 i = 0; i < count; ++i)
data << uint32(damageInfo->resist); // Resist data << uint32(damageInfo->resist); // Resist
} }
@ -5031,8 +5031,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{ {
// return damage % to attacker but < 50% own total health // return damage % to attacker but < 50% own total health
basepoints0 = triggerAmount*int32(damage)/100; basepoints0 = triggerAmount*int32(damage)/100;
if(basepoints0 > GetMaxHealth()/2) if(basepoints0 > (int32)GetMaxHealth()/2)
basepoints0 = GetMaxHealth()/2; basepoints0 = (int32)GetMaxHealth()/2;
triggered_spell_id = 25997; triggered_spell_id = 25997;
break; break;
@ -5636,7 +5636,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{ {
Modifier* mod = triggeredByAura->GetModifier(); Modifier* mod = triggeredByAura->GetModifier();
// if damage is more than need or target die from damage deal finish spell // if damage is more than need or target die from damage deal finish spell
if( mod->m_amount <= damage || GetHealth() <= damage ) if( mod->m_amount <= damage || (int32)GetHealth() <= damage )
{ {
// remember guid before aura delete // remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID(); uint64 casterGuid = triggeredByAura->GetCasterGUID();

View file

@ -317,7 +317,7 @@ bool World::RemoveQueuedPlayer(WorldSession* sess)
--sessions; --sessions;
// accept first in queue // accept first in queue
if( (!m_playerLimit || sessions < m_playerLimit) && !m_QueuedPlayer.empty() ) if( (!m_playerLimit || (int32)sessions < m_playerLimit) && !m_QueuedPlayer.empty() )
{ {
WorldSession* pop_sess = m_QueuedPlayer.front(); WorldSession* pop_sess = m_QueuedPlayer.front();
pop_sess->SetInQueue(false); pop_sess->SetInQueue(false);

View file

@ -27,14 +27,6 @@
#include "Database/SqlOperations.h" #include "Database/SqlOperations.h"
#include "Timer.h" #include "Timer.h"
void DatabasePostgre::ThreadStart()
{
}
void DatabasePostgre::ThreadEnd()
{
}
size_t DatabasePostgre::db_count = 0; size_t DatabasePostgre::db_count = 0;
DatabasePostgre::DatabasePostgre() : Database(), mPGconn(NULL) DatabasePostgre::DatabasePostgre() : Database(), mPGconn(NULL)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9323" #define REVISION_NR "9324"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__