载入中...
搜索中...
未找到
RTSMining.cpp
浏览该文件的文档.
27 auto nodes = ecs::View<ResourceNode, ResourceNode::Identity, ResourceNode::Position, ResourceNode::Stock,
32 nodeIdentity == nullptr ? nullptr : dynamic_cast<ResourceNode*>(ecs::try_get(nodeIdentity->self));
46 std::sort(candidates.begin(), candidates.end(), [](const Candidate& left, const Candidate& right) {
72Result<std::size_t> MiningSystem::step(const SimulationStep& step, const ResourceCredit& credit) {
102 if (worker->cargo >= worker->capacity || (!node->stock()->infinite && node->stock()->remaining <= 0.0f)) {
120 } else if (record->kind == OrderKind::ReturnCargo && motion->arrived && worker->cargo >= 1.0f) {
#define EV_PROFILE_MODULE(module, name)
Profile the enclosing scope, tagged with a module for grouping.
Definition Profile.h:158
std::map< std::array< int, 4 >, std::vector< const Subject * > > candidates
Definition Sensing.cpp:32
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
static eve::Result< CostSpec > single(std::string_view resource, std::int64_t amount)
Build a one-resource cost.
Definition ResourceAccount.cpp:117
RTS building domain root with placement and production composition.
Definition RTSTypes.h:852
static Result< EntityLink > bind(ecs::EntityHandle handle)
Bind a live ECS handle, rejecting a null or stale handle.
Definition RTSTypes.h:189
static Result< std::size_t > step(const SimulationStep &step, const ResourceCredit &credit)
Gather stock or deliver integral cargo through the injected canonical credit boundary.
Definition RTSMining.cpp:72
Harvestable RTS resource node; deposited balances are owned by an external resource account.
Definition RTSTypes.h:1085
static Result< std::size_t > step()
Assign nearest available nodes and enqueue Gather orders.
Definition RTSMining.cpp:9
float distanceSquared(float ax, float ay, float bx, float by)
Definition RTSSystemMovementInternal.h:27
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< Result< resource::Receipt >(Unit &, const resource::CostSpec &)> ResourceCredit
Callback that credits gathered resources to the authoritative account selected by the game.
Definition RTSSystems.h:389
@ ReturnCargo
@ Gather
@ InvalidArgument
@ NoOp
@ Applied
One domain-neutral command submitted to a unit's generic order queue.
Definition RTSTypes.h:106
Concurrent worker capacity and current generation-checked assignments.
Definition RTSTypes.h:1113
Authoritative world position and interaction radius.
Definition RTSTypes.h:1100