载入中...
搜索中...
未找到
TacticsTypes.cpp
浏览该文件的文档.
14 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics cell movement cost must be positive", "cell.moveCost"));
18 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics board cell already exists", "cell"));
35 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics placement requires a valid subject", "subject"));
38 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics placement cell does not exist", "cell"));
40 return Result<void>::failure(Diagnostic::error(DiagnosticCode::PreconditionViolation, "tactics placement cell is not passable", "cell"));
42 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics placement cell is occupied", "cell"));
45 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics subject is already placed", "subject"));
53 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics movement requires a valid subject", "subject"));
57 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics movement subject is not placed", "subject"));
60 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics movement destination does not exist", "destination"));
62 return Result<void>::failure(Diagnostic::error(DiagnosticCode::PreconditionViolation, "tactics movement destination is not passable", "destination"));
64 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics movement destination is occupied", "destination"));
74 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics removal requires a valid subject", "subject"));
77 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics subject is not placed", "subject"));
115 static constexpr std::array<Cell, 6> hex{{{1, 0, 0}, {1, -1, 0}, {0, -1, 0}, {-1, 0, 0}, {-1, 1, 0}, {0, 1, 0}}};
139 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics edge source cell does not exist", "board.edge.from"));
141 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics edge destination cell does not exist", "board.edge.to"));
145 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics edge endpoints are not adjacent", "board.edge"));
147 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics edge extra cost must be non-negative", "board.edge.extraCost"));
150 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics edge is already declared", "board.edge"));
179 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvariantViolation, "tactics edge references a missing cell", "board.edge"));
182 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvariantViolation, "tactics occupancy indexes differ in size", "board"));
185 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvariantViolation, "tactics occupancy references a missing cell", "board.occupancy"));
188 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvariantViolation, "tactics occupancy reverse index is inconsistent", "board.occupancy"));
197 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics consumable turn resources must be non-negative", "turnResources"));
Deterministic board values and short-root ECS entities for tactics.
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
Result< void > remove(SubjectRef subject)
Remove a placed subject from the board.
Definition TacticsTypes.cpp:72
std::vector< Cell > cells() const
Return cells in deterministic coordinate order.
Definition TacticsTypes.cpp:94
bool contains(Cell cell) const noexcept
Return whether the logical cell exists.
Definition TacticsTypes.cpp:23
Result< void > addCell(Cell cell, CellState state={})
Add a cell with validated positive movement cost.
Definition TacticsTypes.cpp:12
Result< CellState > cell(Cell cell) const
Return an owning copy of a cell fact, or NotFound.
Definition TacticsTypes.cpp:25
std::vector< BoardCellRecord > records() const
Return all cell facts and occupants in deterministic coordinate order.
Definition TacticsTypes.cpp:104
Result< void > move(SubjectRef subject, Cell destination)
Move a placed subject to an existing passable empty cell atomically.
Definition TacticsTypes.cpp:51
Result< void > place(SubjectRef subject, Cell cell)
Place an unplaced subject on an existing passable empty cell.
Definition TacticsTypes.cpp:33
std::optional< SubjectRef > occupant(Cell cell) const
Return the occupying subject, or empty when the cell is unoccupied.
Definition TacticsTypes.cpp:83
std::optional< Cell > position(SubjectRef subject) const
Return the subject cell, or empty when it is not placed.
Definition TacticsTypes.cpp:88
Definition Interaction.cpp:13
std::string_view statusName(BattleStatus status) noexcept
Return the stable protocol spelling of a battle status.
Definition TacticsTypes.cpp:216
BattleCommandKind
Accepted deterministic command kinds recorded for replay.
Definition TacticsTypes.h:356
std::string_view commandKindName(BattleCommandKind kind) noexcept
Return the stable protocol spelling of an accepted command kind.
Definition TacticsTypes.cpp:225
std::string_view phaseName(BattlePhase phase) noexcept
Return the stable protocol spelling of a battle phase.
Definition TacticsTypes.cpp:201
@ InvalidArgument
@ NotFound
@ PreconditionViolation
@ InvariantViolation
@ Conflict
@ NoOp
@ Applied
Logical board coordinate independent of rendering projection.
Definition TacticsTypes.h:30
One authoritative directed edge fact between two adjacent cells.
Definition TacticsTypes.h:115