载入中...
搜索中...
未找到
RTSCrowdMotion.cpp
浏览该文件的文档.
33 auto view = ecs::View<Unit, Unit::Identity, Unit::Motion, Unit::Navigation, Unit::Orders, Unit::Crowd, Unit::Combat,
36 auto [identity, motion, navigation, orders, settings, combat, containment, supply, morale, tactics, command,
50 Diagnostic::error(DiagnosticCode::Conflict, "RTS crowd agent keys must be unique", "unit.crowd.link"));
53 {unit, motion, navigation, settings, combat, supply, morale, tactics, command, effects, &orders->values});
69 Diagnostic::error(DiagnosticCode::Failed, "canonical Crowd rejected an RTS agent", "unit.crowd.link"));
77 entry.command->requiresCommand && !entry.command->inCommand ? entry.command->outOfCommandSpeedFactor : 1.0f;
78 const float effectFactor = static_cast<float>(entry.effects->values.multiplier("speedMultiplier"));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
Result< void > setAgentInteraction(int id, AgentInteraction policy)
Atomically replace the local interaction policy for a current compact slot.
Definition CrowdInteraction.cpp:5
int getNamedAgentIndex(const std::string &stableId) const
Resolve a stable logical identifier to the current compact slot.
Definition Crowd.cpp:139
Result< StepReport > advance(float dt)
Advance using bounded simultaneous integration and contact projection.
Definition CrowdStep.cpp:6
int addNamedAgent(const std::string &stableId, float x, float y, float heading, float radius)
Add an agent with an editor/game-stable logical identifier.
Definition Crowd.cpp:125
Result< AgentInteraction > getAgentInteraction(int id) const
Read an owning policy snapshot, or NotFound for an invalid compact slot. @thread Simulation thread on...
Definition CrowdInteraction.cpp:20
bool removeNamedAgent(const std::string &stableId)
Remove an agent by stable logical identifier.
Definition Crowd.cpp:148
bool setAgentAction(int id, const std::string &action)
设置行动:"idle" | "flow" | "seek" | "boids"。
Definition Crowd.cpp:236
Result< void > setAgentAvoidancePriority(int id, int priority)
Set overlap-resolution priority; higher values yield less.
Definition Crowd.cpp:298
bool setAgentTarget(int id, float tx, float ty)
设置世界目标点(seek 直接寻点,boids 作迁移偏置)。
Definition Crowd.cpp:249
static Result< std::size_t > step(const SimulationStep &step, crowd::Crowd &crowd)
Push ECS targets into Crowd, advance it once, and project positions back to Unit::Motion.
Definition RTSCrowdMotion.cpp:14
Generic orders component adapter; the queue remains the sole order owner.
Definition RTSTypes.h:385
float distanceSquared(float ax, float ay, float bx, float by)
Definition RTSSystemMovementInternal.h:23
Result< std::optional< OrderRecord > > readCurrent(OrderComponent &orders)
Definition RTSSystemMovementInternal.h:56
bool isMovementOrder(OrderKind kind)
Definition RTSSystemMovementInternal.h:29
std::optional< WorldPosition > entityPosition(const ecs::EntityHandle &handle)
Definition RTSSystemMovementInternal.h:48
Definition RTS.cpp:24
@ HoldPosition
@ Escort
@ AttackMove
@ Attack
@ Patrol
@ SupplyRelay
@ Resupply
@ InvalidArgument
@ InvariantViolation
@ Failed
@ Conflict
@ NoOp
@ Applied
RTS stance and pursuit limits used by automatic combat policies.
Definition RTSTypes.h:610
Command-network policy and derived connection state for a mobile unit or relay.
Definition RTSTypes.h:655
Unit containment state for transports and building garrisons.
Definition RTSTypes.h:693
Suppression, recovery, retreat policy, and friendly morale aura.
Definition RTSTypes.h:724
Authoritative kinematic state used by the phase-one move slice.
Definition RTSTypes.h:560
Tactical ammunition logistics; weapon ammunition remains authoritative in WeaponEntity.
Definition RTSTypes.h:699
Escort geometry and combat-group coordination state.
Definition RTSTypes.h:764