Skip to content

Commit

Permalink
Playerbots: bot iteration and cleanup (#552)
Browse files Browse the repository at this point in the history
Co-authored-by: Viger <viger28@gmail.com>
  • Loading branch information
Vigerus and Viger committed Apr 19, 2024
1 parent 9880d28 commit 1e4842e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/game/Chat/ChatHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/game/Entities/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1e4842e

Please sign in to comment.