载入中...
搜索中...
未找到
TacticsTypes.cpp
浏览该文件的文档.
13 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics cell movement cost must be positive", "cell.moveCost"));
17 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics board cell already exists", "cell"));
34 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics placement requires a valid subject", "subject"));
37 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics placement cell does not exist", "cell"));
39 return Result<void>::failure(Diagnostic::error(DiagnosticCode::PreconditionViolation, "tactics placement cell is not passable", "cell"));
41 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics placement cell is occupied", "cell"));
44 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics subject is already placed", "subject"));
52 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics movement requires a valid subject", "subject"));
56 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics movement subject is not placed", "subject"));
59 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics movement destination does not exist", "destination"));
61 return Result<void>::failure(Diagnostic::error(DiagnosticCode::PreconditionViolation, "tactics movement destination is not passable", "destination"));
63 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics movement destination is occupied", "destination"));
73 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics removal requires a valid subject", "subject"));
76 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics subject is not placed", "subject"));
114 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}}};
129 for (; it != edges_.end() && it->first.first == origin; ++it) result.push_back(it->first.second);
138 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics edge source cell does not exist", "board.edge.from"));
140 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "tactics edge destination cell does not exist", "board.edge.to"));
144 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics edge endpoints are not adjacent", "board.edge"));
146 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tactics edge extra cost must be non-negative", "board.edge.extraCost"));
149 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Conflict, "tactics edge is already declared", "board.edge"));
178 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvariantViolation, "tactics edge references a missing cell", "board.edge"));
181 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvariantViolation, "tactics occupancy indexes differ in size", "board"));
184 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvariantViolation, "tactics occupancy references a missing cell", "board.occupancy"));
187 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvariantViolation, "tactics occupancy reverse index is inconsistent", "board.occupancy"));
196 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={}, 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
Result< void > remove(SubjectRef subject)
Remove a placed subject from the board.
Definition TacticsTypes.cpp:71
std::vector< Cell > cells() const
Return cells in deterministic coordinate order.
Definition TacticsTypes.cpp:93
bool contains(Cell cell) const noexcept
Return whether the logical cell exists.
Definition TacticsTypes.cpp:22
Result< void > addCell(Cell cell, CellState state={})
Add a cell with validated positive movement cost.
Definition TacticsTypes.cpp:11
Result< CellState > cell(Cell cell) const
Return an owning copy of a cell fact, or NotFound.
Definition TacticsTypes.cpp:24
std::vector< BoardCellRecord > records() const
Return all cell facts and occupants in deterministic coordinate order.
Definition TacticsTypes.cpp:103
Result< void > move(SubjectRef subject, Cell destination)
Move a placed subject to an existing passable empty cell atomically.
Definition TacticsTypes.cpp:50
Result< void > place(SubjectRef subject, Cell cell)
Place an unplaced subject on an existing passable empty cell.
Definition TacticsTypes.cpp:32
std::optional< SubjectRef > occupant(Cell cell) const
Return the occupying subject, or empty when the cell is unoccupied.
Definition TacticsTypes.cpp:82
std::optional< Cell > position(SubjectRef subject) const
Return the subject cell, or empty when it is not placed.
Definition TacticsTypes.cpp:87
Definition Interaction.cpp:13
std::string_view statusName(BattleStatus status) noexcept
Return the stable protocol spelling of a battle status.
Definition TacticsTypes.cpp:215
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:224
std::string_view phaseName(BattlePhase phase) noexcept
Return the stable protocol spelling of a battle phase.
Definition TacticsTypes.cpp:200
@ 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