Accept a proposal using its detected marker id, not always a letter
detected_id (map_vision.read_marker_id) was wired into ground-truth logging but never actually consumed when accepting a proposal -- every accepted target/ally silently got an auto-assigned A/B/C letter regardless of what number the game itself shows for that unit. _accept_proposal now prefers detected_id when present, falling back to auto-assign on a collision (two markers misread to the same id, or a real id that happens to match one already assigned) -- a duplicate id is worse than losing traceability to the game's own number for that one accept. Targets/allies keep their own separate id namespace, same as auto-assignment already does elsewhere. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+18
-3
@@ -748,10 +748,25 @@ class MainWindow(Adw.ApplicationWindow):
|
||||
return
|
||||
if type_ is None:
|
||||
type_ = icons.target_type_from_icon(proposal.unit) or TargetType.UNKNOWN
|
||||
if proposal.side == "friendly":
|
||||
self.board.add_ally(type_, coord)
|
||||
is_ally = proposal.side == "friendly"
|
||||
# Prefer the marker's own detected "#<N>" id (map_vision.read_marker_id,
|
||||
# already past its own confidence floor by the time it's non-None)
|
||||
# over an auto-assigned letter -- lets an accepted unit's id match
|
||||
# what's actually on screen, rather than every accept silently
|
||||
# becoming A/B/C regardless of what the game itself calls it.
|
||||
# Falls back to auto-assign (id_=None) on a collision: two markers
|
||||
# misread to the same id, or a real id that just happens to match
|
||||
# one already auto-assigned, either way a duplicate id is worse
|
||||
# than losing this one accept's traceability to the game's own
|
||||
# number.
|
||||
id_ = proposal.detected_id
|
||||
existing = {a.id for a in self.board.allies} if is_ally else {t.id for t in self.board.targets}
|
||||
if id_ in existing:
|
||||
id_ = None
|
||||
if is_ally:
|
||||
self.board.add_ally(type_, coord, id_=id_)
|
||||
else:
|
||||
self.board.add_target(type_, coord)
|
||||
self.board.add_target(type_, coord, id_=id_)
|
||||
proposal.accepted = True
|
||||
proposal.confirmed_type = type_.name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user