Skip to content

fix gaps in parsed target priority lists - #7904

Open
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/target_priority
Open

Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/target_priority

Conversation

@Goober5000

@Goober5000 Goober5000 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Both the subsystem $Target Priority: parser and the weapon +Target Priority: parser stored each recognized group at the index of its position in the table list, while the count only incremented on matches. An unrecognized name therefore left a -1 hole inside the counted range (and pushed later valid entries outside it), which the turret targeting code then used as an index into Ai_tp_list.

Consolidate the two loops into parse_target_priority_list(), which packs the recognized entries at the front of the array. Unrecognized names are now reported via error_display in both cases, with context naming the subsystem or weapon.

NOTE: CI checks will fail until #7903 is merged and this branch is rebased.

Both the subsystem $Target Priority: parser and the weapon +Target Priority:
parser stored each recognized group at the index of its position in the table
list, while the count only incremented on matches.  An unrecognized name
therefore left a -1 hole inside the counted range (and pushed later valid
entries outside it), which the turret targeting code then used as an index
into Ai_tp_list.

Consolidate the two loops into parse_target_priority_list(), which packs the
recognized entries at the front of the array.  Unrecognized names are now
reported via error_display in both cases, with context naming the subsystem
or weapon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Goober5000 Goober5000 added the fix A fix for bugs, not-a-bugs, and/or regressions. label Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant