41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
|
|
namespace Chessistics.Engine.Model;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Deep copy of every mutable field needed to restore a BoardState to an
|
||
|
|
/// earlier point. Used by QuickSave/QuickLoad for rapid iteration during
|
||
|
|
/// UI/UX testing and by the harness to restore checkpoints.
|
||
|
|
///
|
||
|
|
/// Immutable refs (defs, CampaignDef) are shared; mutable state (Pieces,
|
||
|
|
/// DemandState, buffers, stock, campaign progression) is copied by value.
|
||
|
|
/// </summary>
|
||
|
|
public sealed class WorldSave
|
||
|
|
{
|
||
|
|
public int Width { get; init; }
|
||
|
|
public int Height { get; init; }
|
||
|
|
public CellType[,] Grid { get; init; } = new CellType[0, 0];
|
||
|
|
public SimPhase Phase { get; init; }
|
||
|
|
public int TurnNumber { get; init; }
|
||
|
|
public int NextPieceId { get; init; }
|
||
|
|
|
||
|
|
public Dictionary<Coords, ProductionDef> Productions { get; init; } = new();
|
||
|
|
public Dictionary<Coords, int> ProductionBuffers { get; init; } = new();
|
||
|
|
public Dictionary<Coords, DemandState> Demands { get; init; } = new();
|
||
|
|
public Dictionary<Coords, TransformerDef> Transformers { get; init; } = new();
|
||
|
|
public Dictionary<Coords, int> TransformerInputBuffers { get; init; } = new();
|
||
|
|
public Dictionary<Coords, int> TransformerOutputBuffers { get; init; } = new();
|
||
|
|
public List<PieceState> Pieces { get; init; } = new();
|
||
|
|
public List<PieceState> DestroyedPieces { get; init; } = new();
|
||
|
|
public Dictionary<PieceKind, int> RemainingStock { get; init; } = new();
|
||
|
|
public HashSet<Coords> OccupiedCells { get; init; } = new();
|
||
|
|
|
||
|
|
public CampaignSaveData? Campaign { get; init; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public sealed class CampaignSaveData
|
||
|
|
{
|
||
|
|
public int CurrentMissionIndex { get; init; }
|
||
|
|
public List<int> CompletedMissions { get; init; } = new();
|
||
|
|
public HashSet<PieceKind> AvailablePieceKinds { get; init; } = new();
|
||
|
|
public HashSet<PieceUpgrade> AvailableLevels { get; init; } = new();
|
||
|
|
}
|