move the two item visitors to the queries they always were
forEachEmergingItem and forEachIncomingItem took a const FactoryState& and touched no member of BuildingSystem: they read the state and the free geometry helpers and nothing else. They are queries wearing a system's uniform, and their one caller -- the renderer -- reached through getBuildings() to call them, passing the state back in as an argument. They move to FactoryQueries beside the rest of the read surface, and the renderer calls them directly. With that, BuildingSystem answers no queries at all: its const accessor on Simulation and on ArenaSimulation had no other user, so both are gone. Nothing outside the command path can now reach the system. No behaviour changes; the bodies move verbatim apart from two arrows in comments that were non-ASCII. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include <QPoint>
|
||||
#include <QPointF>
|
||||
#include <QRectF>
|
||||
#include <QVector2D>
|
||||
|
||||
@@ -83,6 +85,18 @@ std::vector<BuildingId> buildingsInBox(const FactoryState& state,
|
||||
// single-cell tile. Shared by the placement preview and the selection highlight.
|
||||
TunnelTileMap collectTunnelTiles(const FactoryState& state);
|
||||
|
||||
// Visits every item currently emerging from a building output port on its virtual output
|
||||
// belt (REQ-MAT-OUTPUT-EMERGE), passing the item type and its world-space centre (in tile
|
||||
// units). Least-progressed first (drawn bottom) so callers can paint in visit order
|
||||
// (REQ-GW-TILE-SIZE ordering).
|
||||
void forEachEmergingItem(const FactoryState& state,
|
||||
const std::function<void(const ItemType&, QPointF)>& visit);
|
||||
|
||||
// Visits every item currently travelling inward on a building input port's virtual input
|
||||
// belt (REQ-MAT-INPUT-INTAKE), in the same form and the same order.
|
||||
void forEachIncomingItem(const FactoryState& state,
|
||||
const std::function<void(const ItemType&, QPointF)>& visit);
|
||||
|
||||
// The tiles of the belt-subsystem buildings among the given ids, in the order the ids
|
||||
// arrive; anything else in the selection is skipped, as are construction sites, whose
|
||||
// tiles the belt subsystem does not know yet (REQ-BLD-SITE-CONFIG). Shared by the panel's
|
||||
|
||||
Reference in New Issue
Block a user