Replace sentinel values that signalled "no value" with std::optional
across simulation, UI, and balancing code:
- BuildingId references: DeliverScrapBehavior::deliveryBay,
Simulation::m_hqBuildingId, the return types of BuildingSystem::place
and Simulation::tryPlaceBuilding (previously kInvalidBuildingId on
failure), GameWorldView building/site-at-tile lookups and demolish
hover, SelectedBuildingPanel::m_singleBuildingId.
- Command id fields: the five id-carrying commands now hold
optional<BuildingId>; CommandSerializer and Simulation::apply updated.
The serialized replay format is unchanged.
- Index sentinels: BlueprintPanel::m_activeIndex,
BalancingWindow::m_inspectedArenaIndex, ArenaSimulation winnerTeam,
and the moduleIndex grid cells in ShipLayoutDialog/ShipLayoutPreview.
ShipLayoutDialog::m_activeModuleIndex was a tri-state, so it is
modelled as bool m_removeMode + optional<int>.
Building/ConstructionSite id defaults keep kInvalidBuildingId (identity,
not an absent reference); entt::null and config -1 domain values are
left as-is.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y7N59FsLA5e2kuVdqe4Uhc