// The visibility phases, wired to the save shapes. // // Three phases of the turn touch the per-system visibility cluster, in two different // drivers, and they are listed here together because they share one input -- the system's // active-presence mask -- and nothing else in the turn reads it. // // S29 the system's own last-observed stamp // T17 the per-(system, player) observation record // T21 the explored sweep // // The mask itself is READ FROM THE SAVE and never rebuilt. The original recomputes it on // every fleet arrival and departure, which the standalone does not model; but neither // reference pair moves a mask leaf, so the loaded value is the value these phases would // see, and rebuilding it from an unmodelled movement pass would be a change with no // evidence behind it. When that stops being true it will show up as a regression here // first, which is the point of saying it out loud. #pragma once #include #include #include "mars/stream/shapes.h" namespace sots::app { // What one visibility phase did, in the terms the run log prints. struct VisibilityPhaseResult { int systemsVisited = 0; // systems the phase looked at int systemsTouched = 0; // systems where something moved int leafWrites = 0; // save leaves this phase changed std::vector notes; }; // S29: `ltis`, the system's own last-observed turn. Written on every system some player can // currently see; left alone on the rest. VisibilityPhaseResult RunSystemObservedStamp(mars::stream::shapes::SaveGame& game); // T21: the explored sweep -- every player who can see a system has now surveyed it. VisibilityPhaseResult RunExploredSweep(mars::stream::shapes::SaveGame& game); // T17: the per-(system, player) observation record. VisibilityPhaseResult RunObservationRecords(mars::stream::shapes::SaveGame& game); // The encounter parked at a system, as this model can recover it. // // The field the original reads is a star-system member that is NOT serialised: it is set // once when the map is generated and never moves. The only observable that carries the same // id is the encounter fleet sitting at the system, so that is what this reads -- and it is a // HYPOTHESIS, not a reading. It agrees with the original on all six encounter fleets in the // corpus and no save can separate it from the true rule, because no save kills an encounter // while leaving its system visible. Returns -1 when there is none. std::int32_t EncounterAtSystem(const mars::stream::shapes::SaveGame& game, std::int32_t systemId); } // namespace sots::app