Infrastruttura: nome «Rail Enterprise», CI e rilasci su Gitea, documentazione
Il progetto adotta il nome «Rail Enterprise» ovunque (codice RailEnterprise.*, variabili RE_*, intestazioni RESV/RECL, immagine rail-enterprise-server) per allinearsi al repository Gitea. Aggiunge Gitea Actions sul modello di Chronos: CI su PR e main, rilascio da tag con gioco Windows (client Godot + server in server/), server Windows/Linux e immagine Docker nel registro Gitea, nightly. Aggiunge i riferimenti visivi 06–09, i modelli di PR e issue, l'ADR 0014 e aggiorna README (comandi locali), STATE e CLAUDE.md. 120 test verdi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f6c2a17b4d
commit
c1a0049bcf
300 files changed
+1602
-1045
No files matched your search
@@ -0,0 +1,66 @@
|
||||
using System.Diagnostics;
|
||||
using RailEnterprise.Core.Simulation.Ai;
|
||||
using RailEnterprise.Core.Simulation.Systems;
|
||||
|
||||
namespace RailEnterprise.Core.Simulation;
|
||||
|
||||
/// <summary>
|
||||
/// Sistemi nell'ordine fisso della guida (sezione 4). I sistemi delle fasi successive si
|
||||
/// inseriscono nella loro posizione quando vengono implementati:
|
||||
/// Clock → Commands → Construction → Trains → Signals → Stations (+ trasporto locale)
|
||||
/// → Maintenance → Demand → Commuting → Industries → IndustryMaintenance → Towns → Market
|
||||
/// → Finance → StockMarket → AiAgents → Events → Contracts → Hash.
|
||||
/// </summary>
|
||||
public sealed class SystemPipeline(IReadOnlyList<ISimSystem> systems)
|
||||
{
|
||||
public IReadOnlyList<ISimSystem> Systems { get; } = systems;
|
||||
|
||||
/// <summary>Se attivo, misura il tempo di ogni sistema (diagnostica e bench).</summary>
|
||||
public bool Profile { get; set; }
|
||||
|
||||
/// <summary>Tick totali (Stopwatch) spesi per sistema quando Profile è attivo.</summary>
|
||||
public long[] ElapsedTicks { get; } = new long[systems.Count];
|
||||
|
||||
/// <summary>Byte allocati per sistema quando Profile è attivo.</summary>
|
||||
public long[] AllocatedBytes { get; } = new long[systems.Count];
|
||||
|
||||
public static SystemPipeline CreateDefault() => new(
|
||||
[
|
||||
new ClockSystem(),
|
||||
new CommandSystem(),
|
||||
new ConstructionSystem(),
|
||||
new TrainSystem(),
|
||||
new StationSystem(),
|
||||
new LocalTransportSystem(),
|
||||
new FleetMaintenanceSystem(),
|
||||
new DemandSystem(),
|
||||
new EmploymentSystem(),
|
||||
new IndustrySystem(),
|
||||
new IndustryMaintenanceSystem(),
|
||||
new TownSystem(),
|
||||
new MarketSystem(),
|
||||
new FinanceSystem(),
|
||||
new StockMarketSystem(),
|
||||
new AiSystem(),
|
||||
new HashSystem(),
|
||||
]);
|
||||
|
||||
public void Run(WorldContext ctx)
|
||||
{
|
||||
if (!Profile)
|
||||
{
|
||||
for (int i = 0; i < Systems.Count; i++) Systems[i].Step(ctx);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < Systems.Count; i++)
|
||||
{
|
||||
long bytes = GC.GetAllocatedBytesForCurrentThread();
|
||||
long start = Stopwatch.GetTimestamp();
|
||||
Systems[i].Step(ctx);
|
||||
ElapsedTicks[i] += Stopwatch.GetTimestamp() - start;
|
||||
AllocatedBytes[i] += GC.GetAllocatedBytesForCurrentThread() - bytes;
|
||||
}
|
||||
}
|
||||
|
||||
public T Get<T>() where T : ISimSystem => Systems.OfType<T>().First();
|
||||
}
|
||||
Reference in new issue
Block a user