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

@@ -21,6 +21,15 @@ public static class ProtocolTests
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 RequestDetail { Kind = DetailKind.Explain, Target = 2, Subject = (byte)ExplainSubject.LocalPrice, Arg = 7 };
yield return new ExplanationReport
{
Day = 412, Subject = (byte)ExplainSubject.GlobalPrice, Target = 2, Arg = -1, Available = true, Title = "Prezzo globale", Name = "Carbone",
Value = 1234.5678, Unit = (byte)ExplainUnit.Price, ValueText = "", Formula = "Pg = α·Pg′ + (1 − α)·Pg₋₁",
Terms = [new ExplanationTermInfo { Symbol = "Pg′", Label = "Prezzo obiettivo", Value = 1250.25, Unit = (byte)ExplainUnit.Price },
new ExplanationTermInfo { Symbol = "gradino", Label = "Gradino sopra", Value = 0, Unit = (byte)ExplainUnit.Text, Text = "AA" }],
Notes = ["D e S comprendono gli scambi con il resto del mondo."],
};
yield return new ListSaves();
yield return new Save { Name = "partita è bella" };
yield return new Load { SaveId = "auto-0003" };