F6: mercato globale, correzioni della revisione
CI / Build e test (pull_request) Successful in 1m31s
CI / Immagine Docker (pull_request) Successful in 29s

- «Dove conviene vendere» dice che il prezzo locale è quello della
  compravendita in proprio: oggi le consegne del vettore si pagano al prezzo
  globale (ADR 0015 §9).
- Gli hub che hanno esaurito la capacità del mese non compaiono tra le
  destinazioni.
- Senza compagnia l'avanzamento verso il commercio mostra comunque i
  requisiti del livello.
- I quattro test lunghi del mercato sono marcati lenti.
- «oggi» va in cima alla riga del grafico, per non coprire le etichette dei
  mesi.
- L'ADR annota la piccola differenza tra offerta e domanda mostrate e quelle
  del passo di mercato.

Refs #29.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-07 14:42:53 +01:00
1 parent 2992e7cc36
commit b2de314d7c
7 files changed
+26 -13

No files matched your search

@@ -343,7 +343,11 @@ public static class MarketOutlook
double desired = IndustryMath.InputCapacity(ind, i, dpm);
candidates.Add((SellPlaceKind.Industry, ind.Id.Value, Market.LocalPrice(pg, desired, ind.InputStock[i], lp)));
}
foreach (var h in w.Hubs) candidates.Add((SellPlaceKind.Hub, h.Id.Value, h.BuyPrice(pg)));
// un hub che ha esaurito la capacità del mese non compra più fino al mese successivo
foreach (var h in w.Hubs)
{
if (h.RemainingCapacity > 0) candidates.Add((SellPlaceKind.Hub, h.Id.Value, h.BuyPrice(pg)));
}
// ordine stabile: prezzo decrescente, poi industrie prima degli hub, poi id
var top = candidates.OrderByDescending(c => c.Price).ThenBy(c => c.Kind).ThenBy(c => c.Target)
.Take(w.Data.Balance.Market.Outlook.SellPlaces).ToList();
@@ -391,11 +395,14 @@ public static class MarketOutlook
var c = company.IsValid && company.Value < w.Companies.Count ? w.Companies[company.Value] : null;
if (target is null || c is null)
{
// senza compagnia (o senza un livello che sblocca) si mostrano comunque i requisiti, mai soddisfatti
var r = target?.Requirements;
return new TradingProgress
{
Unlocked = false, Level = target?.Level ?? 0, Fraction = 0, NetWorth = c?.NetWorth ?? Money.Zero, NetWorthRequired = Money.Zero,
TownsConnected = 0, TownsRequired = 0, TownPopulation = 0, Rating = c?.Rating ?? CreditRating.D,
RatingRequired = CreditRating.D, RatingMet = false,
Unlocked = false, Level = target?.Level ?? 0, Fraction = 0, NetWorth = c?.NetWorth ?? Money.Zero,
NetWorthRequired = new Money(r?.NetWorth ?? 0),
TownsConnected = 0, TownsRequired = r?.ConnectedTownsOver.Count ?? 0, TownPopulation = r?.ConnectedTownsOver.Population ?? 0,
Rating = c?.Rating ?? CreditRating.D, RatingRequired = r?.CreditRating ?? CreditRating.D, RatingMet = false,
};
}
var req = target.Requirements;