fix(merge): remove duplicate commit_improvement function

The git auto-merger created a spurious second copy of commit_improvement
when reconciling the conflict in world_map_city_actions.gd. The first
copy had a stray '_pending_unit = null' injection that neither HEAD nor
origin/main had in their commit_improvement bodies.

Verified: function definitions now match both sides (6 funcs, including
the canonical commit_improvement that's byte-identical to origin/main).
gdformat clean, gdlint clean.

The hand-merged _on_popup_selected body (origin's superset with the
AI_ARENA fallback path) is unchanged — only the duplicate function
definition outside it was removed.
This commit is contained in:
Natalie 2026-04-26 19:40:54 -07:00
parent 3280c93c5d
commit e8697d4bc8

View file

@ -39,12 +39,15 @@ func on_found_city_pressed(selected_unit: RefCounted) -> void:
var is_capital: bool = player.cities.is_empty()
var city: RefCounted = CityScript.new()
city.owner = player.index
city.found(
city_name,
selected_unit.position.x,
selected_unit.position.y,
is_capital,
GameState.turn_number,
(
city
. found(
city_name,
selected_unit.position.x,
selected_unit.position.y,
is_capital,
GameState.turn_number,
)
)
player.cities.append(city)
@ -77,10 +80,13 @@ func on_build_improvement_pressed(selected_unit: RefCounted) -> void:
_improvement_popup.clear()
for i: int in range(_pending_improvements_list.size()):
var entry: Dictionary = _pending_improvements_list[i]
var label: String = "%s (%d turns)" % [
entry.get("name", ""),
entry.get("build_turns", 0),
]
var label: String = (
"%s (%d turns)"
% [
entry.get("name", ""),
entry.get("build_turns", 0),
]
)
_improvement_popup.add_item(label, i)
var mouse_pos: Vector2i = DisplayServer.mouse_get_position()
@ -109,23 +115,14 @@ func _on_popup_selected(id: int) -> void:
if player == null:
_pending_unit = null
return
var success: bool = _improvement_manager.start_improvement(_pending_unit, improvement_id, player)
var success: bool = _improvement_manager.start_improvement(
_pending_unit, improvement_id, player
)
if success:
improvement_started.emit(_pending_unit)
_pending_unit = null
## p1-26d: called by world_map when the player confirms the improvement preview.
func commit_improvement(unit: RefCounted, improvement_id: String) -> void:
var player: RefCounted = GameState.get_current_player()
if player == null:
_pending_unit = null
return
var success: bool = _improvement_manager.start_improvement(unit, improvement_id, player)
if success:
improvement_started.emit(unit)
## p1-26d: called by world_map when the player confirms the improvement preview.
func commit_improvement(unit: RefCounted, improvement_id: String) -> void:
var player: RefCounted = GameState.get_current_player()