Add AI convoy attack planning.

Like the comment says this rarely has any effect due to the ordering of
flight planning and convoy creation. Could be separated, but opfor will
still not be able to target any convoys that the player creates in the
UI on that turn because they planning is done before the player can use
the UI.

Multi-turn transfers will be targetable, however.
This commit is contained in:
Dan Albert
2021-04-20 22:56:53 -07:00
parent 6cffc47f3c
commit 489b4d6acf
2 changed files with 43 additions and 0 deletions

View File

@@ -126,6 +126,11 @@ class ConvoyMap:
def departing_from(self, origin: ControlPoint) -> Iterator[Convoy]:
yield from self.convoys[origin].values()
def travelling_to(self, destination: ControlPoint) -> Iterator[Convoy]:
for destination_dict in self.convoys.values():
if destination in destination_dict:
yield destination_dict[destination]
def disband_convoy(self, convoy: Convoy) -> None:
del self.convoys[convoy.origin][convoy.destination]