载入中...
搜索中...
未找到
Targeting.h
浏览该文件的文档.
37[[nodiscard]] EVENGINE_API_PLATFORM std::string_view coordinateSpaceName(CoordinateSpace space) noexcept;
222 [[nodiscard]] static Result<WorldArea> cone2D(WorldPoint apex, float dirX, float dirY, float halfAngleRadians,
248 WorldArea(Shape shape, WorldPoint first, WorldPoint second, float radius, float halfAngle = 0.f) noexcept
465 [[nodiscard]] virtual Result<std::vector<TargetCandidate>> query(const TargetingQuery& query) const = 0;
491 [[nodiscard]] Result<std::vector<TargetCandidate>> query(const TargetingQuery& query) const override;
504 std::function<Result<TargetDomain>(std::string_view originFaction, std::string_view candidateFaction)>;
516class EVENGINE_API_PLATFORM SensingWorldCandidateProvider final : public ISensingCandidateProvider {
528 [[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:414
An integer grid area constraint, kept separate from WorldArea.
Definition Targeting.h:272
GridPoint minimum() const noexcept
Return the inclusive minimum grid corner.
Definition Targeting.h:291
GridPoint maximum() const noexcept
Return the inclusive maximum grid corner.
Definition Targeting.h:293
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:174
std::int32_t z() const noexcept
Returns the Z cell coordinate; it is zero for Grid2D.
Definition Targeting.h:172
static constexpr const char * capabilityName
Definition Targeting.h:432
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:453
static constexpr const char * capabilityName
Definition Targeting.h:455
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:475
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:487
ISensingCandidateProvider adapter over a SensingWorld fact mirror.
Definition Targeting.h:516
void setFactionRelation(FactionRelationFn relation)
Installs optional faction→domain projection used when domain != Any.
Definition Targeting.h:524
~SensingWorldCandidateProvider() override=default
Sensing world candidate provider.
SensingWorldCandidateProvider(SensingWorld &world) noexcept
Binds a non-owning SensingWorld; capability registration remains explicit.
Definition Targeting.h:519
Mirrored world positions and query composition; consumers decide gameplay actions from results.
Definition Sensing.h:197
Owning target result containing primary-independent subjects and optional geometry.
Definition Targeting.h:383
std::span< const SubjectRef > subjects() const noexcept
Returns borrowed subjects, valid until this TargetSet is mutated or destroyed.
Definition Targeting.h:397
const std::optional< SubjectRef > & primary() const noexcept
Returns the explicitly assigned primary subject, if any.
Definition Targeting.h:399
const std::optional< GridArea > & gridArea() const noexcept
Returns the optional grid-area projection.
Definition Targeting.h:405
const std::optional< TargetLocation > & point() const noexcept
Returns the optional point projection.
Definition Targeting.h:401
const std::optional< WorldArea > & worldArea() const noexcept
Returns the optional world-area projection.
Definition Targeting.h:403
Generic constraint evaluator that composes candidate and LOS capabilities.
Definition Targeting.h:542
WorldPoint first() const noexcept
Return the center for circle/sphere, or minimum corner for boxes.
Definition Targeting.h:232
float halfAngle() const noexcept
Return the cone half-angle in radians; zero for every non-cone shape.
Definition Targeting.h:243
WorldPoint second() const noexcept
Return the maximum corner for boxes; invalid/default for circle and sphere.
Definition Targeting.h:234
Finite world-space point tagged as either World2D or World3D.
Definition Targeting.h:108
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:128
bool isValid() const noexcept
Returns whether the point was constructed with finite coordinates.
Definition Targeting.h:134
float y() const noexcept
Returns the Y coordinate in the tagged world space.
Definition Targeting.h:130
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:92
bool isValid() const noexcept
Returns whether the reference contains a valid logical ID.
Definition Targeting.h:89
Definition RTSSystems.h:258
std::variant< WorldPoint, GridPoint > TargetLocation
Either a world point or a grid point, with the tag retained.
Definition Targeting.h:190
CoordinateSpace
Coordinate spaces are not interchangeable, even when dimensions match.
Definition CoordinateSpace.h:5
std::string_view coordinateSpaceName(CoordinateSpace space) noexcept
Returns the stable protocol name for a coordinate space.
Definition Targeting.cpp:561
std::ostream & operator<<(std::ostream &stream, CoordinateSpace space)
Writes the stable coordinate-space protocol name.
Definition Targeting.h:40
@ 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:504
Definition Container.h:602
Result of one injected line-of-sight query.
Definition Targeting.h:416
std::optional< SubjectRef > blocker
Optional stable blocker identity when the provider can identify it.
Definition Targeting.h:420
std::vector< std::string > tags
Stable gameplay tags used by required/excluded tag queries.
Definition Targeting.h:375
TargetLocation location
Candidate location in one of the explicitly tagged spaces.
Definition Targeting.h:371
TargetDomain domain
Relationship class supplied by the sensing/domain adapter.
Definition Targeting.h:373
A query passed from a domain targeting algorithm to sensing.
Definition Targeting.h:349
SubjectRef origin
Subject issuing the query; it is not implicitly selected as a result.
Definition Targeting.h:351
A checked target-count and spatial constraint description.
Definition Targeting.h:309
CountPolicy countPolicy
How overflow relative to maxCount is handled. FailIfOutOfRange preserves historical Action/resolver b...
Definition Targeting.h:323
LineOfSightMode lineOfSight
Whether an injected LOS provider must confirm each candidate.
Definition Targeting.h:339
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:331
float maxRange
Maximum distance, in world units or grid cells; positive infinity means unbounded.
Definition Targeting.h:327
float minRange
Minimum distance, in world units or grid cells according to space.
Definition Targeting.h:325
std::optional< ZoneRef > zone
Optional logical zone membership required from candidates.
Definition Targeting.h:333
std::vector< std::string > requiredTags
All tags that each candidate must contain.
Definition Targeting.h:329
CoordinateSpace space
Required coordinate space for origin, candidates and area.
Definition Targeting.h:311
std::optional< WorldArea > worldArea
Optional World2D/World3D area constraint.
Definition Targeting.h:335
std::uint32_t minCount
Minimum number of candidates required in the resolved set.
Definition Targeting.h:315