Use std::optional instead of sentinel values for absent data

This commit is contained in:
2026-07-20 20:27:20 +02:00
parent 1cdafb7bcd
commit 9622fa4345
32 changed files with 228 additions and 209 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <optional>
#include <QPoint>
#include "BuildingId.h"
@@ -25,8 +27,8 @@ struct SimulationTestAccess
static BuildingSystem& buildings(Simulation& sim) { return sim.getBuildingsMutable(); }
static BeltSystem& belts(Simulation& sim) { return sim.getBeltsMutable(); }
static BuildingId place(Simulation& sim, BuildingType type, QPoint anchor,
Rotation rotation)
static std::optional<BuildingId> place(Simulation& sim, BuildingType type,
QPoint anchor, Rotation rotation)
{
return sim.tryPlaceBuilding(type, anchor, rotation);
}