diff --git a/src/game/Chat/ChatHandler.cpp b/src/game/Chat/ChatHandler.cpp index e822f73e75..7cfc7d8e21 100644 --- a/src/game/Chat/ChatHandler.cpp +++ b/src/game/Chat/ChatHandler.cpp @@ -372,14 +372,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data) PlayerbotMgr* mgr = GetPlayer()->GetPlayerbotMgr(); if (mgr && GetPlayer()->GetGuildId()) { - for (PlayerBotMap::const_iterator it = mgr->GetPlayerBotsBegin(); it != mgr->GetPlayerBotsEnd(); ++it) + mgr->ForEachPlayerbot([&](Player* bot) { - Player* const bot = it->second; if (bot->GetGuildId() == GetPlayer()->GetGuildId()) { bot->GetPlayerbotAI()->HandleCommand(type, msg, *GetPlayer(), lang); } - } + }); } sRandomPlayerbotMgr.HandleCommand(type, msg, *_player, "", GetPlayer()->GetTeam(), lang); diff --git a/src/game/Entities/Player.h b/src/game/Entities/Player.h index 94c9c35c9e..5c3097d921 100644 --- a/src/game/Entities/Player.h +++ b/src/game/Entities/Player.h @@ -2199,12 +2199,12 @@ class Player : public Unit void UpdateAI(const uint32 diff, bool minimal = false); void CreatePlayerbotAI(); void RemovePlayerbotAI(); - PlayerbotAI* GetPlayerbotAI() { return m_playerbotAI.get(); } + PlayerbotAI* GetPlayerbotAI() const { return m_playerbotAI.get(); } void CreatePlayerbotMgr(); void RemovePlayerbotMgr(); - PlayerbotMgr* GetPlayerbotMgr() { return m_playerbotMgr.get(); } + PlayerbotMgr* GetPlayerbotMgr() const { return m_playerbotMgr.get(); } void SetBotDeathTimer() { m_deathTimer = 0; } - bool isRealPlayer() { return m_session && (m_session->GetRemoteAddress() != "disconnected/bot"); } + bool isRealPlayer() const { return m_session && (m_session->GetRemoteAddress() != "disconnected/bot"); } #endif void SendLootError(ObjectGuid guid, LootError error) const;