diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index 9b73839f8..f6d98877b 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -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); if(result) { - uint32 sec = (*result)[0].GetUInt32(); + AccountTypes sec = AccountTypes((*result)[0].GetInt32()); delete result; return sec; } - return 0; + return SEC_PLAYER; } bool AccountMgr::GetName(uint32 acc_id, std::string &name) diff --git a/src/game/AccountMgr.h b/src/game/AccountMgr.h index 0097da8c2..f669eb442 100644 --- a/src/game/AccountMgr.h +++ b/src/game/AccountMgr.h @@ -48,7 +48,7 @@ class AccountMgr bool CheckPassword(uint32 accid, std::string passwd); uint32 GetId(std::string username); - uint32 GetSecurity(uint32 acc_id); + AccountTypes GetSecurity(uint32 acc_id); bool GetName(uint32 acc_id, std::string &name); std::string CalculateShaPassHash(std::string& name, std::string& password); diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index c739828d2..cfcfa9f0a 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -729,7 +729,7 @@ bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, 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 if (!m_session) @@ -746,7 +746,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac else 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); SetSentErrorMessage(true); diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 3b86c4b4e..33f857f58 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -391,32 +391,37 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl data << Title; data << uint32(eEmote._Delay ); // player 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; Quest const *pQuest = sObjectMgr.GetQuestTemplate(questID); - - std::string title = pQuest ? pQuest->GetTitle() : ""; - - int loc_idx = pSession->GetSessionDbLocaleIndex(); - if (loc_idx >= 0) + if(pQuest) { - 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]; - } - } + std::string title = pQuest->GetTitle(); - data << uint32(questID); - data << uint32(qmi.m_qIcon); - data << int32(pQuest->GetQuestLevel()); - data << title; + int loc_idx = pSession->GetSessionDbLocaleIndex(); + if (loc_idx >= 0) + { + 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(count_pos,count); pSession->SendPacket( &data ); sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); } diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index d3586a374..059621bec 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -595,7 +595,7 @@ namespace MaNGOS if(go->GetGOInfo()->spellFocus.focusId != i_focusId) return false; - float dist = go->GetGOInfo()->spellFocus.dist; + float dist = (float)go->GetGOInfo()->spellFocus.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) {} 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); return true; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 6ccddb751..c93922a70 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -843,7 +843,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) uint8 maxresul = 0; uint64 maxguid = (*roll->playerVote.begin()).first; Player *player; - RollVote rollvote; + RollVote rollvote = PASS; //Fixed: Using uninitialized memory 'rollvote' Roll::PlayerVote::iterator itr; for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr) diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index 6d52d0880..d49896033 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -158,7 +158,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) for(; itr != m.end(); ++itr) { 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()))) { if(first) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 8bed3e9f9..3d2ac8469 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -2159,7 +2159,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args) std::string username = GetMangosString(LANG_ERROR); std::string last_ip = GetMangosString(LANG_ERROR); - uint32 security = 0; + AccountTypes security = SEC_PLAYER; std::string last_login = GetMangosString(LANG_ERROR); 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(); username = fields[0].GetCppString(); - security = fields[1].GetUInt32(); + security = (AccountTypes)fields[1].GetUInt32(); if(!m_session || m_session->GetSecurity() >= security) { @@ -3681,7 +3681,7 @@ bool ChatHandler::HandleHonorAddCommand(const char* args) if (HasLowerSecurity(target, 0)) return false; - uint32 amount = (uint32)atoi(args); + float amount = (float)atof(args); target->RewardHonor(NULL, 1, amount); return true; } diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 3809f7003..fc0ff0026 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -5550,7 +5550,7 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args) return false; } - guid = sObjectMgr.GetPlayerGUIDByName(name); + guid = GUID_LOPART(sObjectMgr.GetPlayerGUIDByName(name)); } if(!sObjectMgr.GetPlayerAccountIdByGUID(guid)) diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 29cbc35d5..e366259f0 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -350,7 +350,7 @@ void WorldSession::DoLootRelease( uint64 lguid ) else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE) { // The fishing hole used once more 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); } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 6a32abcbb..03115acef 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1584,7 +1584,7 @@ float GridMap::getLiquidLevel(float x, float y) uint8 GridMap::getTerrainType(float x, float y) { if (!m_liquid_type) - return m_liquidType; + return (uint8)m_liquidType; x = 16 * (32 - x/SIZE_OF_GRIDS); y = 16 * (32 - y/SIZE_OF_GRIDS); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index f01555f3b..ca198d7d6 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -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 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); return; @@ -588,7 +588,7 @@ void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data ) uint64 guid; std::string note; recv_data >> guid >> note; - _player->GetSocial()->SetFriendNote(guid, note); + _player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note); } void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index bf3425dd5..6d7deb85a 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -743,7 +743,6 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - WorldPacket data(SMSG_STABLE_RESULT, 200); // guess size Pet* pet = _player->GetPet(); @@ -782,6 +781,8 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) // move alive pet to slot or delete dead pet _player->RemovePet(pet,pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED); + WorldPacket data(SMSG_STABLE_RESULT, 1); // guess size + // summon unstabled pet Pet *newpet = new Pet; if(!newpet->LoadPetFromDB(_player,creature_id,pet_number)) diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 864b01c15..088ff8d04 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -189,7 +189,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse) 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; - sObjectMgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID()); + sObjectMgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID())); corpse->RemoveFromWorld(); i_player2corpse.erase(iter); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index d84cc47b1..bede44b42 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -519,8 +519,8 @@ void Pet::Update(uint32 diff) if(m_duration > 0) { - if(m_duration > diff) - m_duration -= diff; + if(m_duration > (int32)diff) + m_duration -= (int32)diff; else { 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 if(spellproto->procCharges) { - if(remaincharges <= 0 || remaincharges > spellproto->procCharges) + if(remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges) remaincharges = spellproto->procCharges; } else @@ -1774,7 +1774,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply) PetSpellMap::iterator itr = m_spells.find(spellid); - int i; + uint32 i; if(apply) { diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 1c044a3c2..0503ae431 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -265,7 +265,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) // result==NULL also correct in case no sign yet if(result) - signs = result->GetRowCount(); + signs = (uint8)result->GetRowCount(); 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==NULL also correct charter without signs if(result) - signs = result->GetRowCount(); + signs = (uint8)result->GetRowCount(); WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12)); data << petitionguid; // petition guid @@ -762,7 +762,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) uint8 signs; result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); if(result) - signs = result->GetRowCount(); + signs = (uint8)result->GetRowCount(); else signs = 0; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 4c97824ae..0d432879f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -707,7 +707,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 continue; // BuyCount by default - uint32 count = iProto->BuyCount; + int32 count = iProto->BuyCount; // special amount for foor/drink if(iProto->Class==ITEM_CLASS_CONSUMABLE && iProto->SubClass==ITEM_SUBCLASS_FOOD) @@ -901,13 +901,13 @@ int32 Player::getMaxTimer(MirrorTimerType timer) switch (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 sWorld.getConfig(CONFIG_TIMERBAR_FATIGUE_MAX)*IN_MILISECONDS; case BREATH_TIMER: { 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; int32 UnderWaterTime = sWorld.getConfig(CONFIG_TIMERBAR_BREATH_MAX)*IN_MILISECONDS; AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING); @@ -917,7 +917,7 @@ int32 Player::getMaxTimer(MirrorTimerType 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 sWorld.getConfig(CONFIG_TIMERBAR_FIRE_MAX)*IN_MILISECONDS; } @@ -2090,7 +2090,7 @@ void Player::RegenerateHealth(uint32 diff) // polymorphed case if ( IsPolymorphed() ) - addvalue = GetMaxHealth()/3; + addvalue = (float)GetMaxHealth()/3; // normal regen case (maybe partly in combat case) 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())) percent *= rate; - float repMod = GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN); + float repMod = (float)GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN); if (!for_quest) 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) return; - for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i) + for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i) { uint32 statType = 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) ) return; - float chance = spellInfo->procChance; + float chance = (float)spellInfo->procChance; 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 { - uint16 slot; + uint8 slot; switch (attackType) { case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break; @@ -11483,7 +11483,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) uint32 count = 0; - for(int i=0; i < fullBag->GetBagSize(); ++i) + for(uint32 i=0; i < fullBag->GetBagSize(); ++i) { Item *bagItem = fullBag->GetItemByPos(i); if (!bagItem) @@ -11510,7 +11510,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) // Items swap 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); if (!bagItem) @@ -15222,10 +15222,10 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) uint32 spellid = fields[1].GetUInt32(); uint32 effindex = fields[2].GetUInt32(); uint32 stackcount = fields[3].GetUInt32(); - int32 damage = (int32)fields[4].GetUInt32(); - int32 maxduration = (int32)fields[5].GetUInt32(); - int32 remaintime = (int32)fields[6].GetUInt32(); - int32 remaincharges = (int32)fields[7].GetUInt32(); + int32 damage = fields[4].GetInt32(); + int32 maxduration = fields[5].GetInt32(); + int32 remaintime = fields[6].GetInt32(); + int32 remaincharges = fields[7].GetInt32(); SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid); if(!spellproto) @@ -15252,7 +15252,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) // prevent wrong values of remaincharges if(spellproto->procCharges) { - if(remaincharges <= 0 || remaincharges > spellproto->procCharges) + if(remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges) remaincharges = spellproto->procCharges; } else @@ -20679,7 +20679,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) return; // find current max talent rank - int32 curtalent_maxrank = 0; + uint32 curtalent_maxrank = 0; for(int32 k = MAX_TALENT_RANK-1; k > -1; --k) { if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k])) diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 122f7b790..cd0c13ac4 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -499,7 +499,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s ROLLBACK(DUMP_FILE_BROKEN); } - DumpTableType type; + DumpTableType type = DTT_CHARACTER; //Fixed: Using uninitialized memory 'type' DumpTable* dTable = &dumpTables[0]; for(; dTable->isValid(); ++dTable) { diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 27fff2d84..bfbde0e34 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -499,7 +499,7 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data) WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4+(4+4)*count); data << uint32(count); // count - for(int i = 0; i < count; ++i) + for(uint32 i = 0; i < count; ++i) { uint32 questId; recv_data >> questId; // quest id diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 9d02eb7ff..8e38ec552 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5348,7 +5348,7 @@ SpellCastResult Spell::CheckPower() // health as power used - need check health amount 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_CAST_OK; } @@ -5369,7 +5369,7 @@ SpellCastResult Spell::CheckPower() // Check power amount 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; else return SPELL_CAST_OK; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index d2748d438..1598c32a9 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1300,7 +1300,7 @@ bool Aura::modStackAmount(int32 num) // Modify stack but limit it int32 stackAmount = m_stackAmount + num; - if (stackAmount > m_spellProto->StackAmount) + if (stackAmount > (int32)m_spellProto->StackAmount) stackAmount = m_spellProto->StackAmount; 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); if (!buffEntry) 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); } // Earth Shield @@ -2526,7 +2526,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (!spell || !caster) 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()); return; } @@ -2543,7 +2543,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) Unit* caster = GetCaster(); if (!spell || !caster) 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()); return; } @@ -3097,7 +3097,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) { // Furor chance is now amount allowed to save energy for cat form // 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->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 { 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); } break; diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 8f913eb30..a09b1f41d 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -296,7 +296,7 @@ class MANGOS_DLL_SPEC Aura void SetAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); } void SendAuraUpdate(bool remove); - int8 GetStackAmount() {return m_stackAmount;} + uint8 GetStackAmount() {return m_stackAmount;} void SetStackAmount(uint8 num); bool modStackAmount(int32 num); // return true if last charge dropped void RefreshAura(); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index ab12b4de7..cb7d3c35c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -563,7 +563,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) uint32 doses = poison->GetStackAmount(); if (doses > combo) doses = combo; - for (int i=0; i< doses; i++) + for (uint32 i = 0; i < doses; ++i) unitTarget->RemoveSingleSpellAurasFromStack(spellId); damage *= 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(); // 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(); std::advance(aItr, rand() % attackers.size()); @@ -2171,7 +2171,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex) if (!spell) 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); return; } @@ -2183,7 +2183,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex) if (!spell) 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); 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) 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; - if(damage > maxdamage) damage = maxdamage; + if(damage > maxdamage) + damage = maxdamage; } int32 curPower = int32(unitTarget->GetPower(powertype)); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) - uint32 power = damage; + int32 power = damage; if (powertype == POWER_MANA) power -= unitTarget->GetSpellCritDamageReduction(power); @@ -2794,7 +2795,7 @@ void Spell::EffectHealthLeech(uint32 i) uint32 curHealth = unitTarget->GetHealth(); damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damage ); - if (curHealth < damage) + if ((int32)curHealth < damage) damage = curHealth; float multiplier = m_spellInfo->EffectMultipleValue[i]; @@ -4531,7 +4532,7 @@ void Spell::EffectWeaponDmg(uint32 i) // multiple weapon dmg effect workaround // execute only the last weapon damage // 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]) { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index afc064abb..ee5ddce89 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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) { - float moveTime = Time; + float moveTime = (float)Time; WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) ); 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) if (blocked) { - damageInfo->blocked = uint32(pVictim->GetShieldBlockValue()); - if (damage < damageInfo->blocked) + damageInfo->blocked = pVictim->GetShieldBlockValue(); + if (damage < (int32)damageInfo->blocked) damageInfo->blocked = damage; damage-=damageInfo->blocked; } @@ -2248,7 +2248,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe } // Apply death prevention spells effects - if (preventDeathSpell && RemainingDamage >= pVictim->GetHealth()) + if (preventDeathSpell && RemainingDamage >= (int32)pVictim->GetHealth()) { switch(preventDeathSpell->SpellFamilyName) { @@ -2894,7 +2894,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell) int32 tmp = 10000 - HitChance; - uint32 rand = urand(0,10000); + int32 rand = irand(0,10000); if (rand < tmp) return SPELL_MISS_MISS; @@ -4815,7 +4815,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) data << uint32(0); // overkill value 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 << float(damageInfo->damage); // sub damage @@ -4824,13 +4824,13 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) 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 } 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 } @@ -5031,8 +5031,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { // return damage % to attacker but < 50% own total health basepoints0 = triggerAmount*int32(damage)/100; - if(basepoints0 > GetMaxHealth()/2) - basepoints0 = GetMaxHealth()/2; + if(basepoints0 > (int32)GetMaxHealth()/2) + basepoints0 = (int32)GetMaxHealth()/2; triggered_spell_id = 25997; break; @@ -5636,7 +5636,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { Modifier* mod = triggeredByAura->GetModifier(); // 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 uint64 casterGuid = triggeredByAura->GetCasterGUID(); diff --git a/src/game/World.cpp b/src/game/World.cpp index a9e6f4b86..928252313 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -317,7 +317,7 @@ bool World::RemoveQueuedPlayer(WorldSession* sess) --sessions; // 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(); pop_sess->SetInQueue(false); diff --git a/src/shared/Database/DatabasePostgre.cpp b/src/shared/Database/DatabasePostgre.cpp index 8a2cae0c2..7eb258410 100644 --- a/src/shared/Database/DatabasePostgre.cpp +++ b/src/shared/Database/DatabasePostgre.cpp @@ -27,14 +27,6 @@ #include "Database/SqlOperations.h" #include "Timer.h" -void DatabasePostgre::ThreadStart() -{ -} - -void DatabasePostgre::ThreadEnd() -{ -} - size_t DatabasePostgre::db_count = 0; DatabasePostgre::DatabasePostgre() : Database(), mPGconn(NULL) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5e5598199..5cd99aef0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9323" + #define REVISION_NR "9324" #endif // __REVISION_NR_H__