F2: industria servita come ultimo giorno di servizio nel trimestre

Il flag giornaliero veniva azzerato dalle stazioni prima della valutazione
trimestrale; ora conta l'essere stata servita almeno un giorno nel trimestre.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
This commit is contained in:
Claude committed 2026-10-01 23:21:40 +00:00
1 parent 18b5e2c2e1
commit 36631dbd09
7 files changed
+24 -15

No files matched your search

@@ -84,7 +84,6 @@ public static class EconomyTests
var mine = w.Industries.First(i => i.Def.Kind == IndustryKind.Primary && i.Level == 1 && !i.Closed);
var other = w.Industries.First(i => i != mine && i.Def.Kind == IndustryKind.Primary && !i.Closed);
int otherLevel = other.Level;
mine.Served = true;
for (int q = 0; q < 2; q++)
{
for (int d = 0; d < 90; d++)
@@ -97,10 +96,11 @@ public static class EconomyTests
mine.RevenueEma = 1_000_000;
mine.CostEma = 100_000;
mine.QuarterShipped = mine.QuarterProduced;
mine.LastServedDay = w.Clock.Day; // servita da un vettore simulato
w.RunDays(1);
}
}
w.RunDays(1); // il secondo trimestre si chiude nel primo tick del giorno 180
w.RunTicks(1); // il secondo trimestre si chiude nel primo tick del giorno 180
Assert.Equal(2, mine.Level, "livello dopo due trimestri ottimi");
Assert.Equal(otherLevel, other.Level, "un'industria non servita non cambia livello");
}
@@ -110,9 +110,12 @@ public static class EconomyTests
{
var w = TestWorlds.Small(105);
var ind = w.Industries.First(i => i.Def.Kind == IndustryKind.Processing && !i.Closed);
ind.Served = true;
int startLevel = ind.Level;
w.RunDays(90 * (startLevel + 5) + 1);
for (int d = 0; d < 90 * (startLevel + 5) + 1; d++)
{
ind.LastServedDay = w.Clock.Day; // servita ma senza consegne né spedizioni
w.RunDays(1);
}
Assert.True(ind.Closed, $"chiusa (livello iniziale {startLevel}, ultimo punteggio {ind.LastScore:F2})");
Assert.True(w.Events.Recent.Any(e => e.Text.Contains(ind.Name, StringComparison.Ordinal) && e.Text.Contains("chiude", StringComparison.Ordinal)));
}
+1 -1
View File
@@ -31,7 +31,7 @@ public static class TrainTests
Assert.True(t.Odometer > 50_000, $"il treno ha viaggiato ({t.Odometer / 1000:F1} km)");
Assert.True(steel.InputStock.All(s => s > 0), "l'acciaieria riceve minerale e carbone");
Assert.True(f.W.Player.YearEntries[(int)LedgerEntry.FreightRevenue] > revenueBefore, "tariffe incassate");
Assert.True(steel.Served, "industria servita");
Assert.True(steel.ServedWithin(f.W.Clock.Day, 1), "industria servita");
Assert.Equal(0L, f.W.MoneyBalanceSum());
for (int g = 0; g < f.W.Data.GoodCount; g++)
Assert.Equal(f.W.Goods.ExpectedStock(g), f.W.TotalStock(g), $"merce {f.W.Data.Goods[g].Id}");