move the placement rules and the config-dependent queries off BuildingSystem
isPlacementValid, findRotateInPlaceTarget and the bodyCellsWithinWorldBounds helper become PlacementRules.h — where a building may go and what already sits on those tiles, answered from the factory state and the config. getInputPorts and getSiteSplitterInfo join FactoryQueries.h, whose header comment now says plainly that the last two also take the config because answering them means reading a building definition. computeInputPorts goes to PortGeometry.h alongside outputBodyTile/inputBodyTile: it needs only Port and QPoint, so it belongs in core rather than in sim. BuildingSystem is left with no query that reads the factory — its remaining const methods are the emerging/incoming item walks, the checksum fold, and the buffer initialisers. It changes the factory now; it no longer describes it. Verified with a golden-checksum capture before and after — all four sample ticks identical. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHcUerKAZKWNvSKJxYKbnG
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "Simulation.h"
|
||||
|
||||
#include "FactoryQueries.h"
|
||||
#include "PlacementRules.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@@ -860,7 +861,7 @@ std::optional<BuildingId> Simulation::tryPlaceBuilding(BuildingType type, QPoint
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!m_buildingSystem->isPlacementValid(type, anchor, rotation))
|
||||
if (!isPlacementValid(m_factoryState, m_config, type, anchor, rotation))
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user