载入中...
搜索中...
未找到
RTSCrowdFlowNavigation.cpp
浏览该文件的文档.
28Result<CrowdFlowNavigation::InputChange> CrowdFlowNavigation::begin(crowd::Crowd& crowd, const SimulationStep& step) {
29 if (!enabled_) return failure<InputChange>(DiagnosticCode::PreconditionViolation, "Shared-flow policy is disabled");
54Result<crowd::FlowGoal> CrowdFlowNavigation::goalCell(crowd::Crowd& crowd, WorldPosition target) const {
60 return failure<crowd::FlowGoal>(DiagnosticCode::InvalidArgument, "Shared goal outside navigation surface");
82Result<void> CrowdFlowNavigation::request(crowd::Crowd& crowd, std::span<const WorldPosition> targets,
90Result<void> CrowdFlowNavigation::requestGoals(std::span<const crowd::FlowGoal> goals, SimulationTick tick) try {
91 auto found = std::lower_bound(jobs_.begin(), jobs_.end(), goals, [](const Job& job, const auto& key) {
94 if (found != jobs_.end() && std::equal(found->goals.begin(), found->goals.end(), goals.begin(), goals.end())) {
102 return failure<void>(DiagnosticCode::PreconditionViolation, "Shared-goal admission sequence exhausted");
127 if (state == crowd::Crowd::FlowBuildState::Pending || state == crowd::Crowd::FlowBuildState::Ready ||
212Result<CrowdFlowNavigation::DriveState> CrowdFlowNavigation::steer(crowd::Crowd& crowd, WorldPosition position,
227Result<CrowdFlowNavigation::DriveState> CrowdFlowNavigation::steerGoals(crowd::Crowd& crowd, WorldPosition position,
236 DiagnosticCode::InvalidArgument, "Exact destination must belong to the shared goal set", "target"));
237 auto found = std::lower_bound(jobs_.begin(), jobs_.end(), goals, [](const Job& job, const auto& key) {
238 return std::lexicographical_compare(job.goals.begin(), job.goals.end(), key.begin(), key.end());
242 if (found == jobs_.end() || !std::equal(found->goals.begin(), found->goals.end(), goals.begin(), goals.end()) ||
322 if (unit && unit->navigation()->unreachable && unit->navigation()->plannedOrderId == notice.order.id) {
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
FieldObservation getFieldStatus() const noexcept
Observe current field readiness and owner-local revision without rebuilding.
Definition Crowd.cpp:62
@ Unreachable
@ Cancelled
Result< FlowBuildPlan > prepareFlowBuild(int gx, int gy) const
Prepare owned navigation workstate for one goal without changing the live field.
Definition CrowdNavigation.cpp:31
Result< AgentBatchReceipt > updateAgents(const AgentUpdateBatch &batch)
Compatibility-only one-call facade over canonical prepareAgentUpdates/commitAgentUpdates....
Definition CrowdBatch.cpp:42
Result< FlowLease > acquireFlowField(std::span< const FlowGoal > goals)
Acquire an existing field for a canonical goal set without graph work.
Definition CrowdFlowCache.cpp:98
bool isAgentAlive(AgentRef reference) const noexcept
Whether the owner and generation still identify a live agent. @thread Simulation thread only; the cal...
Definition CrowdRegistry.cpp:124
Result< FlowSample > sampleFlowField(const FlowLease &lease, float x, float y) const
Sample a current lease; stale/foreign leases fail, unreachable locations return zero....
Definition CrowdFlowCache.cpp:164
Result< FlowBuildProgress > advanceFlowBuild(FlowBuildPlan &plan, int maxWork)
Spend at most maxWork heap-pop/direction-cell units on owned request state.
Definition CrowdNavigation.cpp:54
Owning immutable field lease; copies pin storage, never the Crowd provider. @thread Copy/release/quer...
Definition CrowdTypes.h:48
constexpr bool isZero() const noexcept
Returns whether this value is zero.
Definition StrongUint64.h:28
static Result< std::size_t > stepSharedFlow(const SimulationStep &step, crowd::Crowd &crowd, CrowdFlowNavigation &navigation)
Consume shared static-goal fields through a known owner-thread flow service.
Definition RTSCrowdMotion.cpp:21
Result< void > configureCrowdFlowNavigation(CrowdFlowNavigationSettings settings)
Enable shared-field steering for eligible linked movement and constrained formation slots.
Definition RTSCrowdFlowNavigation.cpp:281
CrowdFlowNavigationObservation getCrowdFlowNavigationStatus() const noexcept
Observe current work quotas/jobs without copying fields; owner thread only.
Definition RTSCrowdFlowNavigation.cpp:332
void clearCrowdFlowNavigation() noexcept
Disable shared-flow work and release jobs, retaining spending history; clear agent leases on next syn...
Definition RTSCrowdFlowNavigation.cpp:291
@ Unreachable
Definition RTS.cpp:30
@ InvalidArgument
@ PreconditionViolation
@ Failed
@ NotFound
@ NoOp
@ Applied
@ Rejected
Agent identity qualified by the Crowd instance that owns its registry. @ownership Value only; it neit...
Definition CrowdTypes.h:90
Caller-built atomic update batch; duplicate agent references are rejected.
Definition Crowd.h:173
Owned changes for one live agent. Absent fields keep their existing values.
Definition Crowd.h:161
Agent-owned selection of a provider-defined movement policy. Zero identity and revision mean compatib...
Definition CrowdTypes.h:27