Fold COASTAL_BATTERY into HOSTILE_ARTILLERY, it's the same thing
Same pattern already established for AMMO_CACHE -> SUPPLY_CACHE: a 'Coastal Battery' is just a heavy fixed-emplacement HostileArtillery under a different name in the game's own text, not a meaningfully different unit type worth its own enum member. Removed the TargetType.COASTAL_BATTERY member, added 'CoastalBattery' to ocr.py's _TYPE_WORD_ALIASES (so 'Coastal Battery#2:' still parses, now as a HostileArtillery), and a models.py migration entry so any save file written before this change still loads correctly. Verified the migration directly (COASTAL_BATTERY -> HOSTILE_ARTILLERY, existing AMMO_CACHE -> SUPPLY_CACHE unaffected) and updated the one test that asserted the old type.
This commit is contained in:
+4
-2
@@ -515,8 +515,10 @@ _BARE_CLUE_VALUE_RE = re.compile(
|
||||
|
||||
_TYPE_BY_SHORT = {t.short: t for t in TargetType}
|
||||
# The game's typewriter has used "AmmoCache" for what's now modeled as
|
||||
# SupplyCache, treat it as the same type rather than dropping the target.
|
||||
_TYPE_WORD_ALIASES = {"AmmoCache": "SupplyCache"}
|
||||
# SupplyCache, and "CoastalBattery" for what's just a HostileArtillery
|
||||
# under a different name, treat both as the same type rather than
|
||||
# dropping the target or inventing a redundant enum member for it.
|
||||
_TYPE_WORD_ALIASES = {"AmmoCache": "SupplyCache", "CoastalBattery": "HostileArtillery"}
|
||||
|
||||
|
||||
_REF_NAMED_RE = re.compile(rf"^{_TYPE_ID_FRAGMENT}")
|
||||
|
||||
Reference in New Issue
Block a user