18#ifndef INCLUDED_SELECTION
19#define INCLUDED_SELECTION
84template<
typename Filter = DefaultComponentFilter>
87 PROFILE2(
"GetEntitiesWithObstructionInRect");
95 std::vector<entity_id_t> hitEnts;
99 for (
const std::pair<const entity_id_t, IComponent*>& item : entities)
101 if (!filter(item.second))
103 if (
CheckEntityInRect(item.second->GetEntityHandle(), camera, sx0, sy0, sx1, sy1,
false))
104 hitEnts.push_back(item.first);
131 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:26
New profiler (complementing the older CProfileManager)
#define PROFILE2(region)
Starts timing from now until the end of the current scope.
Definition: Profiler2.h:452
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:101
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:57
std::unordered_map< entity_id_t, IComponent * > InterfaceListUnordered
Definition: Simulation2.h:219
const InterfaceListUnordered & GetEntitiesWithInterfaceUnordered(int iid)
Returns a list of components implementing the given interface, and their associated entities,...
Definition: Simulation2.cpp:724
Definition: IComponent.h:33
Definition: Selection.h:36
std::vector< entity_id_t > GetEntitiesWithComponentInRect(CSimulation2 &simulation, int cid, const CCamera &camera, int sx0, int sy0, int sx1, int sy1)
Definition: Selection.h:85
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:42
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:141
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:178
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:201
Filter
Definition: Sampler.h:33
std::uint32_t 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:78
bool operator()(IComponent *)
Definition: Selection.h:79