18#ifndef INCLUDED_SELECTION
19#define INCLUDED_SELECTION
83template<
typename Filter = DefaultComponentFilter>
86 PROFILE2(
"GetEntitiesWithObstructionInRect");
94 std::vector<entity_id_t> hitEnts;
98 for (
const std::pair<const entity_id_t, IComponent*>& item : entities)
100 if (!filter(item.second))
102 if (
CheckEntityInRect(item.second->GetEntityHandle(), camera, sx0, sy0, sx1, sy1,
false))
103 hitEnts.push_back(item.first);
130 player_id_t owner,
bool includeOffScreen,
bool matchRank,
bool allowEditorSelectables,
bool allowFoundations);
int32_t player_id_t
valid player IDs are non-negative (see ICmpOwnership)
Definition: Player.h:24
New profiler (complementing the older CProfileManager)
#define PROFILE2(region)
Starts timing from now until the end of the current scope.
Definition: Profiler2.h:536
bool CheckEntityInRect(CEntityHandle handle, const CCamera &camera, int sx0, int sy0, int sx1, int sy1, bool allowEditorSelectables)
Returns true if the given entity is visible in the given screen area.
Definition: Selection.cpp:96
Object wrapping an entity_id_t, with a SEntityComponentCache to support fast QueryInterface() / CmpPt...
Definition: Entity.h:80
Public API for simulation system.
Definition: Simulation2.h:47
std::unordered_map< entity_id_t, IComponent * > InterfaceListUnordered
Definition: Simulation2.h:212
const InterfaceListUnordered & GetEntitiesWithInterfaceUnordered(int iid)
Returns a list of components implementing the given interface, and their associated entities,...
Definition: Simulation2.cpp:715
Definition: IComponent.h:33
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning.
Definition: code_annotation.h:40
Definition: Selection.h:35
std::vector< entity_id_t > GetEntitiesWithComponentInRect(CSimulation2 &simulation, int cid, const CCamera &camera, int sx0, int sy0, int sx1, int sy1)
Definition: Selection.h:84
entity_id_t PickEntityAtPoint(CSimulation2 &simulation, const CCamera &camera, int screenX, int screenY, player_id_t player, bool allowEditorSelectables)
Finds all selectable entities under the given screen coordinates.
Definition: Selection.cpp:36
std::vector< entity_id_t > PickEntitiesInRect(CSimulation2 &simulation, const CCamera &camera, int sx0, int sy0, int sx1, int sy1, player_id_t owner, bool allowEditorSelectables)
Finds all selectable entities within the given screen coordinate rectangle, belonging to the given pl...
Definition: Selection.cpp:137
std::vector< entity_id_t > PickNonGaiaEntitiesInRect(CSimulation2 &simulation, const CCamera &camera, int sx0, int sy0, int sx1, int sy1, bool allowEditorSelectables)
Finds all selectable entities within the given screen coordinate rectangle, belonging to any given pl...
Definition: Selection.cpp:174
std::vector< entity_id_t > PickSimilarEntities(CSimulation2 &simulation, const CCamera &camera, const std::string &templateName, player_id_t owner, bool includeOffScreen, bool matchRank, bool allowEditorSelectables, bool allowFoundations)
Finds all entities with the given entity template name, belonging to the given player.
Definition: Selection.cpp:197
Filter
Definition: Sampler.h:36
u32 entity_id_t
Entity ID type.
Definition: Entity.h:29
Finds all entities with a given component belonging to any given player.
Definition: Selection.h:77
bool operator()(IComponent *cmp)
Definition: Selection.h:78