载入中...
搜索中...
未找到
eve::sensing::SensingWorld类 参考

Gameplay-facing 2D candidate query service; it never values or selects targets. 更多...

#include <Sensing.h>

Public 成员函数

eve::Result< void > upsert (std::string_view id, float x, float y, std::string_view faction, std::string_view tagsCsv, std::string_view visibleToCsv)
 Inserts or replaces mirrored facts. CSV fields contain comma-separated stable keys.
 
eve::Result< void > remove (std::string_view id)
 Removes mirrored facts, or returns NotFound when the id is absent.
 
eve::Result< void > setZones (std::string_view id, std::string_view zonesCsv)
 Replaces logical zone membership for an existing subject.
 
eve::Result< void > setSpatialIndexEnabled (bool enabled, float cellSize=64.f)
 Enables or disables an optional SpatialHash2D broadphase (off by default).
 
bool spatialIndexEnabled () const noexcept
 Reports whether the optional spatial broadphase is active.
 
eve::Result< CandidateQueryResult > query (const QueryOrigin &origin, const QuerySpec &spec)
 Runs a configurable candidate query.
 
eve::Result< int > circle (float x, float y, float radius, std::string_view requireTagsCsv, std::string_view excludeTagsCsv, std::string_view includeFactionsCsv, std::string_view excludeFactionsCsv, std::string_view visibleTo, int limit)
 Queries a circle. Filters are CSV; empty fields disable that filter.
 
eve::Result< int > box (float minX, float minY, float maxX, float maxY, std::string_view requireTagsCsv, std::string_view excludeTagsCsv, std::string_view includeFactionsCsv, std::string_view excludeFactionsCsv, std::string_view visibleTo, int limit)
 Queries an axis-aligned box with the same filters as circle().
 
eve::Result< int > executePreset (std::string_view presetId, float originX, float originY, float dirX, float dirY)
 Runs a registered TargetingPreset against this world and refreshes resultAt().
 
eve::OptionalRef< const Candidate > resultAt (int index) const
 Returns a candidate from the most recent query, or null for an invalid index.
 
std::string debugLastQueryJson () const
 Deterministic JSON dump of the last successful query for MCP/debug overlays.
 
std::string snapshotJson () const
 Exports deterministic JSON.
 
eve::Result< void > restoreJson (const std::string &json)
 Restores a snapshot transactionally.
 
const std::map< std::string, Subject > & subjects () const noexcept
 Returns a borrowed view of stored subjects for adapters; valid until mutation.
 
 SensingWorld ()=default
 
 ~SensingWorld ()=default
 Sensing world.
 
 SensingWorld (const SensingWorld &)=delete
 
SensingWorld & operator= (const SensingWorld &)=delete
 
 SensingWorld (SensingWorld &&) noexcept=default
 Sensing world.
 
SensingWorld & operator= (SensingWorld &&) noexcept=default
 Operator =.
 

详细描述

Gameplay-facing 2D candidate query service; it never values or selects targets.

在文件 Sensing.h 第 151 行定义.

构造及析构函数说明

◆ SensingWorld() [1/3]

eve::sensing::SensingWorld::SensingWorld ( )
default

◆ ~SensingWorld()

eve::sensing::SensingWorld::~SensingWorld ( )
default

Sensing world.

◆ SensingWorld() [2/3]

eve::sensing::SensingWorld::SensingWorld ( const SensingWorld &  )
delete

◆ SensingWorld() [3/3]

eve::sensing::SensingWorld::SensingWorld ( SensingWorld &&  )
defaultnoexcept

Sensing world.

成员函数说明

◆ box()

eve::Result< int > eve::sensing::SensingWorld::box ( float  minX,
float  minY,
float  maxX,
float  maxY,
std::string_view  requireTagsCsv,
std::string_view  excludeTagsCsv,
std::string_view  includeFactionsCsv,
std::string_view  excludeFactionsCsv,
std::string_view  visibleTo,
int  limit 
)

Queries an axis-aligned box with the same filters as circle().

在文件 Sensing.cpp 第 495 行定义.

引用了 a, b, c, d, eve::Result< T >::failure(), limit, query(), r, size, eve::Result< T >::success() , 以及 v.

◆ circle()

eve::Result< int > eve::sensing::SensingWorld::circle ( float  x,
float  y,
float  radius,
std::string_view  requireTagsCsv,
std::string_view  excludeTagsCsv,
std::string_view  includeFactionsCsv,
std::string_view  excludeFactionsCsv,
std::string_view  visibleTo,
int  limit 
)

Queries a circle. Filters are CSV; empty fields disable that filter.

在文件 Sensing.cpp 第 486 行定义.

引用了 eve::Result< T >::failure(), limit, query(), r, radius, size, eve::Result< T >::success(), v, x , 以及 y.

◆ debugLastQueryJson()

std::string eve::sensing::SensingWorld::debugLastQueryJson ( ) const

Deterministic JSON dump of the last successful query for MCP/debug overlays.

返回
Schema eve.sensing.lastQuery with origin, shape, spatial stats, and ranked scores.
备注
Empty ranked list when no query has succeeded yet. Does not assign primary.

在文件 Sensing.cpp 第 526 行定义.

