F6: mercato globale, storico prezzi a 24 mesi e previsione

Prima parte della F6: il pannello «Mercato globale» dell'immagine di
riferimento 06, con i dati calcolati dal server.

- Lo storico dei prezzi globali passa da 360 a 720 giorni. I salvataggi
  con lo storico di un anno si migrano al caricamento allungando la
  finestra (RollingWindow.Extended), senza cambiare formato.
- MarketOutlook (Core) è un'analisi in sola lettura del mondo: storico
  mensile, variazione a 30 giorni, offerta e domanda con la quota
  mondiale, scorte in mesi, indice materie prime, previsione a 4 mesi
  dalla componente mondiale con banda, destinazioni di vendita ordinate
  per prezzo con la linea che le collega, hub, evento in corso e
  avanzamento verso la compravendita in proprio. Parametri nuovi in
  balance.json (market.outlook); interpretazioni nell'ADR 0015.
- Protocollo: DetailKind.Market (7) e MarketReport (129); il server
  risponde su richiesta, il client lo mostra in un pannello a tutto
  schermo e il pilota automatico ne fa la schermata 16_mercato.
- Test: finestra allungata e migrazione, storico mensile, previsione
  deterministica ed entro i limiti, evento, analisi su Valdoria,
  round-trip del messaggio e quadro via WebSocket.

La simulazione non cambia: l'analisi non scrive nel mondo e
l'accettazione F4 dà gli stessi numeri di prima.

Closes #29.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-07 14:25:38 +01:00
1 parent bfbdb6297e
commit 2992e7cc36
29 files changed
+1877 -50

No files matched your search

@@ -125,6 +125,30 @@ public static class ProtocolTests
Records = [new RecordInfo { Title = "Patrimonio massimo", Value = "₤ 1.000.000", Year = 1855 }],
Highlights = ["Fondata nel 1850", "Livello 3 nel 1858"],
};
yield return new MarketReport
{
Day = 720, Index = 104.2f, IndexChange = 0.021f,
Goods =
[
new GoodMarketInfo
{
Good = 8, Available = true, Price = 15200.5, Change = 0.124f, SupplyMonth = 41200, DemandMonth = 52800.25, WorldSupplyMonth = 900,
WorldDemandMonth = 1100.5, StockUnits = 74000, StockMonths = 1.4f,
History = [new PricePointInfo { Day = 689, Price = 14800 }, new PricePointInfo { Day = 720, Price = 15200.5 }],
Forecast = [new ForecastInfo { Months = 1, Price = 15400, Low = 14900, High = 15900 }],
SellPlaces =
[
new SellPlaceInfo { Kind = SellPlaceInfo.Hub, Target = 0, Price = 16100, Line = 6 },
new SellPlaceInfo { Kind = SellPlaceInfo.Industry, Target = 12, Price = 15800, Line = -1 },
],
},
new GoodMarketInfo { Good = 14, Available = false, Price = 9000, StockMonths = -1 },
],
Hubs = [new HubMarketInfo { Hub = 0, Kind = 0, MonthlyCapacity = 1200, Duty = 0.04f, UsedThisMonth = 864, Line = 6 }],
EventGood = 8, EventShock = -0.18f, EventMonths = 5.9f,
TradingUnlocked = false, TradingTier = 2, TradingProgress = 0.58f, NetWorth = new Money(23_200_000), NetWorthRequired = new Money(40_000_000),
TownsConnected = 1, TownsRequired = 2, TownPopulation = 800, Rating = "BBB", RatingRequired = "BB", RatingMet = true,
};
yield return new CommandResultMessage { Seq = 99, Type = (ushort)CommandType.BuildTrack, Error = 10, Message = "Pendenza eccessiva", Created = [1, 2, 3], Tick = 4000 };
yield return new Notification { Event = SampleEvent() };
yield return new Newspaper { Day = 30, Title = "La Cronaca di Valdoria", Articles = [("Nuova linea", "Inaugurata la linea per il valico."), ("Prezzi", "Il carbone sale.")] };