载入中...
搜索中...
未找到
RTSMatch.cpp
浏览该文件的文档.
20 const auto found = std::find_if(match.participants()->entries.begin(), match.participants()->entries.end(),
25void eliminate(Match& match, Match::Participants::Entry& entry, std::string reason, bool surrendered = false) {
38 auto buildings = ecs::View<Building, Building::Definition, Building::Faction, Building::Integrity,
51 if (owns(owner->link, faction) && durability->alive && durability->state.health > 0.0) return true;
56 if (owns(owner->link, faction) && integrity->alive && integrity->state.health > 0.0) return true;
96 DiagnosticCode::Conflict, "cannot add an RTS participant after match start", "match", {}, "rts.match"));
98 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "RTS faction is already a participant",
109 Diagnostic::error(DiagnosticCode::Conflict, "RTS match is not in setup", "match.phase", {}, "rts.match"));
117 DiagnosticCode::StaleHandle, "RTS match contains a stale faction", "participants", {}, "rts.match"));
121 DiagnosticCode::InvalidArgument, "headquarters victory requires an archetype", "rules", {}, "rts.match"));
125 DiagnosticCode::InvalidArgument, "resource victory requires a positive target", "rules", {}, "rts.match"));
135 Diagnostic::error(DiagnosticCode::Conflict, "RTS match is not running", "match.phase", {}, "rts.match"));
139 DiagnosticCode::NotFound, "RTS faction is not an active participant", "faction", {}, "rts.match"));
153 DiagnosticCode::PreconditionViolation, "resource victory requires an authoritative economy query",
Deterministic match lifecycle and victory systems.
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< EntityLink > bind(ecs::EntityHandle handle)
Bind a live ECS handle, rejecting a null or stale handle.
Definition RTSTypes.h:184
Faction domain root; membership is a set of typed runtime handles.
Definition RTSTypes.h:1178
static Result< std::size_t > step(Match &match, const MatchResourceQuery &resources={})
Evaluate the configured victory rule and settle a winner or draw.
Definition RTSMatch.cpp:146
static Result< void > start(Match &match)
Validate rules/participants and transition Setup to Running.
Definition RTSMatch.cpp:106
static Result< void > addParticipant(Match &match, Faction &faction, int team)
Add one live faction before match start.
Definition RTSMatch.cpp:93
static Result< void > surrender(Match &match, Faction &faction)
Eliminate a participant and all of its live RTS entities.
Definition RTSMatch.cpp:132
Independent match composition root; factions may participate in different matches.
Definition RTSTypes.h:1295
@ Building
Definition RTS.cpp:24
std::function< Result< double >(Faction &, std::string_view)> MatchResourceQuery
Reads a resource balance from the game-owned canonical economy account.
Definition RTSMatch.h:16
@ Running
@ Finished
@ Setup
@ DestroyHeadquarters
@ ResourceTarget
@ InvalidArgument
@ NotFound
@ PreconditionViolation
@ StaleHandle
@ Conflict
@ NoOp
@ Applied