2026-04-10 14:58:03 +02:00
|
|
|
namespace Chessistics.Engine.Model;
|
|
|
|
|
|
|
|
|
|
public class DemandState
|
|
|
|
|
{
|
|
|
|
|
public DemandDef Definition { get; }
|
|
|
|
|
public int ReceivedCount { get; set; }
|
2026-04-16 21:22:49 +02:00
|
|
|
public int MissionIndex { get; }
|
2026-04-10 14:58:03 +02:00
|
|
|
|
2026-04-16 21:22:49 +02:00
|
|
|
public DemandState(DemandDef definition, int missionIndex = 0)
|
2026-04-10 14:58:03 +02:00
|
|
|
{
|
|
|
|
|
Definition = definition;
|
2026-04-16 21:22:49 +02:00
|
|
|
MissionIndex = missionIndex;
|
2026-04-10 14:58:03 +02:00
|
|
|
ReceivedCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsSatisfied => ReceivedCount >= Definition.Amount;
|
|
|
|
|
public Coords Position => Definition.Position;
|
|
|
|
|
public string Name => Definition.Name;
|
|
|
|
|
public CargoType Cargo => Definition.Cargo;
|
|
|
|
|
public int Required => Definition.Amount;
|
|
|
|
|
public int Deadline => Definition.Deadline;
|
Add QuickSave/QuickLoad with full state restore and visual rebuild
BoardState.CaptureSave/RestoreFromSave deep-copy every mutable field
(grid, pieces, demands, transformers, buffers, stock, campaign progress)
into a WorldSave slot. GameSim.QuickSave/QuickLoad expose slotted saves
and emit StateSavedEvent / StateRestoredEvent — the latter carries a
fresh BoardSnapshot so the presentation can rebuild board, pieces,
trajectories, objectives, stock, camera, and control bar in one pass.
F5/F9 trigger it in Main; harness gains quick_save/quick_load commands so
UI tests can checkpoint a scenario and resume without replaying from
scratch. Seven xUnit tests cover the roundtrip (including independence
from post-save mutations, campaign state, and multi-slot isolation).
2026-04-17 22:10:06 +02:00
|
|
|
|
|
|
|
|
public DemandState Clone()
|
|
|
|
|
{
|
|
|
|
|
return new DemandState(Definition, MissionIndex) { ReceivedCount = ReceivedCount };
|
|
|
|
|
}
|
2026-04-10 14:58:03 +02:00
|
|
|
}
|