From 317d96435f2907af082aa83878b6ea44898626f3 Mon Sep 17 00:00:00 2001 From: mortenlyhr Date: Mon, 23 Nov 2026 09:17:48 +0100 Subject: [PATCH] City bars: forget last frame's bars when none are drawn drawOverlay cleared the city bars' rectangles only after its early return, so on the city screen (or with the banners or cities off, or on the globe) cityBarAt kept matching the bars of the last map frame: a click on the plots where a city's bar had been went to the city instead of the plot under it. The rectangles are now cleared before that return. Also takes two notes of earlier behaviour out of comments (the tilt curve's straight line, the river cells' old cost), as CONTRIBUTING asks. Co-Authored-By: Claude Opus 5.5 --- src/render/MapView.cpp | 5 ++--- src/render/MapWindow.cpp | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/render/MapView.cpp b/src/render/MapView.cpp index bae1b95..d435adc 100644 --- a/src/render/MapView.cpp +++ b/src/render/MapView.cpp @@ -2779,8 +2779,7 @@ float4 PSWater(WaterOut i) : SV_Target return; // A river piece's triangles where they lie on the map, and for each cell of a grid // over them the triangles that reach into it (in their order): a point is tested - // against those only. (Every triangle for every point of every tree near a river - // took most of a second whenever an improvement or a road changed.) + // against those only. struct RiverCells { std::vector corners; // (placed) @@ -4984,6 +4983,7 @@ float4 PSWater(WaterOut i) : SV_Target // production bars and what is being built where the active player may see them. void MapView::drawOverlay(Overlay& overlay) { + m->cityBars.clear(); if (!m->hasMap || !options.banners || !options.cities || options.cityScreen || m->renderer.globe()) return; const float* vp = m->renderer.viewProjection(); @@ -5105,7 +5105,6 @@ float4 PSWater(WaterOut i) : SV_Target } return &out; }; - m->cityBars.clear(); for (const CityView& c : m->map.cities) { if (options.fog && !m->map.plots[size_t(c.x) + size_t(c.y) * size_t(m->map.width)].revealed) diff --git a/src/render/MapWindow.cpp b/src/render/MapWindow.cpp index 0ba01cd..94e6939 100644 --- a/src/render/MapWindow.cpp +++ b/src/render/MapWindow.cpp @@ -306,8 +306,7 @@ namespace oc4::render // against the plot it looks at, 19 zoom levels, within 0.15 degrees): level at about // CAMERA_LOWER_PITCH + 1.8 (29.8) up to 1.3 x CAMERA_MIN_DISTANCE (910), then easing in // quadratically with the distance to straight down at 0.86 x CAMERA_SMALLEST_MAX_DISTANCE - // (6020). At the start distance (2200) that is 33.6 degrees above the ground; a straight - // line from 28 at 700 to 90 at 7000 gave 42.8, looking down far more steeply. + // (6020). At the start distance (2200) that is 33.6 degrees above the ground. void updatePitch() { if (cityView)