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
This commit is contained in:
13
src/lib/eventsystem/event/PlayerCommandsAppliedEvent.h
Normal file
13
src/lib/eventsystem/event/PlayerCommandsAppliedEvent.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Event.h"
|
||||
|
||||
// Emitted by GameWorldView once per frame after queued player commands have been
|
||||
// drained and applied to the simulation. It lets presentation widgets refresh
|
||||
// even while the game is paused (no tick advances, so no TickAdvancedEvent), for
|
||||
// example so a shipyard's layout preview appears immediately after its schematic
|
||||
// is chosen. It is a UI notification only and never feeds back into the command
|
||||
// queue, so it has no effect on replay recording or determinism.
|
||||
class PlayerCommandsAppliedEvent : public Event
|
||||
{
|
||||
};
|
||||
Reference in New Issue
Block a user