3 Commits

Author SHA1 Message Date
92ab1dab54 Fix recipe button unclickable on construction site during play
A selected construction site rebuilt the entire panel on every
TickAdvancedEvent (~30x/s at 1x), because refreshSelectionDisplay() called
rebuild() for sites. Each rebuild runs buildSingle() -> hideAllWidgets(),
which hides and re-shows the recipe-select button. Hiding a QPushButton
mid-press clears its pressed state, so a rebuild landing between the user's
mouse press and release cancelled the click. While paused no tick advances,
so no rebuild occurred and the button worked -- matching the report.

Give sites a lightweight per-tick refresh that updates only the progress
label, mirroring refreshBuffers() for live buildings. The site progress
block is extracted from buildSingle() into refreshSiteProgress() (no
duplicated arithmetic). refreshSelectionDisplay() now takes a RefreshReason:
a PeriodicTick updates progress only, while a CommandApplied still rebuilds
so a site's newly chosen recipe/layout is reflected. The site -> completed
building transition remains handled by the existing "(Building) " title
branch.

No UI test added: the test target links only lib (no QtWidgets), per the
simulation/presentation split, so a widget-level test does not fit the
harness.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DyCu8vwChKMbLJQ3xosYEN
2026-07-08 20:36:42 +02:00
94b5d941ba Refresh selected-building panel when paused player commands drain
Option A made the per-tick refresh authoritative for the shipyard layout
preview and Configure Layout button, but that path is driven by
TickAdvancedEvent, which only fires while the game is running. Choosing a
schematic while paused therefore still left the widgets hidden until the
game was unpaused or the building re-selected, because the queued
SetRecipeCommand drains on the next frame but no tick advances.

Emit a new PlayerCommandsAppliedEvent from GameWorldView::onFrame once per
frame when queued commands were drained, and have SelectedBuildingPanel
refresh its selection display in response. This is a presentation-only
notification: it is emitted only on the live path (not during replay
playback), touches neither the command queue nor the simulation, and its
only handler never enqueues commands -- so replay recording and
determinism are unaffected.

Factor the former TickAdvancedEvent handler body into
refreshSelectionDisplay() and call it from both handlers to avoid
duplication.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DyCu8vwChKMbLJQ3xosYEN
2026-07-08 20:36:41 +02:00
53af44db04 Fix shipyard layout preview/button not showing until re-selection
Selecting a ship schematic in the shipyard left the layout preview and
Configure Layout button hidden until the building was deselected and
re-selected.

The recipe change is applied via a queued command that only drains on a
later frame, so the immediate rebuild() in onSelectRecipeClicked() still
saw the old (empty) recipe and hid both widgets. The per-tick
refreshBuffers() path then updated the preview's data but never set its
visibility -- that was only ever done in buildSingle() -- so the widgets
stayed hidden until a re-selection re-ran buildSingle().

Extract the shipyard preview/button show-hide-and-populate logic into
updateShipyardLayoutWidgets() and call it from both buildSingle() and
refreshBuffers(), so the per-tick refresh becomes authoritative for
visibility and the widgets appear on the first tick after the command
drains.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DyCu8vwChKMbLJQ3xosYEN
2026-07-08 20:36:41 +02:00

Diff Content Not Available