let the world renderer hold the simulation by const reference

This commit is contained in:
2026-08-09 13:45:37 +02:00
parent 79650ae211
commit ca49b9dbec
2 changed files with 4 additions and 5 deletions

View File

@@ -109,7 +109,7 @@ QColor statusLightFill(ProductionStatus status, const StatusLightVisuals& sl)
} // namespace } // namespace
WorldRenderer::WorldRenderer(Simulation& sim, const VisualsConfig& visuals, WorldRenderer::WorldRenderer(const Simulation& sim, const VisualsConfig& visuals,
ItemIconCache* itemIcons, const std::string& configDir) ItemIconCache* itemIcons, const std::string& configDir)
: m_sim(sim) : m_sim(sim)
, m_visuals(visuals) , m_visuals(visuals)

View File

@@ -77,7 +77,7 @@ public:
// `itemIcons` is the window-wide per-item icon cache (REQ-UI-ITEM-ICON); not // `itemIcons` is the window-wide per-item icon cache (REQ-UI-ITEM-ICON); not
// owned, must outlive this renderer. `configDir` is used once, to load the // owned, must outlive this renderer. `configDir` is used once, to load the
// per-building world icons. // per-building world icons.
WorldRenderer(Simulation& sim, const VisualsConfig& visuals, WorldRenderer(const Simulation& sim, const VisualsConfig& visuals,
ItemIconCache* itemIcons, const std::string& configDir); ItemIconCache* itemIcons, const std::string& configDir);
~WorldRenderer(); ~WorldRenderer();
@@ -141,9 +141,8 @@ private:
std::optional<QVector2D> entityPosition(entt::entity entity) const; std::optional<QVector2D> entityPosition(entt::entity entity) const;
// Non-const only because EntityAdmin's component accessors are; the renderer // The renderer reads the simulation and never writes it.
// reads the simulation and never writes it. const Simulation& m_sim;
Simulation& m_sim;
const VisualsConfig& m_visuals; const VisualsConfig& m_visuals;
// Per-item icon cache (REQ-UI-ITEM-ICON), shared window-wide and owned by // Per-item icon cache (REQ-UI-ITEM-ICON), shared window-wide and owned by