Add GetGaiaAndNonGaiaEntities helper function in the RangeManager and use it in Extinct Volcano (D229).
Differential Revision: https://code.wildfiregames.com/D477 Reviewed By: bb Proposed By: bb Discussed with: fatherbushido This was SVN commit r20691.
This commit is contained in:
parent
9106e66d98
commit
fb444d4165
@ -128,7 +128,7 @@ Trigger.prototype.RaiseWaterLevelStep = function()
|
||||
let cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
|
||||
let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|
||||
|
||||
for (let ent of [...cmpRangeManager.GetEntitiesByPlayer(0), ...cmpRangeManager.GetNonGaiaEntities()])
|
||||
for (let ent of cmpRangeManager.GetGaiaAndNonGaiaEntities())
|
||||
{
|
||||
let cmpPosition = Engine.QueryInterface(ent, IID_Position);
|
||||
if (!cmpPosition || !cmpPosition.IsInWorld())
|
||||
|
@ -1053,6 +1053,11 @@ public:
|
||||
return GetEntitiesByMask(~3); // bit 0 for owner=-1 and bit 1 for gaia
|
||||
}
|
||||
|
||||
virtual std::vector<entity_id_t> GetGaiaAndNonGaiaEntities() const
|
||||
{
|
||||
return GetEntitiesByMask(~1); // bit 0 for owner=-1
|
||||
}
|
||||
|
||||
std::vector<entity_id_t> GetEntitiesByMask(u32 ownerMask) const
|
||||
{
|
||||
std::vector<entity_id_t> entities;
|
||||
|
@ -47,6 +47,7 @@ DEFINE_INTERFACE_METHOD_3("SetEntityFlag", void, ICmpRangeManager, SetEntityFlag
|
||||
DEFINE_INTERFACE_METHOD_CONST_1("GetEntityFlagMask", u8, ICmpRangeManager, GetEntityFlagMask, std::string)
|
||||
DEFINE_INTERFACE_METHOD_CONST_1("GetEntitiesByPlayer", std::vector<entity_id_t>, ICmpRangeManager, GetEntitiesByPlayer, player_id_t)
|
||||
DEFINE_INTERFACE_METHOD_CONST_0("GetNonGaiaEntities", std::vector<entity_id_t>, ICmpRangeManager, GetNonGaiaEntities)
|
||||
DEFINE_INTERFACE_METHOD_CONST_0("GetGaiaAndNonGaiaEntities", std::vector<entity_id_t>, ICmpRangeManager, GetGaiaAndNonGaiaEntities)
|
||||
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpRangeManager, SetDebugOverlay, bool)
|
||||
DEFINE_INTERFACE_METHOD_1("ExploreAllTiles", void, ICmpRangeManager, ExploreAllTiles, player_id_t)
|
||||
DEFINE_INTERFACE_METHOD_0("ExploreTerritories", void, ICmpRangeManager, ExploreTerritories)
|
||||
|
@ -198,6 +198,11 @@ public:
|
||||
*/
|
||||
virtual std::vector<entity_id_t> GetNonGaiaEntities() const = 0;
|
||||
|
||||
/**
|
||||
* Returns a list of all entities owned by a player or gaia.
|
||||
*/
|
||||
virtual std::vector<entity_id_t> GetGaiaAndNonGaiaEntities() const = 0;
|
||||
|
||||
/**
|
||||
* Toggle the rendering of debug info.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user