mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 17:09:08 +00:00
Harden playerbot logout & packet dispatch; add null-safety in chat hooks and RPG checks (#1529)
This commit is contained in:
@@ -2373,7 +2373,7 @@ std::string PlayerbotAI::GetLocalizedGameObjectName(uint32 entry)
|
||||
return name;
|
||||
}
|
||||
|
||||
std::vector<Player*> PlayerbotAI::GetPlayersInGroup()
|
||||
/*std::vector<Player*> PlayerbotAI::GetPlayersInGroup()
|
||||
{
|
||||
std::vector<Player*> members;
|
||||
|
||||
@@ -2392,6 +2392,34 @@ std::vector<Player*> PlayerbotAI::GetPlayersInGroup()
|
||||
members.push_back(ref->GetSource());
|
||||
}
|
||||
|
||||
return members;
|
||||
}*/
|
||||
|
||||
std::vector<Player*> PlayerbotAI::GetPlayersInGroup()
|
||||
{
|
||||
std::vector<Player*> members;
|
||||
|
||||
Group* group = bot->GetGroup();
|
||||
if (!group)
|
||||
return members;
|
||||
|
||||
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
||||
{
|
||||
Player* member = ref->GetSource();
|
||||
if (!member)
|
||||
continue;
|
||||
|
||||
// Celaning, we don't call 2 times GET_PLAYERBOT_AI and never reference it if nil
|
||||
if (auto* ai = GET_PLAYERBOT_AI(member))
|
||||
{
|
||||
// If it's a bot (not real player) => we ignor it
|
||||
if (!ai->IsRealPlayer())
|
||||
continue;
|
||||
}
|
||||
|
||||
members.push_back(member);
|
||||
}
|
||||
|
||||
return members;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user