载入中...
搜索中...
未找到
CrowdBatch.cpp
浏览该文件的文档.
11bool nonNegative(const std::optional<float>& value) { return !value || (std::isfinite(*value) && *value >= 0.f); }
13 if (update.movement && ((update.movement->movement.value() == 0) != (update.movement->revision == 0))) return false;
14 if (!nonNegative(update.maxSpeed) || !nonNegative(update.maxAcceleration) || !nonNegative(update.headingTurnRate) ||
29 if (value.action < AgentAction::Idle || value.action > AgentAction::Boids || !std::isfinite(value.targetX) ||
75 if (!isAgentAlive(reference)) return failed(DiagnosticCode::NotFound, "Stale or wrong-owner removal");
108Result<AgentBatchReceipt> Crowd::copyAgentStates(std::span<const AgentRef> references, AgentFrame& destination) const {
110 if (!isAgentAlive(reference)) return failed(DiagnosticCode::NotFound, "Stale or wrong-owner frame reference");
118 destination.agents[index] = {references[index], getAgentState(impl_->resolveAgent(references[index]))};
EVEngine assertion entry point, backed by zeroerr.
#define EV_ASSERT(cond,...)
Assert an internal engine invariant (state that must always hold).
Definition Assert.h:37
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
Result< AgentBatchReceipt > updateAgents(const AgentUpdateBatch &batch)
Compatibility-only one-call facade over canonical prepareAgentUpdates/commitAgentUpdates....
Definition CrowdBatch.cpp:42
Result< AgentUpdatePlan > prepareAgentUpdates(const AgentUpdateBatch &batch) const
Canonically validate and own a batch before a later nonallocating commit. @ownership Copies values; r...
Definition CrowdUpdatePlan.cpp:13
Result< AgentBatchReceipt > commitAgentUpdates(AgentUpdatePlan &&plan, std::span< const std::uint8_t > selection)
Validate all identities then apply selected prepared updates without allocating success-path workspac...
Definition CrowdUpdatePlan.cpp:43
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< AgentBatchReceipt > removeAgents(const AgentRemovalBatch &batch)
Atomically remove live references; every reference is checked before any removal. @ownership Borrows ...
Definition CrowdBatch.cpp:70
Result< AgentBatchReceipt > copyAgentFrame(AgentFrame &destination) const
Copy one owning frame into reusable caller storage; allocation failure preserves the output....
Definition CrowdBatch.cpp:90
Result< AgentBatchReceipt > copyAgentStates(std::span< const AgentRef > references, AgentFrame &destination) const
Copy a selected owning frame in request order; stale input preserves the destination....
Definition CrowdBatch.cpp:108
Definition Crowd.cpp:14
RuntimeHandle< CrowdAgentTag > AgentHandle
Generation-qualified runtime agent identity; never persist its packed representation.
Definition CrowdTypes.h:82
bool validAgentUpdate(const AgentUpdate &update)
Definition CrowdBatch.cpp:41
bool validInteraction(InteractionPolicy policy)
Check finite mobility and nonnegative filter masks without modifying state.
Definition CrowdInteraction.cpp:12
InteractionPolicy canonicalInteraction(AgentInteraction policy)
Normalize a compatibility filter into the canonical two-filter policy.
Definition CrowdInteraction.cpp:8
Result< T > failed(Status status, eve::DiagnosticCode code, RuleId rule, std::string message)
Construct a failed editing result with explicit status and diagnostic categories.
Definition EditingResult.h:103
@ NotFound
@ Failed
@ Conflict
Caller-owned frame storage; no pointers into Crowd are retained.
Definition Crowd.h:200
Owned identities to remove atomically; duplicate and stale references are rejected.
Definition Crowd.h:177
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
std::optional< int > avoidancePriority
Definition Crowd.h:166
std::optional< AgentInteraction > interaction
Definition Crowd.h:167
std::optional< float > headingTurnRate
Definition Crowd.h:165
std::optional< float > maxAcceleration
Definition Crowd.h:165
void applyAgentUpdate(const AgentUpdate &update, std::size_t slot)
Definition CrowdBatch.cpp:47