Disallow selling ground units.

Ground units should be transferred to a new location, not sold and
repurchased.

https://github.com/Khopa/dcs_liberation/issues/823
This commit is contained in:
Dan Albert
2021-04-18 16:32:02 -07:00
parent 3b72c13f9d
commit 5e054cfc77
3 changed files with 12 additions and 6 deletions

View File

@@ -469,12 +469,15 @@ class UnitsDeliveryEvent:
logging.info(f"Refunding {count} {unit_type.id} at {self.to_cp.name}")
game.adjust_budget(price * count, player=self.to_cp.captured)
def available_next_turn(self, unit_type: Type[UnitType]) -> int:
def pending_orders(self, unit_type: Type[UnitType]) -> int:
pending_units = self.units.get(unit_type)
if pending_units is None:
pending_units = 0
return pending_units
def available_next_turn(self, unit_type: Type[UnitType]) -> int:
current_units = self.to_cp.base.total_units_of_type(unit_type)
return pending_units + current_units
return self.pending_orders(unit_type) + current_units
def process(self, game: Game) -> None:
bought_units: Dict[Type[UnitType], int] = {}