test(@projects/@magic-civilization): 🐛 load runtime units catalog before add_player_militarist (turn_processor)
add_player_militarist has a p2-71c guard that returns -1 (refuses to spawn) unless set_units_runtime_catalog_json() is called first — otherwise MapUnit base_moves=0 and the sim freezes at turn 0. The test never loaded the catalog, so 0 players spawned → all downstream assertions (cities/units/wealth/fauna) read 0. _make_state now harvests the same catalog the real bridge does (AiTurnBridge._harvest_runtime_units_json). GUT: test_gd_turn_processor 14 → 2 failing; suite 33 → 32. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d6ca9f478d
commit
3ebf7bf42f
1 changed files with 6 additions and 0 deletions
|
|
@ -175,6 +175,12 @@ func _make_state() -> RefCounted:
|
|||
var state: RefCounted = ClassDB.instantiate("GdGameState") as RefCounted
|
||||
assert_not_null(state, "GdGameState must be registered")
|
||||
state.call("create_grid", MAP_SIZE, MAP_SIZE)
|
||||
# p2-71c — add_player_militarist refuses to spawn (returns -1) unless the
|
||||
# runtime units catalog is loaded first (otherwise MapUnit base_moves=0 and
|
||||
# the AI freezes past turn 0). Harvest the same catalog the real bridge does.
|
||||
var units_json: String = AiTurnBridge._harvest_runtime_units_json()
|
||||
assert_false(units_json.is_empty(), "runtime units catalog must harvest from resources/units")
|
||||
state.call("set_units_runtime_catalog_json", units_json)
|
||||
return state
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue