Files
Rail_Enterprise/src/ViaFerrea.Protocol/Messages/MessageCodec.cs
T
Claude 7879ac502d F5: manutenzione delle industrie, livelli, borsa e scalate, agenti IA
- Sezione 11: usura e recupero degli impianti, fermi e incidenti, ricambi e macchinari come
  domanda esplicita (treno, trasporto locale, trasbordo nel bacino), revisione e ammodernamento,
  acquisto delle industrie dal livello 3, conguaglio mensile con il proprietario (ADR 0011).
- Livelli della compagnia con soglie ritarate e ritaratura economica misurata con le IA.
- Sezione 12.2–12.3: libro dei soci, prezzo con sentiment, quotazione, riacquisto, dividendi,
  controllo e fusione (comando 39), offerte pubbliche con difese, esiti per difficoltà,
  aste delle IA fallite, nuovi concorrenti, fine partita e Cronaca finale (ADR 0012).
- Sezione 12.1: agenti IA con candidati, Dijkstra sulle celle, TrackPreview e ROI, tre
  personalità, linee dei ricambi, rimedio agli stalli, borsa (ADR 0013).
- Salvataggio versione 3, protocollo (messaggi 126–128, blocchi di estensione), server,
  simulate --trace-ai; test di 14.5 su IA e borsa e accettazione F5 (120 test).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
2026-10-12 10:36:31 +00:00

42 lines
2.0 KiB
C#

namespace ViaFerrea.Protocol.Messages;
/// <summary>Decodifica per id: l'unico punto in cui un id diventa un tipo.</summary>
public static class MessageCodec
{
public static IMessage Read(MessageId id, ref SpanReader r) => id switch
{
MessageId.Hello => Hello.Read(ref r),
MessageId.Ping => Ping.Read(ref r),
MessageId.Subscribe => Subscribe.Read(ref r),
MessageId.RequestDetail => RequestDetail.Read(ref r),
MessageId.Command => CommandMessage.Read(ref r),
MessageId.SetSpeed => SetSpeed.Read(ref r),
MessageId.ListSaves => ListSaves.Read(ref r),
MessageId.Save => Save.Read(ref r),
MessageId.Load => Load.Read(ref r),
MessageId.NewGame => NewGame.Read(ref r),
MessageId.Welcome => Welcome.Read(ref r),
MessageId.Reject => Reject.Read(ref r),
MessageId.Pong => Pong.Read(ref r),
MessageId.MapChunk => MapChunk.Read(ref r),
MessageId.EntitySnapshot => EntitySnapshot.Read(ref r),
MessageId.EntityDelta => EntityDelta.Read(ref r),
MessageId.TrackWorks => TrackWorks.Read(ref r),
MessageId.TrainMotion => TrainMotion.Read(ref r),
MessageId.DailyDigest => DailyDigest.Read(ref r),
MessageId.MaintenanceAlert => MaintenanceAlert.Read(ref r),
MessageId.EmploymentReport => EmploymentReport.Read(ref r),
MessageId.MaintenanceCard => MaintenanceCard.Read(ref r),
MessageId.WorkshopRegister => WorkshopRegister.Read(ref r),
MessageId.CompanyCard => CompanyCard.Read(ref r),
MessageId.IndustryCard => IndustryCard.Read(ref r),
MessageId.Chronicle => Chronicle.Read(ref r),
MessageId.MarketTape => MarketTape.Read(ref r),
MessageId.CommandResult => CommandResultMessage.Read(ref r),
MessageId.Notification => Notification.Read(ref r),
MessageId.Newspaper => Newspaper.Read(ref r),
MessageId.SaveList => SaveList.Read(ref r),
_ => throw new ProtocolException($"messaggio sconosciuto: {(ushort)id}"),
};
}