mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
feat(Core/Map): add DoForAllPlayers method (#10371)
This commit is contained in:
@@ -3757,6 +3757,17 @@ void Map::SetZoneOverrideLight(uint32 zoneId, uint32 lightId, Milliseconds fadeI
|
||||
}
|
||||
}
|
||||
|
||||
void Map::DoForAllPlayers(std::function<void(Player*)> exec)
|
||||
{
|
||||
for (auto const& it : GetPlayers())
|
||||
{
|
||||
if (Player* player = it.GetSource())
|
||||
{
|
||||
exec(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if a given source can reach a specific point following a path
|
||||
* and normalize the coords. Use this method for long paths, otherwise use the
|
||||
|
||||
@@ -606,6 +606,9 @@ public:
|
||||
void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source);
|
||||
void LogEncounterFinished(EncounterCreditType type, uint32 creditEntry);
|
||||
|
||||
// Do whatever you want to all the players in map [including GameMasters], i.e.: param exec = [&](Player* p) { p->Whatever(); }
|
||||
void DoForAllPlayers(std::function<void(Player*)> exec);
|
||||
|
||||
GridMap* GetGrid(float x, float y);
|
||||
void EnsureGridCreated(const GridCoord&);
|
||||
[[nodiscard]] bool AllTransportsEmpty() const; // pussywizard
|
||||
|
||||
Reference in New Issue
Block a user