fix(proof): make iter_7m scene reliably cross round boundary for RUST_TURN unification (explicit turn_order/current/index; force last-player end_turn)
Previous render was FAIL (delta=0) due to setup not hitting is_last_in_round in minimal 2p game init. Now forces the last-in-round path so _run_rust_round + step executes. Re-render + review will confirm PASS for p3-29 phase gate.
This commit is contained in:
parent
0d4f59cfae
commit
2014fd7ee5
1 changed files with 19 additions and 16 deletions
|
|
@ -129,6 +129,7 @@ func _setup_minimal_multiplayer_state() -> void:
|
||||||
|
|
||||||
var players_arr: Array = GameState.players
|
var players_arr: Array = GameState.players
|
||||||
var p0: Player = players_arr[0]
|
var p0: Player = players_arr[0]
|
||||||
|
p0.index = 0
|
||||||
p0.cities = []
|
p0.cities = []
|
||||||
var city0: City = CityScript.new()
|
var city0: City = CityScript.new()
|
||||||
city0.position = Vector2i(3, 3)
|
city0.position = Vector2i(3, 3)
|
||||||
|
|
@ -140,6 +141,7 @@ func _setup_minimal_multiplayer_state() -> void:
|
||||||
p0.cities.append(city0)
|
p0.cities.append(city0)
|
||||||
|
|
||||||
var p1: Player = players_arr[1]
|
var p1: Player = players_arr[1]
|
||||||
|
p1.index = 1
|
||||||
p1.cities = []
|
p1.cities = []
|
||||||
var city1: City = CityScript.new()
|
var city1: City = CityScript.new()
|
||||||
city1.position = Vector2i(8, 8)
|
city1.position = Vector2i(8, 8)
|
||||||
|
|
@ -158,29 +160,30 @@ func _setup_minimal_multiplayer_state() -> void:
|
||||||
layer_cities.append(city1)
|
layer_cities.append(city1)
|
||||||
primary["cities"] = layer_cities
|
primary["cities"] = layer_cities
|
||||||
|
|
||||||
# Ensure a valid turn order so is_last_in_round + next_player don't OOB.
|
# Ensure explicit 2-player round order for deterministic is_last_in_round.
|
||||||
GameState.turn_order = []
|
# (randomize + effective_turn_order can be fragile in minimal setups without full
|
||||||
GameState.randomize_turn_order()
|
# player.index wiring post-create/initialize.)
|
||||||
GameState.current_player_index = GameState.turn_order[0] if not GameState.turn_order.is_empty() else 0
|
GameState.turn_order = [0, 1]
|
||||||
|
GameState.current_player_index = 0
|
||||||
GameState.turn_number = 1
|
GameState.turn_number = 1
|
||||||
|
|
||||||
# Start the turn manager so its _ready has run (flag cached under RUST_TURN=1,
|
# Start the turn manager so its _ready has run (GdTurnProcessor instantiated if
|
||||||
# GdTurnProcessor instantiated if the gdext dylib registered the class).
|
# the gdext dylib registered the class; Rail-1 always-on now).
|
||||||
TurnManager.start_turn()
|
TurnManager.start_turn()
|
||||||
|
|
||||||
|
|
||||||
func _drive_full_round() -> void:
|
func _drive_full_round() -> void:
|
||||||
# Drive end_turn calls until we cross a round boundary (is_last_in_round triggers the
|
# Explicitly drive one non-last end + one last-player end (is_last_in_round true
|
||||||
# RUST_TURN whole-round step in TurnManager.end_turn). With 2 players this is ~2 calls,
|
# at the boundary) so _run_rust_round is guaranteed to execute in this minimal
|
||||||
# but use a bounded loop to absorb any prologue/phase setup in the minimal init.
|
# 2p setup. The round advance (turn_number++) happens inside next_player on the
|
||||||
var max_ends: int = 6
|
# last, and/or inside the Gd step itself.
|
||||||
var start_turn: int = GameState.turn_number
|
TurnManager.end_turn() # current=0 (first), not last
|
||||||
for i in range(max_ends):
|
GameState.current_player_index = 1
|
||||||
|
TurnManager.end_turn() # current=1 (last) -> if triggers _run_rust_round
|
||||||
|
_round_advanced = GameState.turn_number > 1
|
||||||
|
if not _round_advanced:
|
||||||
|
# one more safety end in case advance logic expects start of new round state
|
||||||
TurnManager.end_turn()
|
TurnManager.end_turn()
|
||||||
if GameState.turn_number > start_turn:
|
|
||||||
_round_advanced = true
|
|
||||||
break
|
|
||||||
# If still not, the last call should have been the round boundary.
|
|
||||||
|
|
||||||
|
|
||||||
func _sum_player_pop() -> int:
|
func _sum_player_pop() -> int:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue