From 56d694b5fb45a21b046a9e3a41664b427d40b56e Mon Sep 17 00:00:00 2001 From: balrok Date: Fri, 20 Nov 2009 13:16:22 +0100 Subject: [PATCH] [8846] corrections for my last commit thx to vladimir and apoc :) --- src/game/Channel.cpp | 5 ++--- src/game/Chat.cpp | 6 +++--- src/game/Creature.cpp | 6 +++--- src/game/GameEventMgr.cpp | 18 +++++++++--------- src/game/GameObject.cpp | 2 +- src/game/GossipDef.cpp | 34 +++++++++++++++++----------------- src/game/MiscHandler.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 8 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index 840bb1f0d..7da136276 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -446,7 +446,7 @@ void Channel::List(Player* player) size_t pos = data.wpos(); data << uint32(0); // size of list, placeholder - uint32 gmLevelInWhoList = sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); + AccountTypes gmLevelInWhoList = (AccountTypes)sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); uint32 count = 0; for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) @@ -455,8 +455,7 @@ void Channel::List(Player* player) // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || - (uint32)plr->GetSession()->GetSecurity() <= gmLevelInWhoList) && + if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) && plr->IsVisibleGloballyFor(player)) { data << uint64(i->first); diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 5f61df391..23457fdf7 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -700,7 +700,7 @@ const char *ChatHandler::GetMangosString(int32 entry) const bool ChatHandler::isAvailable(ChatCommand const& cmd) const { // check security level only for simple command (without child commands) - return (uint32)m_session->GetSecurity() >= cmd.SecurityLevel; + return m_session->GetSecurity() >= (AccountTypes)cmd.SecurityLevel; } bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong) @@ -742,7 +742,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac else return true; // caller must report error for (target==NULL && target_account==0) - if ((uint32)m_session->GetSecurity() < target_sec || (strong && (uint32)m_session->GetSecurity() <= target_sec)) + if (m_session->GetSecurity() < target_sec || (strong && (uint32)m_session->GetSecurity() <= target_sec)) { SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); SetSentErrorMessage(true); @@ -1521,7 +1521,7 @@ valid examples: for(uint8 i=LOCALE_koKR; i= il->Name.size()) + if (dbIndex == -1 || il == NULL || (size_t)dbIndex >= il->Name.size()) // using strange database/client combinations can lead to this case expectedName = linkedItem->Name1; else diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index e8278c25d..679951a9f 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -838,9 +838,9 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) NpcOptionLocale const *no = sObjectMgr.GetNpcOptionLocale(gso->Id); if (no) { - if (no->OptionText.size() > (uint)loc_idx && !no->OptionText[loc_idx].empty()) + if (no->OptionText.size() > (size_t)loc_idx && !no->OptionText[loc_idx].empty()) OptionText=no->OptionText[loc_idx]; - if (no->BoxText.size() > (uint)loc_idx && !no->BoxText[loc_idx].empty()) + if (no->BoxText.size() > (size_t)loc_idx && !no->BoxText[loc_idx].empty()) BoxText=no->BoxText[loc_idx]; } } @@ -2301,7 +2301,7 @@ const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(GetEntry()); if (cl) { - if (cl->Name.size() > (uint)loc_idx && !cl->Name[loc_idx].empty()) + if (cl->Name.size() > (size_t)loc_idx && !cl->Name[loc_idx].empty()) return cl->Name[loc_idx].c_str(); } } diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index b292f3489..2249b9465 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -199,7 +199,7 @@ void GameEventMgr::LoadFromDB() int32 internal_event_id = mGameEvent.size() + event_id - 1; - if(internal_event_id < 0 || (uint)internal_event_id >= mGameEventCreatureGuids.size()) + if(internal_event_id < 0 || (size_t)internal_event_id >= mGameEventCreatureGuids.size()) { sLog.outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`",event_id); continue; @@ -245,7 +245,7 @@ void GameEventMgr::LoadFromDB() int32 internal_event_id = mGameEvent.size() + event_id - 1; - if(internal_event_id < 0 || (uint)internal_event_id >= mGameEventGameobjectGuids.size()) + if(internal_event_id < 0 || (size_t)internal_event_id >= mGameEventGameobjectGuids.size()) { sLog.outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`",event_id); continue; @@ -394,7 +394,7 @@ void GameEventMgr::LoadFromDB() int32 internal_event_id = mGameEvent.size() + event_id - 1; - if (internal_event_id < 0 || (uint)internal_event_id >= mGameEventPoolIds.size()) + if (internal_event_id < 0 || (size_t)internal_event_id >= mGameEventPoolIds.size()) { sLog.outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`",event_id); continue; @@ -506,7 +506,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) { int32 internal_event_id = mGameEvent.size() + event_id - 1; - if (internal_event_id < 0 || (uint)internal_event_id >= mGameEventCreatureGuids.size()) + if (internal_event_id < 0 || (size_t)internal_event_id >= mGameEventCreatureGuids.size()) { sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size()); return; @@ -539,7 +539,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) } } - if (internal_event_id < 0 || (uint)internal_event_id >= mGameEventGameobjectGuids.size()) + if (internal_event_id < 0 || (size_t)internal_event_id >= mGameEventGameobjectGuids.size()) { sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size()); return; @@ -573,7 +573,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) } } - if (internal_event_id < 0 || (uint)internal_event_id >= mGameEventPoolIds.size()) + if (internal_event_id < 0 || (size_t)internal_event_id >= mGameEventPoolIds.size()) { sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size()); return; @@ -591,7 +591,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) { int32 internal_event_id = mGameEvent.size() + event_id - 1; - if (internal_event_id < 0 || (uint)internal_event_id >= mGameEventCreatureGuids.size()) + if (internal_event_id < 0 || (size_t)internal_event_id >= mGameEventCreatureGuids.size()) { sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size()); return; @@ -609,7 +609,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) } } - if (internal_event_id < 0 || (uint)internal_event_id >= mGameEventGameobjectGuids.size()) + if (internal_event_id < 0 || (size_t)internal_event_id >= mGameEventGameobjectGuids.size()) { sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size()); return; @@ -626,7 +626,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) pGameobject->AddObjectToRemoveList(); } } - if (internal_event_id < 0 || (uint)internal_event_id >= mGameEventPoolIds.size()) + if (internal_event_id < 0 || (size_t)internal_event_id >= mGameEventPoolIds.size()) { sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size()); return; diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index b7f7f1166..0aa6f7f99 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1296,7 +1296,7 @@ const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const GameObjectLocale const *cl = sObjectMgr.GetGameObjectLocale(GetEntry()); if (cl) { - if (cl->Name.size() > (uint)loc_idx && !cl->Name[loc_idx].empty()) + if (cl->Name.size() > (size_t)loc_idx && !cl->Name[loc_idx].empty()) return cl->Name[loc_idx].c_str(); } } diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index c40c6df28..12fd7846c 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -160,7 +160,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID); if (ql) { - if (ql->Title.size() > (uint)loc_idx && !ql->Title[loc_idx].empty()) + if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty()) Title=ql->Title[loc_idx]; } } @@ -266,9 +266,9 @@ void PlayerMenu::SendTalking( uint32 textID ) { for (int i=0;i<8;++i) { - if (nl->Text_0[i].size() > (uint)loc_idx && !nl->Text_0[i][loc_idx].empty()) + if (nl->Text_0[i].size() > (size_t)loc_idx && !nl->Text_0[i][loc_idx].empty()) Text_0[i]=nl->Text_0[i][loc_idx]; - if (nl->Text_1[i].size() > (uint)loc_idx && !nl->Text_1[i][loc_idx].empty()) + if (nl->Text_1[i].size() > (size_t)loc_idx && !nl->Text_1[i][loc_idx].empty()) Text_1[i]=nl->Text_1[i][loc_idx]; } } @@ -393,7 +393,7 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl { if(QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID)) { - if (ql->Title.size() > (uint)loc_idx && !ql->Title[loc_idx].empty()) + if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty()) title=ql->Title[loc_idx]; } } @@ -432,13 +432,13 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); if (ql) { - if (ql->Title.size() > (uint)loc_idx && !ql->Title[loc_idx].empty()) + if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty()) Title=ql->Title[loc_idx]; - if (ql->Details.size() > (uint)loc_idx && !ql->Details[loc_idx].empty()) + if (ql->Details.size() > (size_t)loc_idx && !ql->Details[loc_idx].empty()) Details=ql->Details[loc_idx]; - if (ql->Objectives.size() > (uint)loc_idx && !ql->Objectives[loc_idx].empty()) + if (ql->Objectives.size() > (size_t)loc_idx && !ql->Objectives[loc_idx].empty()) Objectives=ql->Objectives[loc_idx]; - if (ql->EndText.size() > (uint)loc_idx && !ql->EndText[loc_idx].empty()) + if (ql->EndText.size() > (size_t)loc_idx && !ql->EndText[loc_idx].empty()) EndText=ql->EndText[loc_idx]; } } @@ -528,17 +528,17 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); if (ql) { - if (ql->Title.size() > (uint)loc_idx && !ql->Title[loc_idx].empty()) + if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty()) Title=ql->Title[loc_idx]; - if (ql->Details.size() > (uint)loc_idx && !ql->Details[loc_idx].empty()) + if (ql->Details.size() > (size_t)loc_idx && !ql->Details[loc_idx].empty()) Details=ql->Details[loc_idx]; - if (ql->Objectives.size() > (uint)loc_idx && !ql->Objectives[loc_idx].empty()) + if (ql->Objectives.size() > (size_t)loc_idx && !ql->Objectives[loc_idx].empty()) Objectives=ql->Objectives[loc_idx]; - if (ql->EndText.size() > (uint)loc_idx && !ql->EndText[loc_idx].empty()) + if (ql->EndText.size() > (size_t)loc_idx && !ql->EndText[loc_idx].empty()) EndText=ql->EndText[loc_idx]; for (int i = 0;i < QUEST_OBJECTIVES_COUNT; ++i) - if (ql->ObjectiveText[i].size() > (uint)loc_idx && !ql->ObjectiveText[i][loc_idx].empty()) + if (ql->ObjectiveText[i].size() > (size_t)loc_idx && !ql->ObjectiveText[i][loc_idx].empty()) ObjectiveText[i] = ql->ObjectiveText[i][loc_idx]; } } @@ -650,9 +650,9 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); if (ql) { - if (ql->Title.size() > (uint)loc_idx && !ql->Title[loc_idx].empty()) + if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty()) Title=ql->Title[loc_idx]; - if (ql->OfferRewardText.size() > (uint)loc_idx && !ql->OfferRewardText[loc_idx].empty()) + if (ql->OfferRewardText.size() > (size_t)loc_idx && !ql->OfferRewardText[loc_idx].empty()) OfferRewardText=ql->OfferRewardText[loc_idx]; } } @@ -738,9 +738,9 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); if (ql) { - if (ql->Title.size() > (uint)loc_idx && !ql->Title[loc_idx].empty()) + if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty()) Title=ql->Title[loc_idx]; - if (ql->RequestItemsText.size() > (uint)loc_idx && !ql->RequestItemsText[loc_idx].empty()) + if (ql->RequestItemsText.size() > (size_t)loc_idx && !ql->RequestItemsText[loc_idx].empty()) RequestItemsText=ql->RequestItemsText[loc_idx]; } } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index c3e229536..beebe8f92 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -136,7 +136,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) uint32 team = _player->GetTeam(); uint32 security = GetSecurity(); bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); - uint32 gmLevelInWhoList = sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); + AccountTypes gmLevelInWhoList = (AccountTypes)sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); WorldPacket data( SMSG_WHO, 50 ); // guess size data << clientcount; // clientcount place holder @@ -153,7 +153,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) continue; // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST - if ((uint)itr->second->GetSession()->GetSecurity() > gmLevelInWhoList) + if (itr->second->GetSession()->GetSecurity() > gmLevelInWhoList) continue; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6ad8e4822..d8b146786 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 "8845" + #define REVISION_NR "8846" #endif // __REVISION_NR_H__