Improve insufficient aircraft message.

Specify only the tasks which were unfulfilled so the player knows what
to buy.
This commit is contained in:
Dan Albert 2020-10-04 14:35:10 -07:00
parent e0725ff139
commit 93db1254ec

View File

@ -406,11 +406,20 @@ class CoalitionMissionPlanner:
self.game.aircraft_inventory, self.game.aircraft_inventory,
self.is_player self.is_player
) )
missing_types: Set[FlightType] = set()
for proposed_flight in mission.flights: for proposed_flight in mission.flights:
if not builder.plan_flight(proposed_flight): if not builder.plan_flight(proposed_flight):
missing_types.add(proposed_flight.task)
if missing_types:
missing_types_str = ", ".join(
sorted([t.name for t in missing_types]))
builder.release_planned_aircraft() builder.release_planned_aircraft()
self.message("Insufficient aircraft", self.message(
f"Not enough aircraft in range for {mission}") "Insufficient aircraft",
f"Not enough aircraft in range for {mission.location.name} "
f"capable of: {missing_types_str}")
return return
package = builder.build() package = builder.build()