Ability to disable cargo-ships

Fix #76
This commit is contained in:
Raffson 2023-09-09 12:09:57 +02:00
parent 0cb3702eb9
commit e50d49d7ba
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
2 changed files with 10 additions and 3 deletions

View File

@ -24,9 +24,10 @@ class CargoShipGenerator:
def generate(self) -> None: def generate(self) -> None:
# Reset the count to make generation deterministic. # Reset the count to make generation deterministic.
for coalition in self.game.coalitions: if not self.game.settings.perf_disable_cargo_ships:
for ship in coalition.transfers.cargo_ships: for coalition in self.game.coalitions:
self.generate_cargo_ship(ship) for ship in coalition.transfers.cargo_ships:
self.generate_cargo_ship(ship)
def generate_cargo_ship(self, ship: CargoShip) -> ShipGroup: def generate_cargo_ship(self, ship: CargoShip) -> ShipGroup:
waypoints = ship.route waypoints = ship.route

View File

@ -797,6 +797,12 @@ class Settings:
section=PERFORMANCE_SECTION, section=PERFORMANCE_SECTION,
default=False, default=False,
) )
perf_disable_cargo_ships: bool = boolean_option(
"Disable shipping-convoys",
page=MISSION_GENERATOR_PAGE,
section=PERFORMANCE_SECTION,
default=False,
)
perf_frontline_units_prefer_roads: bool = boolean_option( perf_frontline_units_prefer_roads: bool = boolean_option(
"Front line troops prefer roads", "Front line troops prefer roads",
page=MISSION_GENERATOR_PAGE, page=MISSION_GENERATOR_PAGE,