fix(ci): document tactics bindings and register tests

This commit is contained in:
西风逍遥游 committed 2026-08-29 09:23:46 +08:00
1 parent f7b732def2
commit 5ad3146561
3 files changed
+15 -2

No files matched your search

+4
View File
@@ -27,6 +27,10 @@ local moved = battle.move("00000000-0000-0000-0000-000000001002", 1, 0, 0);
代理内部只保存带 module epoch 的 generation handle;`release()` 或模块卸载后,后续写操作返回
`StaleHandle`。脚本不会接触 ECS handle 或跨帧裸指针。
`Tactics.getName()` 返回模块名;`battleCount()`、`sideCount()` 和 `unitCount()` 返回当前存活的
战局、阵营与单位数量。战局代理的 `ownership()` 返回 `"owned"`,`isStale()` 用于在调用其他
战局方法前显式检查代理是否已因 `release()` 或模块 epoch 变化而失效。
可用的战局操作包括 `setTopology/addCell/addSide/addUnit/start/advance/move/face/wait/defeatUnit`,查询包括
`status/phase/activeUnit/unitCell/revision/eventCount/eventAt`。所有可能失败的写操作都返回统一
`{ok, code, status, diagnostics, value}` 结构。
+2 -2
View File
@@ -92,7 +92,7 @@ Result<Cell> parseCell(const Value& value, std::string path) {
if (candidate.value()->size() != 3)
return fail<Cell>(DiagnosticCode::ParseError, "cell has unknown or missing fields", std::move(path));
Cell result;
for (const auto [name, target] : {std::pair{"x", &result.x}, {"y", &result.y}, {"layer", &result.layer}}) {
for (const auto& [name, target] : {std::pair{"x", &result.x}, {"y", &result.y}, {"layer", &result.layer}}) {
auto member = field(*candidate.value(), name, path);
if (!member) return Result<Cell>::failure(member.status());
auto parsed = integer(*member.value(), path + "." + name);
@@ -755,7 +755,7 @@ Result<Candidate> parseCandidate(Battle& battle, const Value& payload, Revision
definition = *parsedDefinition;
}
TacticalUnit::TurnResources turn;
for (const auto [name, target] :
for (const auto& [name, target] :
{std::pair{"actionPoints", &turn.actionPoints}, {"movePoints", &turn.movePoints},
{"reactionPoints", &turn.reactionPoints}, {"roundActionPoints", &turn.roundActionPoints},
{"roundMovePoints", &turn.roundMovePoints},
+9
View File
@@ -353,6 +353,15 @@ file(GLOB all_test_cpp
tensor.cpp
tensor_llm.cpp
tensor_quant.cpp
tactics_action.cpp
tactics_board.cpp
tactics_objective.cpp
tactics_path.cpp
tactics_reaction.cpp
tactics_replay.cpp
tactics_rpg_integration.cpp
tactics_script.cpp
tactics_turn.cpp
callgraph.cpp
renderflow.cpp
resource_lifetime.cpp