make EntityAdmin::hasAll const
This commit is contained in:
@@ -28,7 +28,7 @@ public:
|
|||||||
void forEach(Func&& f) const;
|
void forEach(Func&& f) const;
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
bool hasAll(entt::entity entity);
|
bool hasAll(entt::entity entity) const;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T& get(entt::entity entity);
|
T& get(entt::entity entity);
|
||||||
@@ -101,7 +101,7 @@ void EntityAdmin::forEach(Func&& f) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
bool EntityAdmin::hasAll(entt::entity entity)
|
bool EntityAdmin::hasAll(entt::entity entity) const
|
||||||
{
|
{
|
||||||
return m_registry.all_of<Ts...>(entity);
|
return m_registry.all_of<Ts...>(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ std::optional<QRectF> getBuildingWidgetRect(const FactoryState& state,
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QRectF> getActorWidgetRect(EntityAdmin& admin,
|
std::optional<QRectF> getActorWidgetRect(const EntityAdmin& admin,
|
||||||
const WorldCoordinates& coordinates,
|
const WorldCoordinates& coordinates,
|
||||||
entt::entity actor)
|
entt::entity actor)
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ std::optional<QRectF> getActorWidgetRect(EntityAdmin& admin,
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QRectF> getDebrisWidgetRect(EntityAdmin& admin,
|
std::optional<QRectF> getDebrisWidgetRect(const EntityAdmin& admin,
|
||||||
const WorldCoordinates& coordinates,
|
const WorldCoordinates& coordinates,
|
||||||
entt::entity debris)
|
entt::entity debris)
|
||||||
{
|
{
|
||||||
@@ -82,7 +82,7 @@ std::optional<QRectF> getDebrisWidgetRect(EntityAdmin& admin,
|
|||||||
return QRectF(center.x() - radius, center.y() - radius, 2.0 * radius, 2.0 * radius);
|
return QRectF(center.x() - radius, center.y() - radius, 2.0 * radius, 2.0 * radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect getSelectionWidgetRect(Simulation& sim, const WorldCoordinates& coordinates,
|
QRect getSelectionWidgetRect(const Simulation& sim, const WorldCoordinates& coordinates,
|
||||||
const std::vector<BuildingId>& buildings,
|
const std::vector<BuildingId>& buildings,
|
||||||
const std::vector<entt::entity>& actors,
|
const std::vector<entt::entity>& actors,
|
||||||
const std::vector<entt::entity>& debris)
|
const std::vector<entt::entity>& debris)
|
||||||
|
|||||||
@@ -29,22 +29,20 @@ std::optional<QRectF> getBuildingWidgetRect(const FactoryState& state,
|
|||||||
BuildingId id);
|
BuildingId id);
|
||||||
|
|
||||||
// The body of a ship or of a defence station (REQ-UI-ENTITY-CLICK-SELECT): a station's
|
// The body of a ship or of a defence station (REQ-UI-ENTITY-CLICK-SELECT): a station's
|
||||||
// footprint, or the square the ship's triangle is drawn in. The admin is taken by
|
// footprint, or the square the ship's triangle is drawn in.
|
||||||
// non-const reference only because EntityAdmin::hasAll() is not const; nothing here
|
std::optional<QRectF> getActorWidgetRect(const EntityAdmin& admin,
|
||||||
// writes to it.
|
|
||||||
std::optional<QRectF> getActorWidgetRect(EntityAdmin& admin,
|
|
||||||
const WorldCoordinates& coordinates,
|
const WorldCoordinates& coordinates,
|
||||||
entt::entity actor);
|
entt::entity actor);
|
||||||
|
|
||||||
// The circle a piece of debris is drawn as (REQ-UI-DEBRIS-CLICK-SELECT).
|
// The circle a piece of debris is drawn as (REQ-UI-DEBRIS-CLICK-SELECT).
|
||||||
std::optional<QRectF> getDebrisWidgetRect(EntityAdmin& admin,
|
std::optional<QRectF> getDebrisWidgetRect(const EntityAdmin& admin,
|
||||||
const WorldCoordinates& coordinates,
|
const WorldCoordinates& coordinates,
|
||||||
entt::entity debris);
|
entt::entity debris);
|
||||||
|
|
||||||
// The rectangle covering a whole selection -- one object, or the bounding box of all of
|
// The rectangle covering a whole selection -- one object, or the bounding box of all of
|
||||||
// them (REQ-UI-SELECTION-PANEL). Objects that no longer resolve are skipped; the result
|
// them (REQ-UI-SELECTION-PANEL). Objects that no longer resolve are skipped; the result
|
||||||
// is null when none of them does.
|
// is null when none of them does.
|
||||||
QRect getSelectionWidgetRect(Simulation& sim, const WorldCoordinates& coordinates,
|
QRect getSelectionWidgetRect(const Simulation& sim, const WorldCoordinates& coordinates,
|
||||||
const std::vector<BuildingId>& buildings,
|
const std::vector<BuildingId>& buildings,
|
||||||
const std::vector<entt::entity>& actors,
|
const std::vector<entt::entity>& actors,
|
||||||
const std::vector<entt::entity>& debris);
|
const std::vector<entt::entity>& debris);
|
||||||
|
|||||||
Reference in New Issue
Block a user