Skip to content

Extract common name conflict checker for FRED2 and qtFRED - #7630

Open
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:claude/extract-name-conflict-checker
Open

Extract common name conflict checker for FRED2 and qtFRED#7630
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:claude/extract-name-conflict-checker

Conversation

@Goober5000

Copy link
Copy Markdown
Contributor

The ship editor, wing editor, waypoint path dialog, and jump node dialog all had near-identical code to check whether a new name conflicts with an existing ship, wing, waypoint path, jump node, or target priority group (or is empty, or begins with '<'). Both FRED2 and qtFRED carried their own copies of this logic.

Extract it into a single check_name_conflict() function in code/missioneditor/common.cpp, shared by both editors, and replace the duplicated validation at each call site with a one-line call:

  • FRED2: shipeditordlg, wing_editor, waypointpathdlg, jumpnodedlg
  • qtFRED: ShipEditorDialogModel, WaypointEditorDialogModel, JumpNodeEditorDialogModel, and Editor::validate_wing_name

This also aligns a few small behavioral differences that had crept in between the two editors: the waypoint and jump node dialogs now skip empty wing slots (wave_count == 0) when checking for wing-name collisions, and the qtFRED wing editor now rejects names beginning with '<'.

@Goober5000 Goober5000 added cleanup A modification or rewrite of code to make it more understandable or easier to maintain. qtfred A feature or issue related to qtFred. fred A feature or issue related to the FReespace EDitor (FRED) labels Jul 20, 2026
@github-project-automation github-project-automation Bot moved this to Work In Progress (PRs) in qtFRED2 Jul 20, 2026
The ship editor, wing editor, waypoint path dialog, and jump node
dialog all had near-identical code to check whether a new name
conflicts with an existing ship, wing, waypoint path, jump node, or
target priority group (or is empty, or begins with '<').  Both FRED2
and qtFRED carried their own copies of this logic.

Extract it into a single check_name_conflict() function in
code/missioneditor/common.cpp, shared by both editors, and replace the
duplicated validation at each call site with a one-line call:

  - FRED2:  shipeditordlg, wing_editor, waypointpathdlg, jumpnodedlg
  - qtFRED: ShipEditorDialogModel, WaypointEditorDialogModel,
            JumpNodeEditorDialogModel, and Editor::validate_wing_name

This also aligns a few small behavioral differences that had crept in
between the two editors: the waypoint and jump node dialogs now skip
empty wing slots (wave_count == 0) when checking for wing-name
collisions, and the qtFRED wing editor now rejects names beginning
with '<'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Goober5000
Goober5000 force-pushed the claude/extract-name-conflict-checker branch from fa59922 to f6f1fd7 Compare July 21, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup A modification or rewrite of code to make it more understandable or easier to maintain. fred A feature or issue related to the FReespace EDitor (FRED) qtfred A feature or issue related to qtFred.

Projects

Status: Work In Progress (PRs)

Development

Successfully merging this pull request may close these issues.

1 participant