载入中...
搜索中...
未找到
RTSConstruction.cpp
浏览该文件的文档.
8Result<std::size_t> ConstructionSystem::step(const SimulationStep& step, const LifecycleEventSink& events) {
12 DiagnosticCode::InvalidArgument, "RTS construction step delta must be non-negative", "step.delta"));
14 auto buildings = ecs::View<Building, Building::Identity, Building::Construction, Building::Faction>();
17 auto* building = identity == nullptr ? nullptr : dynamic_cast<Building*>(ecs::try_get(identity->self));
27 auto units = ecs::View<Unit, Unit::Identity, Unit::Motion, Unit::Orders, Unit::Worker, Unit::Faction>();
30 auto* unit = unitIdentity == nullptr ? nullptr : dynamic_cast<Unit*>(ecs::try_get(unitIdentity->self));
37 if (!record || record->kind != OrderKind::Build || !isSameHandle(record->targetEntity, identity->self))
64 if (record && record->kind == OrderKind::Build && isSameHandle(record->targetEntity, identity->self)) {
#define EV_PROFILE_MODULE(module, name)
Profile the enclosing scope, tagged with a module for grouping.
Definition Profile.h:158
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
RTS building domain root with placement and production composition.
Definition RTSTypes.h:852
static Result< std::size_t > step(const SimulationStep &step, const LifecycleEventSink &events={})
Advance incomplete buildings and settle completed Build orders.
Definition RTSConstruction.cpp:8
Result< std::optional< OrderRecord > > readCurrent(OrderComponent &orders)
Definition RTSSystemMovementInternal.h:115
bool isSameHandle(const ecs::EntityHandle &left, const ecs::EntityHandle &right)
Definition RTSSystemMovementInternal.h:21
Definition RTS.cpp:30
std::function< void(const LifecycleEvent &, SimulationTick)> LifecycleEventSink
Read-only observer invoked after a non-combat lifecycle transition commits.
Definition RTSSystems.h:128
@ Build
@ ConstructionCompleted
@ InvalidArgument
@ NoOp
@ Applied