F6: tooltip perché sui valori calcolati dal server

Ogni valore importante dei pannelli spiega al passaggio del mouse da dove
viene: formula, termini con i valori di oggi e note, calcolati dal Core e
mandati dal server, perché il client non deve rifare né ricomporre formule.

- Core: modello comune Explanation ed Explanations, pure funzioni che
  chiamano le stesse funzioni del motore; estratte senza cambiare
  l'aritmetica (hash invariati) Market.NextPrice e LocalPriceTerms,
  Tariffs.FreightTerms e PassengerTerms, TownSystem.GrowthOf,
  Fleet.DailyHazard, GameClock.YearsAt; Industry.LastEfficiency
  transitorio (né salvato né nell'hash).
- Protocollo: RequestDetail kind 11 con un blocco 1 (subject, arg) ed
  ExplanationReport 137; il server risponde sempre, anche con available
  falso. Nessun campo nei delta, formato dei salvataggi invariato.
- Client: WhyTooltip comune (palette 05, apertura dopo 0,45 s, «in
  arrivo…» finché la spiegazione manca) su barra superiore, Mercato,
  Scalata, Finanze, scheda industria, Treni e Officine; testi in
  strings.csv.
- ADR 0024, PROTOCOL.md, ARCHITECTURE.md, STATE.md; 10 test nuovi in
  Economy/ExplanationTests.cs con uguaglianza esatta ai valori del motore.

Refs #44.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-08 15:14:57 +01:00
1 parent 767661957b
commit 19a3dd3af1
33 files changed
+2089 -64

No files matched your search

@@ -120,22 +120,7 @@ public sealed class FleetMaintenanceSystem : ISimSystem
{
var w = ctx.World;
var m = w.Data.Maintenance;
double best = -1;
Vehicle? bv = null;
int bc = -1;
foreach (var id in t.Vehicles)
{
var v = w.Vehicles[id.Value];
for (int j = 0; j < v.Components.Length; j++)
{
double h = Fleet.Hazard(v.Components[j], m.Failure);
if (ctx.Day < v.HazardReducedUntilDay) h *= m.Inspection.HazardFactor;
if (h <= best) continue;
best = h;
bv = v;
bc = j;
}
}
var (best, bv, bc) = Fleet.DailyHazard(w, t, ctx.Day);
if (bv is null) return;
var rng = w.Stream("fleet");
if (rng.NextDouble() >= best) return;