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:
+5
-2
@@ -94,14 +94,17 @@ def test_enemy_destroyed_report():
|
||||
|
||||
|
||||
def test_listening_post_and_coastal_battery():
|
||||
"""'Coastal Battery' is an alias for HostileArtillery (see
|
||||
_TYPE_WORD_ALIASES), not its own TargetType, it's just the
|
||||
fixed-emplacement flavor of the same thing."""
|
||||
text = """Listening Post#1 at K6 7:8 audio reports on:
|
||||
Coastal Battery#2:
|
||||
Distance 6.28km South-East from Listening Post#1
|
||||
"""
|
||||
info = ocr.parse_text(text)
|
||||
assert info.reference_points["ListeningPost#1"][2] == Coord("K", 6, 7, 8)
|
||||
assert (TargetType.COASTAL_BATTERY, "2") in info.targets
|
||||
_, clues, *_ = info.targets[(TargetType.COASTAL_BATTERY, "2")]
|
||||
assert (TargetType.HOSTILE_ARTILLERY, "2") in info.targets
|
||||
_, clues, *_ = info.targets[(TargetType.HOSTILE_ARTILLERY, "2")]
|
||||
assert clues == [ocr.Clue(reference="ListeningPost#1", bearing_deg=135.0, distance_km=6.28)]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user