mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +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
|
* @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
|
* 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 UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source);
|
||||||
void LogEncounterFinished(EncounterCreditType type, uint32 creditEntry);
|
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);
|
GridMap* GetGrid(float x, float y);
|
||||||
void EnsureGridCreated(const GridCoord&);
|
void EnsureGridCreated(const GridCoord&);
|
||||||
[[nodiscard]] bool AllTransportsEmpty() const; // pussywizard
|
[[nodiscard]] bool AllTransportsEmpty() const; // pussywizard
|
||||||
|
|||||||
Reference in New Issue
Block a user