载入中...
搜索中...
未找到
RTSMotion.cpp
浏览该文件的文档.
18 auto view = ecs::View<Unit, Unit::Identity, Unit::Motion, Unit::Navigation, Unit::Orders, Unit::Combat,
21 auto [identity, motion, navigation, orders, combat, containment, supply, morale, tactics, command, effects] =
41 if ((navigation->trafficWaiting && !navigation->trafficRecoveryTarget) || supply->convoyWaiting ||
63 if (record->kind == OrderKind::SupplyRelay && supply->rendezvousActive) target = supply->rendezvousPoint;
73 const bool movingSlot = record->kind == OrderKind::Move && navigation->formationTarget.has_value();
81 DiagnosticCode::InvariantViolation, "RTS motion target distance is non-finite", "order.target"));
94 const float moraleFactor = morale->active ? std::clamp(morale->suppressedSpeedFactor, 0.0f, 1.0f) : 1.0f;
98 const float speedFactor = moraleFactor * commandFactor * effectFactor * navigation->formationSpeedFactor;
102 DiagnosticCode::InvalidArgument, "RTS motion travel distance is non-finite", "unit.motion.speed"));
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
static Result< std::size_t > step(const SimulationStep &step)
Advance all Units with Motion and Orders components.
Definition RTSMotion.cpp:12
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
@ Escort
@ AttackMove
@ Attack
@ Patrol
@ SupplyRelay
@ Resupply
@ InvalidArgument
@ InvariantViolation
@ 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