diff options
author | megamage <none@none> | 2009-04-29 00:31:03 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-29 00:31:03 -0500 |
commit | 295b634ca691ff87e8451593e277211fcb02c929 (patch) | |
tree | 75fa8ebd556019305b031531e2fa9b3937e79553 | |
parent | de11b9e901d1d1caa0634fad541f08f11c5781af (diff) |
[7731] Some code cleanups, warrning fixes. Author: VladimirMangos
--HG--
branch : trunk
-rw-r--r-- | dep/include/g3dlite/G3D/Table.h | 2 | ||||
-rw-r--r-- | dep/include/utf8cpp/utf8/checked.h | 6 | ||||
-rw-r--r-- | src/game/AchievementMgr.cpp | 5 | ||||
-rw-r--r-- | src/game/AchievementMgr.h | 2 | ||||
-rw-r--r-- | src/game/BattleGroundAB.h | 2 | ||||
-rw-r--r-- | src/game/BattleGroundEY.cpp | 2 | ||||
-rw-r--r-- | src/game/BattleGroundEY.h | 17 | ||||
-rw-r--r-- | src/game/BattleGroundHandler.cpp | 3 | ||||
-rw-r--r-- | src/game/BattleGroundMgr.cpp | 18 | ||||
-rw-r--r-- | src/game/BattleGroundMgr.h | 14 | ||||
-rw-r--r-- | src/game/BattleGroundSA.cpp | 2 | ||||
-rw-r--r-- | src/game/Channel.cpp | 2 | ||||
-rw-r--r-- | src/game/Chat.cpp | 10 | ||||
-rw-r--r-- | src/game/ChatHandler.cpp | 6 | ||||
-rw-r--r-- | src/game/ConfusedMovementGenerator.cpp | 3 | ||||
-rw-r--r-- | src/game/Creature.h | 2 | ||||
-rw-r--r-- | src/game/CreatureEventAI.cpp | 43 | ||||
-rw-r--r-- | src/game/Level0.cpp | 8 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 8 | ||||
-rw-r--r-- | src/game/PetHandler.cpp | 2 | ||||
-rw-r--r-- | src/game/Player.cpp | 57 | ||||
-rw-r--r-- | src/game/SocialMgr.cpp | 4 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 6 | ||||
-rw-r--r-- | src/game/WorldSession.cpp | 2 | ||||
-rw-r--r-- | src/game/WorldSession.h | 8 | ||||
-rw-r--r-- | src/game/WorldSocket.cpp | 6 |
26 files changed, 108 insertions, 132 deletions
diff --git a/dep/include/g3dlite/G3D/Table.h b/dep/include/g3dlite/G3D/Table.h index bf4dff38207..1d021daae2b 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 c88844023cb..86204eae3ea 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<uint8_t>((cp >> 12) | 0xe0); - *(result++) = static_cast<uint8_t>((cp >> 6) & 0x3f | 0x80); + *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80); *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); } else if (cp <= internal::CODE_POINT_MAX) { // four octets *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0); - *(result++) = static_cast<uint8_t>((cp >> 12)& 0x3f | 0x80); - *(result++) = static_cast<uint8_t>((cp >> 6) & 0x3f | 0x80); + *(result++) = static_cast<uint8_t>(((cp >> 12)& 0x3f) | 0x80); + *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80); *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); } else diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 887e5865623..87280461793 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 7c006e06b7b..b00dc6a107f 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 abe81df5ef8..1c4a6d3b738 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -284,7 +284,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 04ab25c30cc..7e6063a09d2 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -349,7 +349,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 c4ffb57fba3..a22d6ecc6db 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -247,23 +247,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 883ad974277..8464dc2e7e4 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -114,7 +114,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))) { @@ -347,7 +347,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 e5e134b6478..f0f801c3060 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -490,8 +490,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(); @@ -521,8 +521,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 @@ -558,8 +558,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()); } } @@ -739,8 +739,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; @@ -1438,7 +1436,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 @@ -1767,7 +1765,7 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution() } 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 889b8b6f4fe..d9cc9deae13 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -160,11 +160,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); @@ -196,7 +196,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); @@ -253,7 +253,7 @@ class BattleGroundMgr BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; std::set<uint32> 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 5e6b02edfce..c52635a04c7 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 5524f30b143..588eb15f0cc 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -171,7 +171,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 789936302fc..c2293fb8848 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -785,7 +785,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); @@ -1030,23 +1030,23 @@ int ChatHandler::ParseCommands(const char* text) std::string fullcmd = text; /// 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; // original `text` can't be used. It content destroyed in command code processing. /// 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; if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index 333f2290816..142de50b059 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -71,7 +71,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) bool foundAura = false; for(Unit::AuraEffectList::const_iterator i = langAuras.begin();i != langAuras.end(); ++i) { - if((*i)->GetMiscValue() == lang) + if((*i)->GetMiscValue() == int32(lang)) { foundAura = true; break; @@ -209,7 +209,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<<to; @@ -355,7 +355,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) // if player is in battleground, he cannot say to battleground members by /ra Group *group = GetPlayer()->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; diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp index 06871ecdfa4..bbb0b9ebc6a 100644 --- a/src/game/ConfusedMovementGenerator.cpp +++ b/src/game/ConfusedMovementGenerator.cpp @@ -56,11 +56,12 @@ ConfusedMovementGenerator<T>::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 4381a317b0d..2dfc0d8a0cf 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -344,9 +344,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/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 4eebbcd3fc8..5ce6e4855a7 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -67,7 +67,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()); @@ -108,34 +108,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) @@ -522,13 +498,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; @@ -537,13 +512,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 51fd0c523d2..c4f6935bced 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -56,8 +56,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; } @@ -137,7 +137,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); @@ -160,7 +160,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) HashMapHolder<Player>::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/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index a23b900e239..18242265fcb 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -510,7 +510,7 @@ void ObjectMgr::LoadPointOfInterestLocales() struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader> { template<class D> - 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)); } @@ -1575,7 +1575,7 @@ void ObjectMgr::LoadItemLocales() struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader> { template<class D> - 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)); } @@ -4331,7 +4331,7 @@ void ObjectMgr::LoadPageTextLocales() struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader> { template<class D> - 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)); } @@ -5695,7 +5695,7 @@ void ObjectMgr::LoadGameObjectLocales() struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader> { template<class D> - 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 52af6b5a15e..79cb16e0637 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -287,6 +287,8 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid 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 c6355840cdc..af21cf9e562 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -10293,22 +10293,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() ); @@ -10322,7 +10322,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 ); @@ -10330,20 +10330,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); @@ -10353,19 +10349,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 ); @@ -10377,6 +10373,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); @@ -10388,14 +10385,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; } @@ -14089,7 +14084,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); @@ -14203,7 +14198,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); @@ -19288,7 +19283,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 119b968a45a..1fc3f83ab1b 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -196,7 +196,7 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri return; 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; @@ -267,7 +267,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 430010af77d..a34ab4d8b1e 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3049,18 +3049,16 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real) case FORM_BEAR: case FORM_DIREBEAR: case FORM_CAT: - { if(AuraEffect* dummy = m_target->GetDummyAura(37315) ) m_target->CastSpell(m_target,37316,true,NULL,dummy); break; - } // Nordrassil Regalia - bonus case FORM_MOONKIN: - { if(AuraEffect* 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 a5cc9f1e2fc..780c02eddca 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -42,7 +42,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 c4126ce51b9..d514586957a 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -100,7 +100,7 @@ class TRINITY_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; } @@ -122,11 +122,11 @@ class TRINITY_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; } @@ -705,7 +705,7 @@ class TRINITY_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 8fe46aa0456..c9c36f7651d 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -944,7 +944,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); @@ -995,8 +995,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 (); |