Authoritative board facts and occupancy indexes for one battle. 更多...
#include <TacticsTypes.h>
Public 成员函数 | |
| BoardState ()=default | |
| Construct an empty board with square-four topology. | |
| BoardTopology | topology () const noexcept |
| Return the board topology. | |
| void | setTopology (BoardTopology topology) noexcept |
| Change topology while retaining existing cell facts. | |
| Result< void > | addCell (Cell cell, CellState state={}) |
| Add a cell with validated positive movement cost. | |
| bool | contains (Cell cell) const noexcept |
| Return whether the logical cell exists. | |
| Result< CellState > | cell (Cell cell) const |
| Return an owning copy of a cell fact, or NotFound. | |
| Result< void > | place (SubjectRef subject, Cell cell) |
| Place an unplaced subject on an existing passable empty cell. | |
| Result< void > | move (SubjectRef subject, Cell destination) |
| Move a placed subject to an existing passable empty cell atomically. | |
| Result< void > | remove (SubjectRef subject) |
| Remove a placed subject from the board. | |
| std::optional< SubjectRef > | occupant (Cell cell) const |
| Return the occupying subject, or empty when the cell is unoccupied. | |
| std::optional< Cell > | position (SubjectRef subject) const |
| Return the subject cell, or empty when it is not placed. | |
| std::vector< Cell > | cells () const |
| Return cells in deterministic coordinate order. | |
| std::vector< BoardCellRecord > | records () const |
| Return all cell facts and occupants in deterministic coordinate order. | |
| std::vector< Cell > | neighbours (Cell origin) const |
| Return deterministic neighbouring cells; ExplicitGraph uses declared outgoing edges only. | |
| Result< void > | addEdge (Cell from, Cell to, EdgeState state={}) |
| Declare a directed edge between existing cells. | |
| Result< EdgeState > | edge (Cell from, Cell to) const |
| Return a declared directed edge, or NotFound when none is declared. | |
| std::optional< EdgeState > | tryEdge (Cell from, Cell to) const |
| Return a declared directed edge, or empty when none is declared. | |
| std::vector< BoardEdgeRecord > | edgeRecords () const |
| Return every declared directed edge in deterministic order. | |
| Result< void > | validateInvariants () const |
| Validate the two occupancy indexes and all referenced cells. | |
详细描述
Authoritative board facts and occupancy indexes for one battle.
This value is owner-thread-affine. It invokes no callbacks. Every mutation preserves the cell-to-subject and subject-to-cell indexes atomically.
在文件 TacticsTypes.h 第 155 行定义.
构造及析构函数说明
◆ BoardState()
|
default |
Construct an empty board with square-four topology.
成员函数说明
◆ addCell()
Add a cell with validated positive movement cost.
- 返回
- Applied, or Conflict when the cell exists, or InvalidArgument.
在文件 TacticsTypes.cpp 第 11 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, state, eve::Status::success() , 以及 eve::Result< T >::success().
◆ addEdge()
Declare a directed edge between existing cells.
- 参数
-
from Existing source cell. to Existing destination distinct from source; grids require adjacency. state Directed traversal facts copied into this board.
- 返回
- Applied, NotFound for missing cells, InvalidArgument for invalid adjacency or costs, or Conflict for an already declared direction.
- 备注
- ExplicitGraph creates adjacency; the reverse edge is independent. Grid edges refine existing adjacency and do not remove reverse travel. Simulation-thread-only; retains no borrowed data and calls no callbacks.
在文件 TacticsTypes.cpp 第 136 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), from, eve::InvalidArgument, key, eve::NotFound, state, eve::Status::success(), eve::Result< T >::success() , 以及 to.
◆ cell()
Return an owning copy of a cell fact, or NotFound.
在文件 TacticsTypes.cpp 第 24 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::NotFound , 以及 eve::Result< T >::success().
◆ cells()
| std::vector< Cell > eve::tactics::BoardState::cells | ( | ) | const |
◆ contains()
|
noexcept |
Return whether the logical cell exists.
在文件 TacticsTypes.cpp 第 22 行定义.
◆ edge()
Return a declared directed edge, or NotFound when none is declared.
在文件 TacticsTypes.cpp 第 154 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), found, from, eve::NotFound, eve::Result< T >::success() , 以及 to.
◆ edgeRecords()
| std::vector< BoardEdgeRecord > eve::tactics::BoardState::edgeRecords | ( | ) | const |
Return every declared directed edge in deterministic order.
在文件 TacticsTypes.cpp 第 168 行定义.
◆ move()
| Result< void > eve::tactics::BoardState::move | ( | SubjectRef | subject, |
| Cell | destination | ||
| ) |
Move a placed subject to an existing passable empty cell atomically.
- 返回
- Applied or a structured validation/conflict failure; failure leaves both indexes unchanged.
在文件 TacticsTypes.cpp 第 50 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, key, eve::NotFound, eve::PreconditionViolation, source, subject, eve::Status::success(), eve::Result< T >::success() , 以及 target.
◆ neighbours()
Return deterministic neighbouring cells; ExplicitGraph uses declared outgoing edges only.
在文件 TacticsTypes.cpp 第 110 行定义.
引用了 minimum, offset, origin , 以及 eve::tactics::Cell::x.
◆ occupant()
| std::optional< SubjectRef > eve::tactics::BoardState::occupant | ( | Cell | cell | ) | const |
Return the occupying subject, or empty when the cell is unoccupied.
在文件 TacticsTypes.cpp 第 82 行定义.
引用了 found.
被这些函数引用 records().
◆ place()
| Result< void > eve::tactics::BoardState::place | ( | SubjectRef | subject, |
| Cell | cell | ||
| ) |
Place an unplaced subject on an existing passable empty cell.
- 返回
- Applied or a structured validation/conflict failure.
在文件 TacticsTypes.cpp 第 32 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, key, eve::NotFound, eve::PreconditionViolation, subject, eve::Status::success(), eve::Result< T >::success() , 以及 target.
◆ position()
| std::optional< Cell > eve::tactics::BoardState::position | ( | SubjectRef | subject | ) | const |
Return the subject cell, or empty when it is not placed.
在文件 TacticsTypes.cpp 第 87 行定义.
◆ records()
| std::vector< BoardCellRecord > eve::tactics::BoardState::records | ( | ) | const |
Return all cell facts and occupants in deterministic coordinate order.
在文件 TacticsTypes.cpp 第 103 行定义.
引用了 occupant() , 以及 state.
◆ remove()
| Result< void > eve::tactics::BoardState::remove | ( | SubjectRef | subject | ) |
Remove a placed subject from the board.
- 返回
- Applied, or NotFound when the subject is not placed.
在文件 TacticsTypes.cpp 第 71 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::InvalidArgument, eve::NotFound, subject, eve::Status::success() , 以及 eve::Result< T >::success().
◆ setTopology()
|
inlinenoexcept |
◆ topology()
|
inlinenoexcept |
Return the board topology.
在文件 TacticsTypes.h 第 161 行定义.
◆ tryEdge()
Return a declared directed edge, or empty when none is declared.
This is the query path-search uses: an undeclared direction is the common case, so it must not build a diagnostic on every relaxed neighbour.
在文件 TacticsTypes.cpp 第 162 行定义.
◆ validateInvariants()
| Result< void > eve::tactics::BoardState::validateInvariants | ( | ) | const |
Validate the two occupancy indexes and all referenced cells.
在文件 TacticsTypes.cpp 第 175 行定义.
引用了 eve::Diagnostic::error(), eve::InvariantViolation, key, eve::NoOp, state, subject, eve::Status::success() , 以及 eve::Result< T >::success().
该类的文档由以下文件生成:
- src/modules/tactics/TacticsTypes.h
- src/modules/tactics/TacticsTypes.cpp