Pyrogenesis  trunk
Classes | Functions
EntitySelection Namespace Reference

Classes

struct  DefaultComponentFilter
 Finds all entities with a given component belonging to any given player. More...
 

Functions

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. More...
 
std::vector< entity_id_tPickEntitiesInRect (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 player. More...
 
std::vector< entity_id_tPickNonGaiaEntitiesInRect (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 player (excluding Gaia). More...
 
template<typename Filter = DefaultComponentFilter>
std::vector< entity_id_tGetEntitiesWithComponentInRect (CSimulation2 &simulation, int cid, const CCamera &camera, int sx0, int sy0, int sx1, int sy1)
 
std::vector< entity_id_tPickSimilarEntities (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. More...
 

Function Documentation

◆ GetEntitiesWithComponentInRect()

template<typename Filter = DefaultComponentFilter>
std::vector<entity_id_t> EntitySelection::GetEntitiesWithComponentInRect ( CSimulation2 simulation,
int  cid,
const CCamera camera,
int  sx0,
int  sy0,
int  sx1,
int  sy1 
)

◆ PickEntitiesInRect()

std::vector< entity_id_t > EntitySelection::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 player.

Used for bandboxing.

Parameters
camerause this view to convert screen to world coordinates.
sx0,sy0,sx1,sy1diagonally opposite corners of the rectangle in 2D screen coordinates.
ownerplayer whose entities we are selecting. Ownership is ignored if INVALID_PLAYER is used.
allowEditorSelectablesif true, all entities with the ICmpSelectable interface will be selected (including decorative actors), else only those selectable ingame.
Returns
unordered list of selected entities.

◆ PickEntityAtPoint()

entity_id_t EntitySelection::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.

Parameters
camerause this view to convert screen to world coordinates.
screenX,screenY2D screen coordinates.
playerplayer whose LOS will be used when selecting entities. In Atlas this value is ignored as the whole map is revealed.
allowEditorSelectablesif true, all entities with the ICmpSelectable interface will be selected (including decorative actors), else only those selectable ingame.
rangeApproximate range to check for entity in.
Returns
ordered list of selected entities with the closest first.

◆ PickNonGaiaEntitiesInRect()

std::vector< entity_id_t > EntitySelection::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 player (excluding Gaia).

Used for status bars.

◆ PickSimilarEntities()

std::vector< entity_id_t > EntitySelection::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.

Parameters
camerause this view to convert screen to world coordinates.
templateNamethe name of the template to match, or the selection group name for similar matching.
ownerplayer whose entities we are selecting. Ownership is ignored if INVALID_PLAYER is used.
includeOffScreenif true, then all entities visible in the world will be selected, else only entities visible to the camera will be selected.
matchRankif true, only entities that exactly match templateName will be selected, else entities with matching SelectionGroupName will be selected.
allowEditorSelectablesif true, all entities with the ICmpSelectable interface will be selected (including decorative actors), else only those selectable in-game.
allowFoundationsif true, foundations are also included in the results. Only takes effect when matchRank = true.
Returns
unordered list of selected entities.
See also
ICmpIdentity