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

+31
View File
@@ -518,4 +518,35 @@ public static class Projection
Highlights = report.Highlights,
};
}
/// <summary>Quadro del mercato globale per la compagnia della sessione (MarketOutlook, ADR 0015).</summary>
public static MarketReport Market(World w, CompanyId company)
{
var report = MarketOutlook.Build(w, company);
var trading = report.Trading;
return new MarketReport
{
Day = report.Day,
Index = (float)report.Index,
IndexChange = (float)report.IndexChange,
Goods = report.Goods.Select(g => new GoodMarketInfo
{
Good = g.Good, Available = g.Available, Price = g.Price, Change = (float)g.Change,
SupplyMonth = g.SupplyMonth, DemandMonth = g.DemandMonth, WorldSupplyMonth = g.WorldSupplyMonth, WorldDemandMonth = g.WorldDemandMonth,
StockUnits = g.StockUnits, StockMonths = (float)g.StockMonths,
History = g.History.Select(p => new PricePointInfo { Day = p.Day, Price = p.Price }).ToList(),
Forecast = g.Forecast.Select(f => new ForecastInfo { Months = (byte)f.Months, Price = f.Price, Low = f.Low, High = f.High }).ToList(),
SellPlaces = g.SellPlaces.Select(p => new SellPlaceInfo { Kind = (byte)p.Kind, Target = p.Target, Price = p.Price, Line = p.Line.Value }).ToList(),
}).ToList(),
Hubs = report.Hubs.Select(h => new HubMarketInfo
{
Hub = h.Hub.Value, Kind = (byte)h.Kind, MonthlyCapacity = h.MonthlyCapacity, Duty = (float)h.Duty, UsedThisMonth = h.UsedThisMonth, Line = h.Line.Value,
}).ToList(),
EventGood = report.Event.Good, EventShock = (float)report.Event.Shock, EventMonths = (float)report.Event.Months,
TradingUnlocked = trading.Unlocked, TradingTier = (byte)trading.Level, TradingProgress = (float)trading.Fraction,
NetWorth = trading.NetWorth, NetWorthRequired = trading.NetWorthRequired, TownsConnected = trading.TownsConnected,
TownsRequired = trading.TownsRequired, TownPopulation = trading.TownPopulation, Rating = trading.Rating.ToString(),
RatingRequired = trading.RatingRequired.ToString(), RatingMet = trading.RatingMet,
};
}
}