fix issue where building stats don't update while the building is kept selected

This commit is contained in:
2026-04-20 21:52:39 +02:00
parent df3ef46367
commit 507b5d1e3a
3 changed files with 24 additions and 0 deletions

View File

@@ -188,6 +188,11 @@ void SelectedBuildingPanel::buildSingle(EntityId id)
m_clearBeltBtn->hide();
}
refreshBuffers(b);
}
void SelectedBuildingPanel::refreshBuffers(const Building* b)
{
QString bufText;
if (!b->inputBuffer.counts.empty())
{
@@ -221,6 +226,18 @@ void SelectedBuildingPanel::buildSingle(EntityId id)
m_buffersLabel->setText(bufText);
}
void SelectedBuildingPanel::onStateUpdated(Tick /*tick*/, int /*blocks*/, double /*speed*/)
{
if (m_singleId == kInvalidEntityId) { return; }
const Building* b = m_sim->buildings().findBuilding(m_singleId);
if (!b)
{
buildEmpty();
return;
}
refreshBuffers(b);
}
void SelectedBuildingPanel::buildMulti(const std::vector<EntityId>& ids)
{
m_singleId = kInvalidEntityId;