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>
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using RailEnterprise.Core.Rail;
|
|
using RailEnterprise.Core.Simulation;
|
|
using RailEnterprise.Core.Simulation.Scenarios;
|
|
|
|
namespace RailEnterprise.Tests.Scenarios;
|
|
|
|
/// <summary>Accesso agli scenari di riferimento copiati accanto ai test.</summary>
|
|
public static class ScenarioHelper
|
|
{
|
|
public static string PathOf(string name)
|
|
{
|
|
string beside = Path.Combine(AppContext.BaseDirectory, "scenarios", name + ".json");
|
|
if (File.Exists(beside)) return beside;
|
|
var dir = new DirectoryInfo(Directory.GetCurrentDirectory());
|
|
while (dir is not null)
|
|
{
|
|
string candidate = Path.Combine(dir.FullName, "tests", "RailEnterprise.Tests", "scenarios", name + ".json");
|
|
if (File.Exists(candidate)) return candidate;
|
|
dir = dir.Parent;
|
|
}
|
|
throw new FileNotFoundException($"Scenario {name} non trovato");
|
|
}
|
|
|
|
public static LoadedScenario Load(string name) => ScenarioLoader.LoadFile(TestData.Data, PathOf(name));
|
|
|
|
public static TrackPlanContext PlanContext(World w) => new()
|
|
{
|
|
Data = w.Data,
|
|
Sampler = w.Sampler,
|
|
Year = w.Clock.Year,
|
|
CostMultiplier = w.Difficulty.ConstructionCostMultiplier,
|
|
NearestTownEdgeKm = p => w.Towns.Min(t => w.TownEdgeDistanceKm(t, p)),
|
|
};
|
|
}
|