[8846] corrections for my last commit

thx to vladimir and apoc :)
This commit is contained in:
balrok 2009-11-20 13:16:22 +01:00
parent 1d362eace4
commit 56d694b5fb
8 changed files with 38 additions and 39 deletions

View file

@ -446,7 +446,7 @@ void Channel::List(Player* player)
size_t pos = data.wpos(); size_t pos = data.wpos();
data << uint32(0); // size of list, placeholder 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; uint32 count = 0;
for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) 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 // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) &&
(uint32)plr->GetSession()->GetSecurity() <= gmLevelInWhoList) &&
plr->IsVisibleGloballyFor(player)) plr->IsVisibleGloballyFor(player))
{ {
data << uint64(i->first); data << uint64(i->first);

View file

@ -700,7 +700,7 @@ const char *ChatHandler::GetMangosString(int32 entry) const
bool ChatHandler::isAvailable(ChatCommand const& cmd) const bool ChatHandler::isAvailable(ChatCommand const& cmd) const
{ {
// check security level only for simple command (without child commands) // 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) bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
@ -742,7 +742,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 ((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); SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -1521,7 +1521,7 @@ valid examples:
for(uint8 i=LOCALE_koKR; i<MAX_LOCALE; ++i) for(uint8 i=LOCALE_koKR; i<MAX_LOCALE; ++i)
{ {
int8 dbIndex = sObjectMgr.GetIndexForLocale(LocaleConstant(i)); int8 dbIndex = sObjectMgr.GetIndexForLocale(LocaleConstant(i));
if (dbIndex == -1 || il == NULL || (uint)dbIndex >= il->Name.size()) if (dbIndex == -1 || il == NULL || (size_t)dbIndex >= il->Name.size())
// using strange database/client combinations can lead to this case // using strange database/client combinations can lead to this case
expectedName = linkedItem->Name1; expectedName = linkedItem->Name1;
else else

View file

@ -838,9 +838,9 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid )
NpcOptionLocale const *no = sObjectMgr.GetNpcOptionLocale(gso->Id); NpcOptionLocale const *no = sObjectMgr.GetNpcOptionLocale(gso->Id);
if (no) 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]; 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]; BoxText=no->BoxText[loc_idx];
} }
} }
@ -2301,7 +2301,7 @@ const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(GetEntry()); CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(GetEntry());
if (cl) 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(); return cl->Name[loc_idx].c_str();
} }
} }

View file

@ -199,7 +199,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1; 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); sLog.outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue; continue;
@ -245,7 +245,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1; 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); sLog.outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue; continue;
@ -394,7 +394,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1; 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); sLog.outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue; continue;
@ -506,7 +506,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
{ {
int32 internal_event_id = mGameEvent.size() + event_id - 1; 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()); sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size());
return; 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()); sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size());
return; 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()); sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size());
return; return;
@ -591,7 +591,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
{ {
int32 internal_event_id = mGameEvent.size() + event_id - 1; 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()); sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size());
return; 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()); sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size());
return; return;
@ -626,7 +626,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
pGameobject->AddObjectToRemoveList(); 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()); sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size());
return; return;

View file

@ -1296,7 +1296,7 @@ const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const
GameObjectLocale const *cl = sObjectMgr.GetGameObjectLocale(GetEntry()); GameObjectLocale const *cl = sObjectMgr.GetGameObjectLocale(GetEntry());
if (cl) 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(); return cl->Name[loc_idx].c_str();
} }
} }

View file

@ -160,7 +160,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID )
QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID); QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID);
if (ql) 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]; Title=ql->Title[loc_idx];
} }
} }
@ -266,9 +266,9 @@ void PlayerMenu::SendTalking( uint32 textID )
{ {
for (int i=0;i<8;++i) 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]; 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]; 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(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]; title=ql->Title[loc_idx];
} }
} }
@ -432,13 +432,13 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID
QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
if (ql) 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]; 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]; 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]; 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]; EndText=ql->EndText[loc_idx];
} }
} }
@ -528,17 +528,17 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
if (ql) 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]; 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]; 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]; 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]; EndText=ql->EndText[loc_idx];
for (int i = 0;i < QUEST_OBJECTIVES_COUNT; ++i) 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]; 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()); QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
if (ql) 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]; 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]; OfferRewardText=ql->OfferRewardText[loc_idx];
} }
} }
@ -738,9 +738,9 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID
QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
if (ql) 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]; 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]; RequestItemsText=ql->RequestItemsText[loc_idx];
} }
} }

View file

@ -136,7 +136,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
uint32 team = _player->GetTeam(); uint32 team = _player->GetTeam();
uint32 security = GetSecurity(); uint32 security = GetSecurity();
bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); 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 WorldPacket data( SMSG_WHO, 50 ); // guess size
data << clientcount; // clientcount place holder data << clientcount; // clientcount place holder
@ -153,7 +153,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
continue; continue;
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST // 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; continue;
} }

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 "8845" #define REVISION_NR "8846"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__