From b6573bcb309492c3a16c10db913a3596e89c6932 Mon Sep 17 00:00:00 2001 From: Natalie Date: Fri, 19 Jun 2026 01:43:25 -0500 Subject: [PATCH] =?UTF-8?q?refactor(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=8E=A8=20route=20city/world=5Fgen=5Flab=20proofs=20to=20b?= =?UTF-8?q?iome=5Fcolors=20single=20source=20(p2-87=20phase=201d)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delete the hardcoded TERRAIN_COLORS dict copies in city_proof.gd and world_gen_lab_proof.gd; both now call DataLoader.get_biome_color(tile.biome_id) (both load the theme, so the source is populated). Verified: city_proof renders correct biome colours (ocean/forest/plains/mountains/volcano), no magenta. Remaining phase-1d copies: climate_proof (also draws a colour legend off the dict) + improvement_proof / world_map_proof (don't load_theme — would need a theme-load added first). Tracked in p2-87. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/game/engine/scenes/tests/city_proof.gd | 26 +++---------------- .../world_gen_lab/world_gen_lab_proof.gd | 26 +++---------------- 2 files changed, 6 insertions(+), 46 deletions(-) diff --git a/src/game/engine/scenes/tests/city_proof.gd b/src/game/engine/scenes/tests/city_proof.gd index 46f0bf49..76de9fe3 100644 --- a/src/game/engine/scenes/tests/city_proof.gd +++ b/src/game/engine/scenes/tests/city_proof.gd @@ -21,28 +21,8 @@ const WATER_BIOMES: Dictionary = { "ocean": true, "deep_ocean": true, "coast": true, "inland_sea": true, "lake": true, } -const TERRAIN_COLORS: Dictionary = { - "ocean": Color(0.05, 0.10, 0.35), - "deep_ocean": Color(0.02, 0.05, 0.25), - "coast": Color(0.25, 0.45, 0.75), - "lake": Color(0.15, 0.65, 0.75), - "inland_sea": Color(0.10, 0.30, 0.60), - "grassland": Color(0.30, 0.65, 0.20), - "plains": Color(0.60, 0.70, 0.25), - "forest": Color(0.10, 0.40, 0.10), - "jungle": Color(0.20, 0.70, 0.15), - "boreal_forest": Color(0.15, 0.40, 0.35), - "enchanted_forest": Color(0.30, 0.55, 0.60), - "desert": Color(0.85, 0.75, 0.40), - "tundra": Color(0.70, 0.75, 0.72), - "snow": Color(0.92, 0.94, 0.96), - "ice": Color(0.80, 0.88, 0.95), - "mountains": Color(0.45, 0.42, 0.40), - "hills": Color(0.55, 0.45, 0.30), - "swamp": Color(0.30, 0.35, 0.15), - "volcano": Color(0.75, 0.15, 0.10), - "land": Color(0.50, 0.50, 0.30), -} +## Biome colour comes from the single source (biome_colors.json) via +## DataLoader.get_biome_color() — no local palette copy (p2-87). var _game_map: RefCounted = null var _player: RefCounted = null @@ -203,7 +183,7 @@ func _draw_map_panel(px: float) -> void: if offset.x & 1: y += CELL_H * 0.5 - var base: Color = TERRAIN_COLORS.get(tile.biome_id, Color(0.5, 0.0, 0.5)) + var base: Color = DataLoader.get_biome_color(tile.biome_id) draw_rect(Rect2(x, y, CELL_W - 1, CELL_H - 1), base) if pos in owned: diff --git a/src/game/engine/scenes/tests/world_gen_lab/world_gen_lab_proof.gd b/src/game/engine/scenes/tests/world_gen_lab/world_gen_lab_proof.gd index 7b4cfbc5..701ff316 100644 --- a/src/game/engine/scenes/tests/world_gen_lab/world_gen_lab_proof.gd +++ b/src/game/engine/scenes/tests/world_gen_lab/world_gen_lab_proof.gd @@ -12,28 +12,8 @@ const CELL_H: int = 10 const MARGIN: Vector2i = Vector2i(20, 40) const OUTPUT_DIR: String = "user://screenshots/world_gen_lab" -const TERRAIN_COLORS: Dictionary = { - "ocean": Color(0.05, 0.10, 0.35), - "deep_ocean": Color(0.02, 0.05, 0.25), - "coast": Color(0.25, 0.45, 0.75), - "lake": Color(0.15, 0.65, 0.75), - "inland_sea": Color(0.10, 0.30, 0.60), - "grassland": Color(0.30, 0.65, 0.20), - "plains": Color(0.60, 0.70, 0.25), - "forest": Color(0.10, 0.40, 0.10), - "jungle": Color(0.20, 0.70, 0.15), - "boreal_forest": Color(0.15, 0.40, 0.35), - "enchanted_forest": Color(0.30, 0.55, 0.60), - "desert": Color(0.85, 0.75, 0.40), - "tundra": Color(0.70, 0.75, 0.72), - "snow": Color(0.92, 0.94, 0.96), - "ice": Color(0.80, 0.88, 0.95), - "mountains": Color(0.45, 0.42, 0.40), - "hills": Color(0.55, 0.45, 0.30), - "swamp": Color(0.30, 0.35, 0.15), - "volcano": Color(0.75, 0.15, 0.10), - "land": Color(0.50, 0.50, 0.30), -} +## Biome colour comes from the single source (biome_colors.json) via +## DataLoader.get_biome_color() — no local palette copy (p2-87). var _game_map: RefCounted = null var _captured: bool = false @@ -108,7 +88,7 @@ func _draw() -> void: if offset.x & 1: y += CELL_H * 0.5 draw_rect(Rect2(x, y, CELL_W - 1, CELL_H - 1), - TERRAIN_COLORS.get(tile.biome_id, Color(0.5, 0.0, 0.5))) + DataLoader.get_biome_color(tile.biome_id)) if not tile.river_edges.is_empty(): draw_rect(Rect2(x + CELL_W * 0.3, y + CELL_H * 0.3, 2, 2), Color(0.3, 0.6, 1.0))