From 3902ab3375d1f6b13a965d04c03f8edef4a17f39 Mon Sep 17 00:00:00 2001 From: Khopa Date: Tue, 15 Dec 2020 20:09:41 +0100 Subject: [PATCH] Fixed : BMD_1 IFV missing from db. Fixed error preventing mission generation when the role of an unit can not be determined. (cherry picked from commit 4112a86fe99b217dd2a4367866bea7b5ed274ac9) --- game/db.py | 1 + game/theater/base.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/game/db.py b/game/db.py index 092672b4..5889e9c7 100644 --- a/game/db.py +++ b/game/db.py @@ -720,6 +720,7 @@ UNIT_BY_TASK = { Armor.IFV_BMP_2, Armor.IFV_BMP_3, Armor.IFV_BMP_3, + Armor.IFV_BMD_1, Armor.ZBD_04A, Armor.ZBD_04A, Armor.ZBD_04A, diff --git a/game/theater/base.py b/game/theater/base.py index 14b96ce2..54b0e4f8 100644 --- a/game/theater/base.py +++ b/game/theater/base.py @@ -113,8 +113,10 @@ class Base: elif for_task == AirDefence: target_dict = self.aa - assert target_dict is not None - target_dict[unit_type] = target_dict.get(unit_type, 0) + unit_count + if target_dict is not None: + target_dict[unit_type] = target_dict.get(unit_type, 0) + unit_count + else: + logging.error("Unable to determine target dict for " + str(unit_type)) def commit_losses(self, units_lost: typing.Dict[typing.Any, int]):