migrate every factory query off BuildingSystem onto the free functions

This commit is contained in:
2026-08-05 06:45:49 +02:00
parent 1fb63cce4e
commit 58b94223f7
20 changed files with 212 additions and 244 deletions

View File

@@ -1,4 +1,5 @@
#include "MainWindow.h"
#include "FactoryQueries.h"
#include <map>
#include <random>
@@ -277,9 +278,9 @@ void MainWindow::handleEvent(std::shared_ptr<const LayoutDialogRequestedEvent> e
{
// A construction site has no Building yet; fall back to its site record so
// the shipyard layout can be configured before it is built (REQ-BLD-SITE-CONFIG).
const Building* b = m_sim->getBuildings().findBuilding(event->shipyardId);
const Building* b = findBuilding(m_sim->getFactoryState(), event->shipyardId);
const ConstructionSite* s =
b ? nullptr : m_sim->getBuildings().findSite(event->shipyardId);
b ? nullptr : findSite(m_sim->getFactoryState(), event->shipyardId);
if (!b && !s)
{
return;
@@ -304,9 +305,9 @@ void MainWindow::handleEvent(std::shared_ptr<const RecipeSelectionRequestedEvent
// A construction site has no Building yet; fall back to its site record so
// the recipe/schematic can be chosen before it is built (REQ-BLD-SITE-CONFIG).
const Building* b = m_sim->getBuildings().findBuilding(event->buildingId);
const Building* b = findBuilding(m_sim->getFactoryState(), event->buildingId);
const ConstructionSite* s =
b ? nullptr : m_sim->getBuildings().findSite(event->buildingId);
b ? nullptr : findSite(m_sim->getFactoryState(), event->buildingId);
if (!b && !s)
{
return;