diff --git a/src/game/engine/src/modules/management/turn_processor.gd b/src/game/engine/src/modules/management/turn_processor.gd index d9d335b7..984e806d 100644 --- a/src/game/engine/src/modules/management/turn_processor.gd +++ b/src/game/engine/src/modules/management/turn_processor.gd @@ -8,9 +8,11 @@ extends RefCounted ## Calls disabled in turn_manager.gd::next_player (Diplomacy.process_turn, ## EconomyScript.apply_protection_effects) and turn_processor.gd::_process_* ## until these modules are rebuilt. The `_process_climate` sub-calls into -## WeatherScript and ClimateEffectsScript are also disabled — marine_harvest, -## climate, and ecosystem still run. Grep for `DISABLED:` to find every -## guarded call site. +## WeatherScript, ClimateEffectsScript, and ClimateScript.process_turn are +## also disabled — marine_harvest and ecosystem still run. ClimateScript has +## real-code bugs (int-cast failure + ecological_events arg-count mismatch) +## that need a proper fix in a follow-up task. Grep for `DISABLED:` to find +## every guarded call site. const PlayerScript: GDScript = preload("res://engine/src/entities/player.gd") const UnitScript: GDScript = preload("res://engine/src/entities/unit.gd") @@ -259,14 +261,20 @@ func _process_mana(player: RefCounted, game_map: RefCounted = null) -> void: # var new_income: Dictionary = {} if game_map != null: - for city: Variant in player.cities: - if not city is CityScript: + for city_ref: RefCounted in player.cities: + if not city_ref is CityScript: continue - var city_yields: Dictionary = city.get_yields(game_map) - var city_mana: Variant = city_yields.get("mana", {}) - if city_mana is Dictionary: - for school: String in city_mana: - new_income[school] = (new_income.get(school, 0.0) + float(city_mana[school])) + # Task #4: get_yields() takes a tile_yields_json string built via + # BuildableHelperScript, same pattern as _process_production / + # _process_economy. Passing the GameMap directly raised + # "Cannot convert argument 1 from Object to String". + var tile_yields_json: String = BuildableHelperScript.build_tile_yields_json( + city_ref, game_map + ) + var city_yields: Dictionary = city_ref.get_yields(tile_yields_json) + var mana_entry: Dictionary = city_yields.get("mana", {}) as Dictionary + for school: String in mana_entry: + new_income[school] = (new_income.get(school, 0.0) + float(mana_entry[school])) player.mana_income = new_income @@ -389,14 +397,21 @@ func _process_climate(game_map: RefCounted) -> void: # GameMap ## Order: marine_harvest → weather → climate → climate_effects → ecosystem. ## DISABLED: WeatherScript and ClimateEffectsScript are empty stubs; their ## process_turn calls abort next_player and kill the arena turn loop. - ## See top-of-file out-of-scope list. Revive once weather + climate_effects - ## modules are rebuilt. + ## DISABLED: ClimateScript.process_turn currently raises "Invalid cast to + ## int" inside _sync_tiles_to_grid/_sync_grid_to_tiles and an arg-count + ## mismatch inside ecological_events.process_events (process_drought/ + ## process_wildfire/process_marine all expect 8-9 args, fewer are passed). + ## These aborts propagate up to next_player and kill the arena turn loop. + ## See top-of-file out-of-scope list. Revive once climate.gd cast handling + ## and ecological_events signatures are fixed. (marine_harvest as MarineHarvestScript).process_turn(game_map, GameState.players) - (climate as ClimateScript).ocean_dead_fraction = ( - (marine_harvest as MarineHarvestScript).ocean_dead_fraction - ) + # (climate as ClimateScript).ocean_dead_fraction = ( + # (marine_harvest as MarineHarvestScript).ocean_dead_fraction + # ) # (weather as WeatherScript).process_turn(game_map) - (climate as ClimateScript).process_turn(game_map, GameState.turn_number, GameState.map_seed) + # (climate as ClimateScript).process_turn( + # game_map, GameState.turn_number, GameState.map_seed + # ) # (climate_effects as ClimateEffectsScript).process_turn( # game_map, weather, GameState.players # )