Make voyages active with dockside orders, crew calls, and ship PA

This commit is contained in:
josh
2026-11-27 23:14:38 -05:00
parent 7951e1c878
commit cc7620c431
71 changed files with 2723 additions and 233 deletions

View File

@@ -13,7 +13,8 @@ namespace Soundings.Editor
VerifyFlagshipCampaign();
VerifyLiveCrossingSettlement();
VerifyStormAndShipSystems();
Debug.Log("Soundings economy verification passed: both starts, pricing, fuel, accounting, saves, flagship progression, live settlement, weather and ship systems.");
VerifyPortOrders();
Debug.Log("Soundings economy verification passed: both starts, pricing, fuel, accounting, saves, flagship progression, live settlement, weather, ship systems and port orders.");
}
private static void VerifyUsedStartAndProfit()
@@ -223,6 +224,40 @@ namespace Soundings.Editor
Require(company.Sail(ship, destination) == null, "complete campaign voyage");
}
private static void VerifyPortOrders()
{
Company company = Company.Start(false);
Ship ship = company.ActiveShip;
Voyage light = company.Forecast(ship, 1);
Voyage stocked = company.Forecast(ship, 1);
PortPlanning.Apply(ship, light, company.Day, 125, EntertainmentProgram.Shipboard);
PortPlanning.Apply(ship, stocked, company.Day, ship.FoodCapacity + 100, EntertainmentProgram.LiveMusic);
Require(light.Plan.FoodUnits == 125 && stocked.Plan.FoodUnits == ship.FoodCapacity
&& stocked.Plan.FoodCost > light.Plan.FoodCost && stocked.Plan.ProgramCost > 0, "port food orders respect capacity and itemized costs");
Require(PortPlanning.FoodPriceCents(0, company.Day) != PortPlanning.FoodPriceCents(1, company.Day), "ports have different food prices");
var understocked = new OnboardSession(ship, light) { Assisted = false };
var provisioned = new OnboardSession(ship, stocked) { Assisted = false };
understocked.AdvanceTo(.5f);
provisioned.AdvanceTo(.5f);
Require(provisioned.Get(OnboardService.Shows).Capacity > understocked.Get(OnboardService.Shows).Capacity,
"booked local act opens more show places in its scheduled service window");
understocked.AdvanceTo(1);
provisioned.AdvanceTo(1);
Require(understocked.ProvisionsRemaining == 0 && provisioned.Health > understocked.Health
&& provisioned.Happiness > understocked.Happiness, "underbuying food affects health and guest happiness");
int cash = company.Cash;
company.Cash = stocked.OperatingCash + stocked.LoanInterest + stocked.Principal - 1;
Require(company.DepartureBlock(ship, stocked) != null, "departure needs enough cash for dockside invoices");
company.Cash = cash;
Require(company.Sail(ship, 1, provisioned) == null && company.Cash == cash + stocked.CashChange,
"port invoices settle in the voyage ledger");
var loaded = JsonUtility.FromJson<Company>(JsonUtility.ToJson(company));
Require(loaded.CanLoad() && loaded.History[0].Plan.FoodUnits == stocked.Plan.FoodUnits
&& loaded.History[0].Plan.Program == EntertainmentProgram.LiveMusic, "dockside orders survive a saved arrival");
}
private static void Require(bool condition, string description)
{
if (!condition)