OCR: support the opening calibration order's plain-prose target line

'Target is at- Q4 4:2' (no #id, unlike the usual block shape) is how
the game's very first order gives the target. Store it as a fixed
(UNKNOWN, "1") entry since there's only ever one.
This commit is contained in:
Dominik Moritz Roth 2026-08-08 22:49:44 +02:00
parent ba6b07a476
commit 139601b107

View File

@ -54,6 +54,7 @@ def ocr_text(image: Image.Image) -> str:
NEST_KEYWORD = "IRON NEST"
SPOTTER_KEYWORD = "SPOTTER"
TARGET_IS_AT_KEYWORD = "Target is at"
_FUZZY_THRESHOLD = 0.65
@ -446,6 +447,16 @@ def parse_text(text: str) -> ParsedInfo:
if spotter_id is not None and coord is not None:
info.spotters[spotter_id] = coord
# The game's opening calibration order gives the target as plain
# prose ("Target is at- Q4 4:2") rather than the usual "Target#N:"
# block shape, there's only ever one of these, so it's stored under
# a fixed id ("1") rather than one parsed from the text.
if (TargetType.UNKNOWN, "1") not in info.targets and _fuzzy_contains(line, TARGET_IS_AT_KEYWORD):
coord = _extract_coord(line)
if coord is not None:
info.targets[(TargetType.UNKNOWN, "1")] = (line, [], coord)
continue
for entry in parse_intel_blocks(text):
if entry["kind"] == "rp":
info.reference_points[entry["name"]] = (entry["raw"], entry["clues"], entry["coord"])