F4: protocollo e client per manutenzione e impieghi, ADR 0010, stato dei lavori

- Protocollo: riepilogo di manutenzione nei record (blocco 1), RequestDetail, MaintenanceCard,
  WorkshopRegister, EmploymentReport con depositi, motivi e convenzioni, MaintenanceAlert.
- Server: dettagli su richiesta, avvisi dalla manutenzione, registro dopo le convenzioni.
- Client: pannelli Officine (cartella di manutenzione, Registro officina, scorta di ricambi,
  avvisi, mappa di calore) e Impieghi (Registro degli impieghi con convenzioni); schede
  di treno, industria e città aggiornate; pilota automatico con le nuove schermate.
- ADR 0010, PROTOCOL, ARCHITECTURE e STATE aggiornati; 102 test verdi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
This commit is contained in:
Claude committed 2026-10-02 01:54:58 +00:00
1 parent b6c326b79c
commit d285a38664
28 files changed
+1618 -64

No files matched your search

@@ -20,6 +20,7 @@ public static class ProtocolTests
yield return new Subscribe { X0 = -3, Y0 = 4, X1 = 300, Y1 = 200, Lod = 1 };
yield return new CommandMessage { Seq = 99, Command = new BuildStationCommand(P, 3, "Stazione Nord") };
yield return new SetSpeed { Speed = 4 };
yield return new RequestDetail { Kind = DetailKind.Workshop, Target = 3 };
yield return new ListSaves();
yield return new Save { Name = "partita è bella" };
yield return new Load { SaveId = "auto-0003" };
@@ -61,8 +62,39 @@ public static class ProtocolTests
{
Industry = 2, JobsWorkers = 40, JobsStaff = 2, WorkersPresent = 39.5f, StaffPresent = 2, Reason = "capacità delle carrozze insufficiente",
Sources = [new EmploymentSource { Town = 1, HomeStation = 3, Line = 1, Category = 0, Headcount = 28, Coverage = 0.97f }],
Kind = 1, WorkersReason = 5, StaffReason = 4, WorkersReasonLine = 2, StaffReasonLine = -1,
},
],
Agreements =
[
new AgreementInfo
{
Id = 4, Industry = 2, Carrier = 0, SeatsPerDay = 28, MonthlyFee = new Money(70000), State = 1, ProposedDay = 300,
StartDay = 310, EndDay = 1030, Coverage = 0.95f, ShortDays = 2,
},
],
};
yield return new MaintenanceCard
{
Train = 12, Day = 400, Condition = 38.5f, Status = TrainMaintenanceStatus.Booked, Policy = 1, PolicyOverride = 2, Reserve = false,
Failure = 1, FailedVehicle = 6, FailedComponent = "brakes", RescueHours = 2.5f, NextIntervention = "service", NextDueDays = -3.5f,
PlannedIntervention = "repair_minor", MaintenanceDepot = 1, ServiceKmPerDay = 195, CostThisYear = new Money(123400),
CostLastYear = new Money(98700), FailuresThisYear = 2, FailuresTotal = 5, CoveredBy = 14, Covering = -1,
Vehicles =
[
new VehicleCard
{
Vehicle = 6, Type = "loco_steam_1850", OdometerKm = 45000, AgeYears = 3.5f, AgeFactor = 1,
Components = [new ComponentCard { Component = "engine", Condition = 61.2f, WearPerDay = 0.8f }, new ComponentCard { Component = "brakes", Condition = 38.5f, WearPerDay = 1.1f }],
},
],
History = [new MaintenanceRecordInfo { Day = 350, Intervention = "inspection", Cost = new Money(9000), Depot = 1, Parts = 0 }],
};
yield return new WorkshopRegister
{
Depot = 1, Day = 400, Stalls = 4, JobsStaff = 16, StaffPresent = 12.5f, WorkRate = 0.8f, SpareParts = 7, PartsTarget = 40, PartsReserved = 3,
Jobs = [new WorkshopJobInfo { Train = 12, Intervention = "service", InStall = true, Started = true, Progress = 1.6f, Days = 3, Parts = 3, QueuedDay = 398 }],
Booked = [new WorkshopJobInfo { Train = 13, Intervention = "inspection", Days = 1, QueuedDay = -1 }],
};
yield return new MarketTape
{
@@ -105,16 +137,24 @@ public static class ProtocolTests
private static EntityLists SampleEntities() => new()
{
Companies = [new CompanyInfo { Id = 0, Name = "Società", Color = "#b3573e", IsPlayer = true, Cash = new Money(100), NetWorth = new Money(200), Rating = "A", Tier = 2 }],
Companies = [new CompanyInfo { Id = 0, Name = "Società", Color = "#b3573e", IsPlayer = true, Cash = new Money(100), NetWorth = new Money(200), Rating = "A", Tier = 2, MaintenancePolicy = 2 }],
Towns = [new TownInfo { Id = 0, Name = "Valdoria", Position = P, Population = 12400, RadiusCells = 4.5, Satisfaction = 0.6f, Services = 3 }],
Industries = [new IndustryInfo { Id = 1, Type = "steel_mill", Name = "Acciaieria", Position = P, FootprintCells = 4, Level = 2, Efficiency = 0.83f, Condition = 97, Owner = -1 }],
Hubs = [new HubInfo { Id = 0, Kind = "port", Name = "Porto", Position = P }],
Nodes = [new NodeInfo { Id = 3, Position = P, HeightM = 120.5, Owner = 0, Station = 1, Depot = -1, Edges = [1, 4] }],
Stations = [new StationInfo { Id = 1, Owner = 0, Name = "Acciaieria", Node = 3, Position = P, Platforms = 4, WaitingUnits = 30, Industries = [1], Towns = [0] }],
Depots = [new DepotInfo { Id = 0, Owner = 0, Name = "Deposito", Node = 5, Position = P, Size = "small" }],
Lines = [new LineInfo { Id = 0, Owner = 0, Name = "Linea 1", Color = "#e0a526", Stops = [new LineStop(new StationId(1)), new LineStop(new StationId(2), WaitFull: true, MaxWaitDays: 2)] }],
Depots = [new DepotInfo { Id = 0, Owner = 0, Name = "Deposito", Node = 5, Position = P, Size = "small", Stalls = 2, JobsStaff = 8, StaffPercent = 75, SpareParts = 9, PartsTarget = 40, Jobs = 1, WaitingParts = true }],
Lines = [new LineInfo { Id = 0, Owner = 0, Name = "Linea 1", Color = "#e0a526", Stops = [new LineStop(new StationId(1)), new LineStop(new StationId(2), WaitFull: true, MaxWaitDays: 2)], Policy = 0 }],
Vehicles = [new VehicleInfo { Id = 7, Owner = 0, Type = "wagon_hopper", Depot = -1, Train = 2, Condition = 99.5f }],
Trains = [new TrainInfo { Id = 2, Owner = 0, Name = "Treno 12", Line = 0, State = 3, Vehicles = [6, 7], MaxSpeedKmh = 60, LengthM = 27, Load = 20, Capacity = 20 }],
Trains =
[
new TrainInfo
{
Id = 2, Owner = 0, Name = "Treno 12", Line = 0, State = 3, Vehicles = [6, 7], MaxSpeedKmh = 60, LengthM = 27, Load = 20, Capacity = 20,
Condition = 41, Maintenance = TrainMaintenanceStatus.MinorFailure, Reserve = true, Policy = 2, NextIntervention = "inspection",
NextDueDays = -2, MaintenanceDepot = 0,
},
],
};
/// <summary>Un esemplare per ogni tipo di comando, con campi non predefiniti.</summary>