载入中...
搜索中...
未找到
RTSCommands.cpp
浏览该文件的文档.
1#include "rts/RTS.h"
2
3namespace eve::rts {
5 const FormationSpec& formation) const {
6 auto result = CommandFanOutSystem::fanOut(selection.units, command, formation);
7 if (!result) return result;
8 ++selection.revision;
9 return result;
10}
11
12Result<FanOutReceipt> RTS::commandUnits(std::span<const SubjectRef> subjects, const CommandSpec& command,
13 const FormationSpec& formation) const {
14 Player::Selection selection;
15 selection.units.reserve(subjects.size());
16 for (std::size_t index = 0; index < subjects.size(); ++index) {
17 Unit* unit = findUnit(subjects[index]);
18 if (unit == nullptr) {
20 "RTS command unit identity was not found",
21 "subjects[" + std::to_string(index) + "]"));
22 }
23 selection.units.push_back(ecs::handle_of(unit));
24 }
25 return fanOut(selection, command, formation);
26}
27
28} // namespace eve::rts
RTS module owner and phase-one composition profile entry point.
TacticalUnit * unit
uint32_t index
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
Move-only operation result carrying either a value or Status.
Definition Result.h:155
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Result< FanOutReceipt > fanOut(std::span< const ecs::EntityHandle > unitHandles, const CommandSpec &command, const FormationSpec &formation)
Submit one command to every selected live Unit.
Result< FanOutReceipt > commandUnits(std::span< const SubjectRef > subjects, const CommandSpec &command, const FormationSpec &formation={}) const
Resolve stable unit identities and fan out one generic command.
Unit * findUnit(SubjectRef subject) const noexcept
Resolve a module-owned unit by persistent subject identity.
Definition RTS.cpp:889
Result< FanOutReceipt > fanOut(Player::Selection &selection, const CommandSpec &command, const FormationSpec &formation) const
Fan one common command out through a player's selected unit handles.
RTS unit domain root.
Definition RTSTypes.h:495
One domain-neutral command submitted to a unit's generic order queue.
Definition RTSTypes.h:101
Input to the pure formation planner.
Definition RTSSystems.h:34
RTS-owned selection handles; handles are generation checked on use.
Definition RTSTypes.h:1146
std::vector< ecs::EntityHandle > units
Definition RTSTypes.h:1147
std::uint64_t revision
Control-plane revision incremented after accepted player-semantic commands.
Definition RTSTypes.h:1150