载入中...
搜索中...
未找到
Targeting.h
浏览该文件的文档.
45[[nodiscard]] EVENGINE_API_PLATFORM std::string_view coordinateSpaceName(CoordinateSpace space) noexcept;
230 [[nodiscard]] static Result<WorldArea> cone2D(WorldPoint apex, float dirX, float dirY, float halfAngleRadians,
249 WorldArea(Shape shape, WorldPoint first, WorldPoint second, float radius, float halfAngle = 0.f) noexcept
466 [[nodiscard]] virtual Result<std::vector<TargetCandidate>> query(const TargetingQuery& query) const = 0;
492 [[nodiscard]] Result<std::vector<TargetCandidate>> query(const TargetingQuery& query) const override;
505 std::function<Result<TargetDomain>(std::string_view originFaction, std::string_view candidateFaction)>;
517class EVENGINE_API_PLATFORM SensingWorldCandidateProvider final : public ISensingCandidateProvider {
529 [[nodiscard]] Result<std::vector<TargetCandidate>> query(const TargetingQuery& query) const override;
Strong identity values shared by persistence, content and logical-name APIs.
Move-only, checked operation results for the common layer.
Stable reference to a runtime gameplay subject.
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:411
An integer grid area constraint, kept separate from WorldArea.
Definition Targeting.h:273
GridPoint minimum() const noexcept
Return the inclusive minimum grid corner.
Definition Targeting.h:292
GridPoint maximum() const noexcept
Return the inclusive maximum grid corner.
Definition Targeting.h:294
friend bool operator==(const GridPoint &, const GridPoint &) noexcept=default
bool isValid() const noexcept
Returns whether the point was constructed by a grid factory.
Definition Targeting.h:182
std::int32_t z() const noexcept
Returns the Z cell coordinate; it is zero for Grid2D.
Definition Targeting.h:180
static constexpr const char * capabilityName
Definition Targeting.h:433
virtual ~ILineOfSightQuery()=default
Releases ILineOfSightQuery resources.
virtual Result< LineOfSightResult > query(const TargetLocation &from, const TargetLocation &to) const =0
Tests the segment between two same-space locations.
Candidate discovery capability consumed by TargetingResolver.
Definition Targeting.h:454
static constexpr const char * capabilityName
Definition Targeting.h:456
virtual Result< std::vector< TargetCandidate > > query(const TargetingQuery &query) const =0
Returns broad-phase candidates satisfying the coordinate and spatial constraints.
virtual ~ISensingCandidateProvider()=default
Releases ISensingCandidateProvider resources.
Pure CPU sensing candidate provider with deterministic map-backed storage.
Definition Targeting.h:476
SensingCandidateProvider()=default
Creates an empty provider; registration with capability is explicit.
~SensingCandidateProvider() override=default
Sensing candidate provider.
std::size_t size() const noexcept
Returns the number of stored candidate facts.
Definition Targeting.h:488
ISensingCandidateProvider adapter over a SensingWorld fact mirror.
Definition Targeting.h:517
void setFactionRelation(FactionRelationFn relation)
Installs optional faction→domain projection used when domain != Any.
Definition Targeting.h:525
~SensingWorldCandidateProvider() override=default
Sensing world candidate provider.
SensingWorldCandidateProvider(SensingWorld &world) noexcept
Binds a non-owning SensingWorld; capability registration remains explicit.
Definition Targeting.h:520
Gameplay-facing 2D candidate query service; it never values or selects targets.
Definition Sensing.h:151
Owning target result containing primary-independent subjects and optional geometry.
Definition Targeting.h:384
std::span< const SubjectRef > subjects() const noexcept
Returns borrowed subjects, valid until this TargetSet is mutated or destroyed.
Definition Targeting.h:398
const std::optional< SubjectRef > & primary() const noexcept
Returns the explicitly assigned primary subject, if any.
Definition Targeting.h:400
const std::optional< GridArea > & gridArea() const noexcept
Returns the optional grid-area projection.
Definition Targeting.h:406
const std::optional< TargetLocation > & point() const noexcept
Returns the optional point projection.
Definition Targeting.h:402
const std::optional< WorldArea > & worldArea() const noexcept
Returns the optional world-area projection.
Definition Targeting.h:404
Generic constraint evaluator that composes candidate and LOS capabilities.
Definition Targeting.h:543
WorldPoint first() const noexcept
Return the center for circle/sphere, or minimum corner for boxes.
Definition Targeting.h:240
WorldPoint second() const noexcept
Return the maximum corner for boxes; invalid/default for circle and sphere.
Definition Targeting.h:242
Finite world-space point tagged as either World2D or World3D.
Definition Targeting.h:116
friend bool operator==(const WorldPoint &, const WorldPoint &) noexcept=default
float x() const noexcept
Returns the X coordinate in the tagged world space.
Definition Targeting.h:136
bool isValid() const noexcept
Returns whether the point was constructed with finite coordinates.
Definition Targeting.h:142
float y() const noexcept
Returns the Y coordinate in the tagged world space.
Definition Targeting.h:138
WorldPoint()=default
Constructs an invalid default point; use world2D/world3D for values.
friend bool operator==(const ZoneRef &, const ZoneRef &) noexcept=default
const LogicalId & logicalId() const noexcept
Returns the wrapped logical ID.
Definition Targeting.h:100
bool isValid() const noexcept
Returns whether the reference contains a valid logical ID.
Definition Targeting.h:97
Definition RTSSystems.h:257
std::variant< WorldPoint, GridPoint > TargetLocation
Either a world point or a grid point, with the tag retained.
Definition Targeting.h:198
CoordinateSpace
Coordinate spaces are not interchangeable, even when dimensions match.
Definition Targeting.h:37
std::string_view coordinateSpaceName(CoordinateSpace space) noexcept
Returns the stable protocol name for a coordinate space.
Definition Targeting.cpp:556
std::ostream & operator<<(std::ostream &stream, CoordinateSpace space)
Writes the stable coordinate-space protocol name.
Definition Targeting.h:48
@ Neutral
@ FailIfOutOfRange
Fail the query when the filtered set is outside [minCount, maxCount].
@ NotRequired
@ Required
std::function< Result< TargetDomain >(std::string_view originFaction, std::string_view candidateFaction)> FactionRelationFn
Projects faction string pairs into TargetDomain for SensingWorld adapters.
Definition Targeting.h:505
Definition Container.h:602
Result of one injected line-of-sight query.
Definition Targeting.h:417
std::optional< SubjectRef > blocker
Optional stable blocker identity when the provider can identify it.
Definition Targeting.h:421
std::vector< std::string > tags
Stable gameplay tags used by required/excluded tag queries.
Definition Targeting.h:376
TargetLocation location
Candidate location in one of the explicitly tagged spaces.
Definition Targeting.h:372
TargetDomain domain
Relationship class supplied by the sensing/domain adapter.
Definition Targeting.h:374
A query passed from a domain targeting algorithm to sensing.
Definition Targeting.h:350
Result< void > validate() const
Validates origin identity, location/spec space and spec constraints.
Definition Targeting.cpp:278
SubjectRef origin
Subject issuing the query; it is not implicitly selected as a result.
Definition Targeting.h:352
A checked target-count and spatial constraint description.
Definition Targeting.h:310
CountPolicy countPolicy
How overflow relative to maxCount is handled. FailIfOutOfRange preserves historical Action/resolver b...
Definition Targeting.h:324
LineOfSightMode lineOfSight
Whether an injected LOS provider must confirm each candidate.
Definition Targeting.h:340
Result< void > validate() const
Validates count, range, tags, zone and coordinate-space invariants.
Definition Targeting.cpp:240
std::vector< std::string > excludedTags
Tags that exclude a candidate when present.
Definition Targeting.h:332
float maxRange
Maximum distance, in world units or grid cells; positive infinity means unbounded.
Definition Targeting.h:328
float minRange
Minimum distance, in world units or grid cells according to space.
Definition Targeting.h:326
std::optional< ZoneRef > zone
Optional logical zone membership required from candidates.
Definition Targeting.h:334
std::vector< std::string > requiredTags
All tags that each candidate must contain.
Definition Targeting.h:330
CoordinateSpace space
Required coordinate space for origin, candidates and area.
Definition Targeting.h:312
std::optional< WorldArea > worldArea
Optional World2D/World3D area constraint.
Definition Targeting.h:336
std::uint32_t minCount
Minimum number of candidates required in the resolved set.
Definition Targeting.h:316