From 512c015dc266a38ff1baee709d5e5cb2a46fdf67 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 29 Apr 2009 03:44:57 +0400 Subject: [PATCH] [7731] Some code cleanups, warrning fixes. --- dep/include/g3dlite/G3D/Table.h | 2 +- dep/include/utf8cpp/utf8/checked.h | 6 +-- src/game/AchievementMgr.cpp | 5 ++- src/game/AchievementMgr.h | 2 +- src/game/BattleGroundAB.h | 2 +- src/game/BattleGroundEY.cpp | 2 +- src/game/BattleGroundEY.h | 17 ++++++-- src/game/BattleGroundHandler.cpp | 3 +- src/game/BattleGroundMgr.cpp | 26 ++++++------ src/game/BattleGroundMgr.h | 14 +++---- src/game/BattleGroundSA.cpp | 2 +- src/game/Channel.cpp | 2 +- src/game/Chat.cpp | 12 +++--- src/game/ChatHandler.cpp | 8 ++-- src/game/ConfusedMovementGenerator.cpp | 3 +- src/game/Creature.h | 2 + src/game/CreatureAI.h | 6 +-- src/game/CreatureAISelector.cpp | 13 +++--- src/game/CreatureEventAI.cpp | 43 ++++--------------- src/game/Level0.cpp | 8 ++-- src/game/Level3.cpp | 6 +-- src/game/ObjectMgr.cpp | 8 ++-- src/game/PetHandler.cpp | 2 + src/game/Player.cpp | 57 ++++++++++++-------------- src/game/SocialMgr.cpp | 4 +- src/game/SpellAuras.cpp | 6 +-- src/game/WorldSession.cpp | 2 +- src/game/WorldSession.h | 8 ++-- src/game/WorldSocket.cpp | 6 +-- src/shared/revision_nr.h | 2 +- 30 files changed, 128 insertions(+), 151 deletions(-) diff --git a/dep/include/g3dlite/G3D/Table.h b/dep/include/g3dlite/G3D/Table.h index 285d774d2..bac714933 100644 --- a/dep/include/g3dlite/G3D/Table.h +++ b/dep/include/g3dlite/G3D/Table.h @@ -611,7 +611,7 @@ public: return true; } node = node->next; - } while (node != NULL); + } return false; } diff --git a/dep/include/utf8cpp/utf8/checked.h b/dep/include/utf8cpp/utf8/checked.h index 5670c196d..8d61a34bf 100644 --- a/dep/include/utf8cpp/utf8/checked.h +++ b/dep/include/utf8cpp/utf8/checked.h @@ -117,13 +117,13 @@ namespace utf8 } else if (cp < 0x10000) { // three octets *(result++) = static_cast((cp >> 12) | 0xe0); - *(result++) = static_cast((cp >> 6) & 0x3f | 0x80); + *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); *(result++) = static_cast((cp & 0x3f) | 0x80); } else if (cp <= internal::CODE_POINT_MAX) { // four octets *(result++) = static_cast((cp >> 18) | 0xf0); - *(result++) = static_cast((cp >> 12)& 0x3f | 0x80); - *(result++) = static_cast((cp >> 6) & 0x3f | 0x80); + *(result++) = static_cast(((cp >> 12)& 0x3f) | 0x80); + *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); *(result++) = static_cast((cp & 0x3f) | 0x80); } else diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index d8ba2e3b1..363e8cbe7 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -1129,6 +1129,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS: case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL: case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: + case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL: case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS: @@ -1147,7 +1148,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui break; // Not implemented yet :( } if(IsCompletedCriteria(achievementCriteria,achievement)) - CompletedCriteria(achievementCriteria,achievement); + CompletedCriteriaFor(achievement); // check again the completeness for SUMM and REQ COUNT achievements, // as they don't depend on the completed criteria but on the sum of the progress of each individual criteria @@ -1296,7 +1297,7 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve return false; } -void AchievementMgr::CompletedCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement) +void AchievementMgr::CompletedCriteriaFor(AchievementEntry const* achievement) { // counter can never complete if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER) diff --git a/src/game/AchievementMgr.h b/src/game/AchievementMgr.h index 02f8ecf72..e4e32e20a 100644 --- a/src/game/AchievementMgr.h +++ b/src/game/AchievementMgr.h @@ -181,7 +181,7 @@ class AchievementMgr void SendAchievementEarned(AchievementEntry const* achievement); void SendCriteriaUpdate(uint32 id, CriteriaProgress const* progress); void SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype = PROGRESS_SET); - void CompletedCriteria(AchievementCriteriaEntry const* entry, AchievementEntry const* achievement); + void CompletedCriteriaFor(AchievementEntry const* achievement); void CompletedAchievement(AchievementEntry const* entry); bool IsCompletedCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement); bool IsCompletedAchievement(AchievementEntry const* entry); diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h index 89e262cf1..b31b1f0f3 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -282,7 +282,7 @@ class BattleGroundAB : public BattleGround uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]; uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]; BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]; - int32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]; + uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]; uint32 m_TeamScores[BG_TEAMS_COUNT]; uint32 m_lastTick[BG_TEAMS_COUNT]; uint32 m_HonorScoreTics[BG_TEAMS_COUNT]; diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 375a56511..efb62e627 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -340,7 +340,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid) // sometimes flag aura not removed :( for (int j = EY_POINTS_MAX; j >= 0; --j) { - for(int i = 0; i < m_PlayersNearPoint[j].size(); ++i) + for(size_t i = 0; i < m_PlayersNearPoint[j].size(); ++i) if (m_PlayersNearPoint[j][i] == guid) m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i); } diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h index ab44fac4f..4f9cf1223 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -245,23 +245,32 @@ struct BattleGroundEYPointIconsStruct struct BattleGroundEYLoosingPointStruct { BattleGroundEYLoosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde) - : SpawnNeutralObjectType(_SpawnNeutralObjectType), DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde) {} + : SpawnNeutralObjectType(_SpawnNeutralObjectType), + DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), + DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde) + {} + uint32 SpawnNeutralObjectType; uint32 DespawnObjectTypeAlliance; + uint32 MessageIdAlliance; uint32 DespawnObjectTypeHorde; uint32 MessageIdHorde; - uint32 MessageIdAlliance; }; struct BattleGroundEYCapturingPointStruct { BattleGroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId) - : DespawnNeutralObjectType(_DespawnNeutralObjectType), SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde), GraveYardId(_GraveYardId) {} + : DespawnNeutralObjectType(_DespawnNeutralObjectType), + SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), + SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde), + GraveYardId(_GraveYardId) + {} + uint32 DespawnNeutralObjectType; uint32 SpawnObjectTypeAlliance; + uint32 MessageIdAlliance; uint32 SpawnObjectTypeHorde; uint32 MessageIdHorde; - uint32 MessageIdAlliance; uint32 GraveYardId; }; diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 426ff9839..c5eca3854 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -112,7 +112,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) // get bg instance or bg template if instance not found BattleGround *bg = NULL; if (instanceId) - bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); + bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId); if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))) { @@ -345,7 +345,6 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) BattleGround * bg = NULL; // get possibly needed data from groupinfo uint8 arenatype = itrPlayerStatus->second.GroupInfo->ArenaType; - uint8 israted = itrPlayerStatus->second.GroupInfo->IsRated; uint8 status = 0; if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 098b75574..2f162bf02 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -488,8 +488,8 @@ large groups are disadvantageous, because they will be kicked first if invitatio */ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel queue_id) { - uint32 hordeFree = bg->GetFreeSlotsForTeam(HORDE); - uint32 aliFree = bg->GetFreeSlotsForTeam(ALLIANCE); + int32 hordeFree = bg->GetFreeSlotsForTeam(HORDE); + int32 aliFree = bg->GetFreeSlotsForTeam(ALLIANCE); //iterator for iterating through bg queue GroupsQueueType::const_iterator Ali_itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); @@ -519,8 +519,8 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel */ // At first we need to compare free space in bg and our selection pool - int32 diffAli = aliFree - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(); - int32 diffHorde = hordeFree - m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount(); + int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()); + int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()); while( abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0) ) { //each cycle execution we need to kick at least 1 group @@ -556,8 +556,8 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel } } //count diffs after small update - diffAli = aliFree - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(); - diffHorde = hordeFree - m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount(); + diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()); + diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()); } } @@ -737,8 +737,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].empty() ) return; - BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenaType); - //battleground with free slot for player should be always in the beggining of the queue // maybe it would be better to create bgfreeslotqueue for each queue_id_based_on_level BGFreeSlotQueueType::iterator itr, next; @@ -1189,8 +1187,8 @@ void BattleGroundMgr::Update(uint32 diff) if (sWorld.GetGameTime() > m_NextAutoDistributionTime) { DistributeArenaPoints(); - m_NextAutoDistributionTime = sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); - CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '"I64FMTD"'", m_NextAutoDistributionTime); + m_NextAutoDistributionTime = time_t(sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS)); + CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '"I64FMTD"'", uint64(m_NextAutoDistributionTime)); } m_AutoDistributionTimeChecker = 600000; // check 10 minutes } @@ -1436,7 +1434,7 @@ void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Pla *data << uint64(plr->GetGUID()); } -BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) +BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId) { //cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from //SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id @@ -1760,12 +1758,12 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution() if (!result) { sLog.outDebug("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now."); - m_NextAutoDistributionTime = sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); - CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"I64FMTD"')", m_NextAutoDistributionTime); + m_NextAutoDistributionTime = time_t(sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS)); + CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"I64FMTD"')", uint64(m_NextAutoDistributionTime)); } else { - m_NextAutoDistributionTime = (*result)[0].GetUInt64(); + m_NextAutoDistributionTime = time_t((*result)[0].GetUInt64()); delete result; } sLog.outDebug("Automatic Arena Point Distribution initialized."); diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index be2a08f7f..c0dacd993 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -158,11 +158,11 @@ class BGQueueInviteEvent : public BasicEvent class BGQueueRemoveEvent : public BasicEvent { public: - BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime) : - m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId), m_RemoveTime(removeTime) - { - }; - virtual ~BGQueueRemoveEvent() {}; + BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime) + : m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId) + {} + + virtual ~BGQueueRemoveEvent() {} virtual bool Execute(uint64 e_time, uint32 p_time); virtual void Abort(uint64 e_time); @@ -194,7 +194,7 @@ class BattleGroundMgr void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid); /* Battlegrounds */ - BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id); + BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId); BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId); @@ -250,7 +250,7 @@ class BattleGroundMgr BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; std::set m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_QUEUES]; //the instanceids just visible for the client uint32 m_NextRatingDiscardUpdate; - uint64 m_NextAutoDistributionTime; + time_t m_NextAutoDistributionTime; uint32 m_AutoDistributionTimeChecker; bool m_ArenaTesting; bool m_Testing; diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp index 5e6b02edf..c52635a04 100644 --- a/src/game/BattleGroundSA.cpp +++ b/src/game/BattleGroundSA.cpp @@ -62,7 +62,7 @@ void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) } -void BattleGroundSA::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index 63733dcdf..64bc508f4 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -169,7 +169,7 @@ void Channel::Leave(uint64 p, bool send) void Channel::KickOrBan(uint64 good, const char *badname, bool ban) { - uint32 sec = 0; + AccountTypes sec = SEC_PLAYER; Player *gplr = objmgr.GetPlayer(good); if(gplr) sec = gplr->GetSession()->GetSecurity(); diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 34daba7a9..c3089fab0 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -707,7 +707,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 && 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); @@ -937,27 +937,27 @@ int ChatHandler::ParseCommands(const char* text) // return 0; /// chat case (.command or !command format) - if(m_session) + if (m_session) { if(text[0] != '!' && text[0] != '.') return 0; } /// ignore single . and ! in line - if(strlen(text) < 2) + if (strlen(text) < 2) return 0; /// ignore messages staring from many dots. - if(text[0] == '.' && text[1] == '.' || text[0] == '!' && text[1] == '!') + if ((text[0] == '.' && text[1] == '.') || (text[0] == '!' && text[1] == '!')) return 0; /// skip first . or ! (in console allowed use command with . and ! and without its) - if(text[0] == '!' || text[0] == '.') + if (text[0] == '!' || text[0] == '.') ++text; std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing. - if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) + if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) SendSysMessage(LANG_NO_CMD); return 1; diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index 73f9c187e..eaf993f50 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -69,7 +69,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) bool foundAura = false; for(Unit::AuraList::const_iterator i = langAuras.begin();i != langAuras.end(); ++i) { - if((*i)->GetModifier()->m_miscvalue == lang) + if((*i)->GetModifier()->m_miscvalue == int32(lang)) { foundAura = true; break; @@ -192,7 +192,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) Player *player = objmgr.GetPlayer(to.c_str()); uint32 tSecurity = GetSecurity(); uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER; - if(!player || tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers()) + if (!player || (tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers())) { WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, (to.size()+1)); data<GetOriginalGroup(); // so if player hasn't OriginalGroup and his player->GetGroup() is BG raid or his group isn't raid, then return - if( !group && !(group = GetPlayer()->GetGroup()) || group->isBGGroup() || !group->isRaidGroup() ) + if ((!group && !(group = GetPlayer()->GetGroup())) || group->isBGGroup() || !group->isRaidGroup()) return; WorldPacket data; @@ -346,7 +346,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) // if player is in battleground, he cannot say to battleground members by /ra Group *group = GetPlayer()->GetOriginalGroup(); - if( !group && !(group = GetPlayer()->GetGroup()) || group->isBGGroup() || !group->isRaidGroup() ) + if ((!group && !(group = GetPlayer()->GetGroup())) || group->isBGGroup() || !group->isRaidGroup()) return; WorldPacket data; diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp index 79040760f..d591d151f 100644 --- a/src/game/ConfusedMovementGenerator.cpp +++ b/src/game/ConfusedMovementGenerator.cpp @@ -54,11 +54,12 @@ ConfusedMovementGenerator::Initialize(T &unit) bool is_water = map->IsInWater(i_waypoints[idx][0],i_waypoints[idx][1],z); // if generated wrong path just ignore - if( is_water && !is_water_ok || !is_water && !is_land_ok ) + if ((is_water && !is_water_ok) || (!is_water && !is_land_ok)) { i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x; i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y; } + unit.UpdateGroundPositionZ(i_waypoints[idx][0],i_waypoints[idx][1],z); i_waypoints[idx][2] = z; } diff --git a/src/game/Creature.h b/src/game/Creature.h index ba113a2d7..9953a31be 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -322,9 +322,11 @@ enum AttackingTarget ATTACKING_TARGET_RANDOM = 0, //Just selects a random target ATTACKING_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom ATTACKING_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top + /* not implemented ATTACKING_TARGET_RANDOM_PLAYER, //Just selects a random target (player only) ATTACKING_TARGET_TOPAGGRO_PLAYER, //Selects targes from top aggro to bottom (player only) ATTACKING_TARGET_BOTTOMAGGRO_PLAYER, //Selects targets from bottom aggro to top (player only) + */ }; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index e64214ff4..ef2612399 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -64,7 +64,7 @@ class MANGOS_DLL_SPEC CreatureAI // Called at any Damage from any attacker (before damage apply) // Note: it for recalculation damage or special reaction at damage // for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also - virtual void DamageTaken(Unit *done_by, uint32 & /*damage*/) {} + virtual void DamageTaken(Unit * /*done_by*/, uint32 & /*damage*/) {} // Called when the creature is killed virtual void JustDied(Unit *) {} @@ -93,7 +93,7 @@ class MANGOS_DLL_SPEC CreatureAI virtual void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) {} // Called at text emote receive from player - virtual void ReceiveEmote(Player* pPlayer, uint32 text_emote) {} + virtual void ReceiveEmote(Player* /*pPlayer*/, uint32 /*text_emote*/) {} ///== Triggered Actions Requested ================== @@ -102,7 +102,7 @@ class MANGOS_DLL_SPEC CreatureAI virtual void AttackStart(Unit *) {} // Called at World update tick - virtual void UpdateAI(const uint32 diff ) {} + virtual void UpdateAI(const uint32 /*diff*/) {} ///== State checks ================================= diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index 56ed5f300..e446f72b7 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -33,7 +33,7 @@ namespace FactorySelector CreatureAI* selectAI(Creature *creature) { // Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets) - if((!creature->isPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed()) + if ((!creature->isPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed()) if(CreatureAI* scriptedAI = Script->GetAI(creature)) return scriptedAI; @@ -46,20 +46,21 @@ namespace FactorySelector // select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems // excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI Unit *owner=NULL; - if(creature->isPet() && ((Pet*)creature)->isControlled() && (owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER || creature->isCharmed()) + if (creature->isPet() && ((Pet*)creature)->isControlled() && + ((owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER) || creature->isCharmed()) ai_factory = ai_registry.GetRegistryItem("PetAI"); - else if(creature->isTotem()) + else if (creature->isTotem()) ai_factory = ai_registry.GetRegistryItem("TotemAI"); // select by script name - if( !ai_factory && !ainame.empty()) + if (!ai_factory && !ainame.empty()) ai_factory = ai_registry.GetRegistryItem( ainame.c_str() ); - if(!ai_factory && creature->isGuard() ) + if (!ai_factory && creature->isGuard() ) ai_factory = ai_registry.GetRegistryItem("GuardAI"); // select by permit check - if(!ai_factory) + if (!ai_factory) { int best_val = PERMIT_BASE_NO; typedef CreatureAIRegistry::RegistryMapType RMT; diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index e337351f7..49d5634d4 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -65,7 +65,7 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) } //EventMap had events but they were not added because they must be for instance if (CreatureEventAIList.empty()) - sLog.outError("CreatureEventAI: CreatureId has events but no events added to list because of instance flags.", m_creature->GetEntry()); + sLog.outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", m_creature->GetEntry()); } else sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry()); @@ -105,34 +105,10 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction if (pHolder.Event.event_chance <= rnd % 100) return false; - union - { - uint32 param1; - int32 param1_s; - }; - - union - { - uint32 param2; - int32 param2_s; - }; - - union - { - uint32 param3; - int32 param3_s; - }; - - union - { - uint32 param4; - int32 param4_s; - }; - - param1 = pHolder.Event.event_param1; - param2 = pHolder.Event.event_param2; - param3 = pHolder.Event.event_param3; - param4 = pHolder.Event.event_param4; + uint32 param1 = pHolder.Event.event_param1; + uint32 param2 = pHolder.Event.event_param2; + uint32 param3 = pHolder.Event.event_param3; + uint32 param4 = pHolder.Event.event_param4; //Check event conditions based on the event type, also reset events switch (pHolder.Event.event_type) @@ -519,13 +495,12 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u if (temp) { Unit* target = NULL; - Unit* owner = NULL; if (pActionInvoker) { if (pActionInvoker->GetTypeId() == TYPEID_PLAYER) target = pActionInvoker; - else if (owner = pActionInvoker->GetOwner()) + else if (Unit* owner = pActionInvoker->GetOwner()) { if (owner->GetTypeId() == TYPEID_PLAYER) target = owner; @@ -534,13 +509,9 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u else if (target = m_creature->getVictim()) { if (target->GetTypeId() != TYPEID_PLAYER) - { - if (owner = target->GetOwner()) - { + if (Unit* owner = target->GetOwner()) if (owner->GetTypeId() == TYPEID_PLAYER) target = owner; - } - } } DoScriptText(temp, m_creature, target); diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index 5854381fc..24eeed581 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -55,8 +55,8 @@ bool ChatHandler::HandleCommandsCommand(const char* /*args*/) bool ChatHandler::HandleAccountCommand(const char* /*args*/) { - uint32 gmlevel = m_session->GetSecurity(); - PSendSysMessage(LANG_ACCOUNT_LEVEL, gmlevel); + AccountTypes gmlevel = m_session->GetSecurity(); + PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel)); return true; } @@ -134,7 +134,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/) Player *player=m_session->GetPlayer(); // save GM account without delay and output message (testing, etc) - if(m_session->GetSecurity()) + if(m_session->GetSecurity() > SEC_PLAYER) { player->SaveToDB(); SendSysMessage(LANG_PLAYER_SAVED); @@ -157,7 +157,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) HashMapHolder::MapType::const_iterator itr = m.begin(); for(; itr != m.end(); ++itr) { - if (itr->second->GetSession()->GetSecurity() && + if (itr->second->GetSession()->GetSecurity() > SEC_PLAYER && (itr->second->isGameMaster() || sWorld.getConfig(CONFIG_GM_IN_GM_LIST)) && (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())) ) { diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 12e7b566b..a0723e46f 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -830,8 +830,8 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) return false; /// account can't set security to same or grater level, need more power GM or console - uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE; - if (uint32(gm) >= plSecurity ) + AccountTypes plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE; + if (AccountTypes(gm) >= plSecurity ) { SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); SetSentErrorMessage(true); @@ -842,7 +842,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) if(targetPlayer && m_session->GetPlayer()!=targetPlayer) { ChatHandler(targetPlayer).PSendSysMessage(LANG_YOURS_SECURITY_CHANGED,GetNameLink().c_str(), gm); - targetPlayer->GetSession()->SetSecurity(gm); + targetPlayer->GetSession()->SetSecurity(AccountTypes(gm)); } PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index fc32e21e3..d2c20296a 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -447,7 +447,7 @@ void ObjectMgr::LoadPointOfInterestLocales() struct SQLCreatureLoader : public SQLStorageLoaderBase { template - void convert_from_str(uint32 field_pos, char *src, D &dst) + void convert_from_str(uint32 /*field_pos*/, char *src, D &dst) { dst = D(objmgr.GetScriptId(src)); } @@ -1394,7 +1394,7 @@ void ObjectMgr::LoadItemLocales() struct SQLItemLoader : public SQLStorageLoaderBase { template - void convert_from_str(uint32 field_pos, char *src, D &dst) + void convert_from_str(uint32 /*field_pos*/, char *src, D &dst) { dst = D(objmgr.GetScriptId(src)); } @@ -4133,7 +4133,7 @@ void ObjectMgr::LoadPageTextLocales() struct SQLInstanceLoader : public SQLStorageLoaderBase { template - void convert_from_str(uint32 field_pos, char *src, D &dst) + void convert_from_str(uint32 /*field_pos*/, char *src, D &dst) { dst = D(objmgr.GetScriptId(src)); } @@ -5397,7 +5397,7 @@ void ObjectMgr::LoadGameObjectLocales() struct SQLGameObjectLoader : public SQLStorageLoaderBase { template - void convert_from_str(uint32 field_pos, char *src, D &dst) + void convert_from_str(uint32 /*field_pos*/, char *src, D &dst) { dst = D(objmgr.GetScriptId(src)); } diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index d57cff527..e7e323900 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -255,6 +255,8 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) case SPELL_FAILED_REQUIRES_SPELL_FOCUS: data << uint32(spellInfo->RequiresSpellFocus); break; + default: + break; } SendPacket(&data); } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 6f9e274ea..f4bd869a1 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -10013,22 +10013,22 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo Item *pItem2 = GetItemByPos( bag, slot ); - if( !pItem2 ) + if (!pItem2) { - if(clone) + if (clone) pItem = pItem->CloneItem(count,this); else pItem->SetCount(count); - if(!pItem) + if (!pItem) return NULL; - if( pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || + if (pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM || - pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos) ) + (pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos))) pItem->SetBinding( true ); - if( bag == INVENTORY_SLOT_BAG_0 ) + if (bag == INVENTORY_SLOT_BAG_0) { m_items[slot] = pItem; SetUInt64Value( (uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2) ), pItem->GetGUID() ); @@ -10042,7 +10042,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) UpdateKnownCurrencies(pItem->GetEntry(),true); - if( IsInWorld() && update ) + if (IsInWorld() && update) { pItem->AddToWorld(); pItem->SendUpdateToPlayer( this ); @@ -10050,20 +10050,16 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo pItem->SetState(ITEM_CHANGED, this); } - else + else if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag )) { - Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); - if( pBag ) + pBag->StoreItem( slot, pItem, update ); + if( IsInWorld() && update ) { - pBag->StoreItem( slot, pItem, update ); - if( IsInWorld() && update ) - { - pItem->AddToWorld(); - pItem->SendUpdateToPlayer( this ); - } - pItem->SetState(ITEM_CHANGED, this); - pBag->SetState(ITEM_CHANGED, this); + pItem->AddToWorld(); + pItem->SendUpdateToPlayer( this ); } + pItem->SetState(ITEM_CHANGED, this); + pBag->SetState(ITEM_CHANGED, this); } AddEnchantmentDurations(pItem); @@ -10073,19 +10069,19 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo } else { - if( pItem2->GetProto()->Bonding == BIND_WHEN_PICKED_UP || + if (pItem2->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem2->GetProto()->Bonding == BIND_QUEST_ITEM || - pItem2->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos) ) + (pItem2->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos))) pItem2->SetBinding( true ); pItem2->SetCount( pItem2->GetCount() + count ); - if( IsInWorld() && update ) + if (IsInWorld() && update) pItem2->SendUpdateToPlayer( this ); - if(!clone) + if (!clone) { // delete item (it not in any slot currently) - if( IsInWorld() && update ) + if (IsInWorld() && update) { pItem->RemoveFromWorld(); pItem->DestroyForPlayer( this ); @@ -10097,6 +10093,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor pItem->SetState(ITEM_REMOVED, this); } + // AddItemDurations(pItem2); - pItem2 already have duration listed for player AddEnchantmentDurations(pItem2); @@ -10108,14 +10105,12 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update ) { - Item *pItem = Item::CreateItem( item, 1, this ); - if( pItem ) + if (Item *pItem = Item::CreateItem( item, 1, this )) { ItemAddedQuestCheck( item, 1 ); - Item * retItem = EquipItem( pos, pItem, update ); - - return retItem; + return EquipItem( pos, pItem, update ); } + return NULL; } @@ -13776,7 +13771,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_name = fields[3].GetCppString(); // check name limitations - if(!ObjectMgr::IsValidName(m_name) || GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)) + if(!ObjectMgr::IsValidName(m_name) || (GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name))) { delete result; CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid); @@ -13891,7 +13886,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID())) { BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType()); - uint32 queueSlot = AddBattleGroundQueueId(bgQueueTypeId); + AddBattleGroundQueueId(bgQueueTypeId); SetBattleGroundId(currentBg->GetInstanceID(), currentBg->GetTypeID()); SetBGTeam(bgteam); @@ -18715,7 +18710,7 @@ uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const return 0; // weapon skill or (unarmed for base attack) - uint32 skill = item ? item->GetSkill() : SKILL_UNARMED; + uint32 skill = item ? item->GetSkill() : uint32(SKILL_UNARMED); return GetBaseSkillValue(skill); } diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index c9dc812ca..2a93a8f68 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -187,7 +187,7 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri Player *pFriend = ObjectAccessor::FindPlayer(friendGUID); uint32 team = player->GetTeam(); - uint32 security = player->GetSession()->GetSecurity(); + AccountTypes security = player->GetSession()->GetSecurity(); bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST) || security > SEC_PLAYER; @@ -265,7 +265,7 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet) return; uint32 team = player->GetTeam(); - uint32 security = player->GetSession()->GetSecurity(); + AccountTypes security = player->GetSession()->GetSecurity(); uint32 guid = player->GetGUIDLow(); bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST); bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 5d83a255b..3c3b6b555 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2734,18 +2734,16 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) case FORM_BEAR: case FORM_DIREBEAR: case FORM_CAT: - { if(Aura* dummy = m_target->GetDummyAura(37315) ) m_target->CastSpell(m_target,37316,true,NULL,dummy); break; - } // Nordrassil Regalia - bonus case FORM_MOONKIN: - { if(Aura* dummy = m_target->GetDummyAura(37324) ) m_target->CastSpell(m_target,37325,true,NULL,dummy); break; - } + default: + break; } } diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index eac9679d6..ddf4dd865 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -38,7 +38,7 @@ #include "zlib/zlib.h" /// WorldSession constructor -WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale) : +WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale) : LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time), _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)), diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 1b588652d..47a0c675f 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -98,7 +98,7 @@ class MANGOS_DLL_SPEC WorldSession { friend class CharacterHandler; public: - WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale); + WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale); ~WorldSession(); bool PlayerLoading() const { return m_playerLoading; } @@ -120,11 +120,11 @@ class MANGOS_DLL_SPEC WorldSession void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3); void SendSetPhaseShift(uint32 phaseShift); - uint32 GetSecurity() const { return _security; } + AccountTypes GetSecurity() const { return _security; } uint32 GetAccountId() const { return _accountId; } Player* GetPlayer() const { return _player; } char const* GetPlayerName() const; - void SetSecurity(uint32 security) { _security = security; } + void SetSecurity(AccountTypes security) { _security = security; } std::string const& GetRemoteAddress() { return m_Address; } void SetPlayer(Player *plr) { _player = plr; } uint8 Expansion() const { return m_expansion; } @@ -699,7 +699,7 @@ class MANGOS_DLL_SPEC WorldSession WorldSocket *m_Socket; std::string m_Address; - uint32 _security; + AccountTypes _security; uint32 _accountId; uint8 m_expansion; diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index be4f3d54b..40a40d31d 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -927,7 +927,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) // Check locked state for server AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit (); - if (allowedAccountType > SEC_PLAYER && security < allowedAccountType) + if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType) { WorldPacket Packet (SMSG_AUTH_RESPONSE, 1); Packet << uint8 (AUTH_UNAVAILABLE); @@ -978,8 +978,8 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) address.c_str (), safe_account.c_str ()); - // NOTE ATM the socket is singlethreaded, have this in mind ... - ACE_NEW_RETURN (m_Session, WorldSession (id, this, security, expansion, mutetime, locale), -1); + // NOTE ATM the socket is single-threaded, have this in mind ... + ACE_NEW_RETURN (m_Session, WorldSession (id, this, AccountTypes(security), expansion, mutetime, locale), -1); m_Crypt.SetKey (&K); m_Crypt.Init (); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 821681a07..3df7452fd 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 "7730" + #define REVISION_NR "7731" #endif // __REVISION_NR_H__