引用了 first , 以及 quote.

◆ executePreset()

eve::Result< int > eve::sensing::SensingWorld::executePreset ( std::string_view  presetId,
float  originX,
float  originY,
float  dirX,
float  dirY 
)

Runs a registered TargetingPreset against this world and refreshes resultAt().

参数
presetIdStable preset id (e.g. "sensing.builtin.coneSelect").
originXOrigin X used as QueryOrigin and cone apex.
originYOrigin Y used as QueryOrigin and cone apex.
dirXForward X for cone filter tasks (normalized on use).
dirYForward Y for cone filter tasks (normalized on use).
返回
Number of ranked candidates, or a structured failure. @thread Call on the sensing world's owning simulation thread.

在文件 Sensing.cpp 第 506 行定义.

引用了 context, count, eve::sensing::TargetingPipeline::executePreset(), eve::Result< T >::failure(), eve::sensing::TargetingPipeline::sharedBuiltins(), eve::Result< T >::success() , 以及 eve::sensing::TargetingSourceContext::world.

◆ operator=() [1/2]

SensingWorld & eve::sensing::SensingWorld::operator= ( const SensingWorld &  )
delete

◆ operator=() [2/2]

SensingWorld & eve::sensing::SensingWorld::operator= ( SensingWorld &&  )
defaultnoexcept

Operator =.

◆ query()

◆ remove()

eve::Result< void > eve::sensing::SensingWorld::remove ( std::string_view  id)

Removes mirrored facts, or returns NotFound when the id is absent.

在文件 Sensing.cpp 第 251 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), key, eve::NotFound, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 eve::rts::CombatFireSystem::step().

◆ restoreJson()

eve::Result< void > eve::sensing::SensingWorld::restoreJson ( const std::string &  json)

◆ resultAt()

eve::OptionalRef< const Candidate > eve::sensing::SensingWorld::resultAt ( int  index) const

Returns a candidate from the most recent query, or null for an invalid index.

返回
Borrowed nullable candidate owned by the query result cache. @ownership SensingWorld owns the candidate cache; callers must not delete or mutate it. @lifetime Valid until the next query/circle/box, restore, or world destruction; copy it for later use. @thread Call on the sensing world's owning simulation thread. @reentrancy Do not retain across a callback or another query.

在文件 Sensing.cpp 第 522 行定义.

◆ setSpatialIndexEnabled()

eve::Result< void > eve::sensing::SensingWorld::setSpatialIndexEnabled ( bool  enabled,
float  cellSize = 64.f 
)

Enables or disables an optional SpatialHash2D broadphase (off by default).

参数
enabledWhen true, rebuilds the index from current subjects.
cellSizeUniform grid cell size; must be finite and > 0 when enabling.
返回
Applied on success, or InvalidArgument when cellSize is invalid.
备注
Filtering/sorting remain QuerySpec-owned; the hash only culls candidates. @thread Call on the sensing world's owning simulation thread.

在文件 Sensing.cpp 第 282 行定义.

引用了 eve::Applied, enabled, eve::Diagnostic::error(), eve::Result< T >::failure(), finite, eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setZones()

eve::Result< void > eve::sensing::SensingWorld::setZones ( std::string_view  id,
std::string_view  zonesCsv 
)

Replaces logical zone membership for an existing subject.

参数
idSubject id that must already be registered.
zonesCsvComma-separated LogicalId texts (e.g. "arena:central"); empty clears membership.
返回
Applied on success, NotFound when absent, or InvalidArgument for empty/invalid zone ids. @thread Call on the sensing world's owning simulation thread.

在文件 Sensing.cpp 第 261 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, key, eve::NotFound, eve::LogicalId::parse(), eve::Status::success() , 以及 eve::Result< T >::success().

◆ snapshotJson()

std::string eve::sensing::SensingWorld::snapshotJson ( ) const

Exports deterministic JSON.

在文件 Sensing.cpp 第 549 行定义.

引用了 first, quote , 以及 s.

◆ spatialIndexEnabled()

bool eve::sensing::SensingWorld::spatialIndexEnabled ( ) const
noexcept

Reports whether the optional spatial broadphase is active.

在文件 Sensing.cpp 第 298 行定义.

◆ subjects()

const std::map< std::string, Subject > & eve::sensing::SensingWorld::subjects ( ) const
inlinenoexcept

Returns a borrowed view of stored subjects for adapters; valid until mutation.

在文件 Sensing.h 第 228 行定义.

被这些函数引用 eve::sensing::SensingWorldCandidateProvider::query().

◆ upsert()

eve::Result< void > eve::sensing::SensingWorld::upsert ( std::string_view  id,
float  x,
float  y,
std::string_view  faction,
std::string_view  tagsCsv,
std::string_view  visibleToCsv 
)

Inserts or replaces mirrored facts. CSV fields contain comma-separated stable keys.

在文件 Sensing.cpp 第 238 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), f, eve::Result< T >::failure(), finite, eve::InvalidArgument, subject, eve::Status::success(), eve::Result< T >::success(), t, v, x , 以及 y.

被这些函数引用 eve::rts::CombatFireSystem::step().


该类的文档由以下文件生成: