Refresh selected-building panel when paused player commands drain

This commit is contained in:
2026-07-08 20:45:41 +02:00
parent fef22b9f86
commit e4ea4ca4b4
5 changed files with 47 additions and 0 deletions

View File

@@ -33,6 +33,7 @@
#include "ItemType.h"
#include "LayoutDialogRequestedEvent.h"
#include "ModulesConfig.h"
#include "PlayerCommandsAppliedEvent.h"
#include "RecipeSelectionDialog.h"
#include "RecipeSelectionRequestedEvent.h"
#include "Rotation.h"
@@ -560,6 +561,21 @@ const ShipDef* SelectedBuildingPanel::findShipDef(const std::string& id) const
}
void SelectedBuildingPanel::handleEvent(std::shared_ptr<const TickAdvancedEvent> /*event*/)
{
refreshSelectionDisplay();
}
void SelectedBuildingPanel::handleEvent(
std::shared_ptr<const PlayerCommandsAppliedEvent> /*event*/)
{
// Player commands (e.g. choosing a shipyard schematic) are applied by a
// queued drain, not synchronously. When the game is paused no tick advances,
// so TickAdvancedEvent never fires; refresh here too, otherwise the panel
// would not reflect the change until the next tick or a re-selection.
refreshSelectionDisplay();
}
void SelectedBuildingPanel::refreshSelectionDisplay()
{
if (m_selectedEntity.has_value())
{