From 7d13970a3a2fd5a9a04130e202008b4bb685dff9 Mon Sep 17 00:00:00 2001 From: Natalie Date: Wed, 24 Jun 2026 04:50:07 -0400 Subject: [PATCH] =?UTF-8?q?test(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=90=9B=20set=20city.owner=20in=20happiness=20=5Fmake=5Fci?= =?UTF-8?q?ty=20(fixes=20pop=3D1=20=E2=86=92=20real=20pop)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit city.owner drives _pi (the parallel-city-slot player row). _make_city never set owner, so _pi stayed -1 and found()/set_population addressed an invalid row — city population silently stayed at the default 1, breaking every happiness assertion (e.g. balanced/1city/pop3 gave -4 instead of -6; citizen contributions collapsed to -1/0). Set owner = 0 so the slot resolves. Production code is fine (real cities always have an owner). GUT: test_happiness_turn 24 → 4 failing. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/game/engine/tests/integration/test_happiness_turn.gd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game/engine/tests/integration/test_happiness_turn.gd b/src/game/engine/tests/integration/test_happiness_turn.gd index e78bfffa..752328ab 100644 --- a/src/game/engine/tests/integration/test_happiness_turn.gd +++ b/src/game/engine/tests/integration/test_happiness_turn.gd @@ -40,6 +40,10 @@ func _make_player(growth_tier: String = "balanced") -> RefCounted: func _make_city(population: int, buildings: Array[String]) -> RefCounted: var city: RefCounted = CityScript.new("test_city_%d" % randi(), [] as Array[String]) + # owner drives _pi (the parallel-city-slot player row); without it _pi stays + # -1 and found()/set_population address an invalid row, so population never + # leaves the default 1 — which silently broke every happiness assertion. + city.owner = 0 city.found("Testhold", 5, 5, true, 1) city.set_population(population) for bld: String in buildings: