Repository navigation
P3: Fix data loss and crashes in the mission editors (FRED and qtFRED) - #8028
Open
dustinspace217 wants to merge 11 commits into
Open
dustinspace217 wants to merge 11 commits into
dustinspace217 wants to merge 11 commits into
Conversation
The mission parser reads $Gravity Acceleration and the hide-in-mission-log ship flag, but the save code never wrote them, so FRED and qtFRED both dropped them the first time a mission was saved. They are now written the same way as their neighbours: gravity after the sound environment, and the flag in the +Flags2 list.
…age's persona and team Opening the events editor and pressing OK without touching anything changed three things. An event with a repeat count of -1 (repeat forever) was reset to 1, because the editor treated every count below 1 as unset; only 0 means unset, as in FRED and in the mission parser. The first message lost its persona and its team, because filling each of those lists selected its first entry and that was stored on the message. Cancelling the untouched editor also asked whether to keep changes, because filling the message fields from the mission ran their edit handlers. Those no longer run while the fields are being filled.
Ticking All Teams at War in the flag list only set a mission flag that nothing reads. The game and the save code use Mission_all_attack, which the dialog wrote back unchanged, so the saved mission had no +All Teams Attack line and the teams were not at war. The checkbox now starts from Mission_all_attack and is written back to it. The flag itself is no longer stored, so the mission is saved the way FRED saves it: the +All Teams Attack line and no flag bit.
After a goal was deleted, both editors kept the deleted goal's slot as the current goal. In qtFRED, typing in the name box then dereferenced a null tree item and crashed. In FRED, when no row was left for the tree to select, the fields stayed filled and enabled, and editing them wrote to whichever goal had moved into that slot (one hidden by the display type filter, for example) or past the end of the list. Deleting a goal now clears the current goal in both editors. FRED then follows the row its tree selects next, if there is one; qtFRED leaves nothing selected. Also in qtFRED: the Objective Invalid and Don't Play Completion Music checkboxes had handlers whose signature matched no checkbox signal, so Qt never connected them and ticking either one changed nothing. The completion music box also read the wrong field when a goal was selected.
…eted The same fault as in the mission goals editors: after a cutscene was deleted, both editors kept its slot as the current cutscene. qtFRED crashed on the next keystroke in the filename box. FRED left the type and filename fields filled and enabled when no row was left to select. Deleting a cutscene now clears the current cutscene in both editors. FRED then follows the row its tree selects next, if there is one; qtFRED leaves nothing selected.
The dialog saved Skip FRED's Weapon Loadout Validation but never read it back, so the box was always unticked when the dialog opened and the next OK cleared the setting. It is now read from the team data, as FRED does.
Set Group and Group used the group number 1 to 9 as the bit mask itself, so group 3 was groups 1 and 2 together, and setting it cleared ships out of those two. FRED uses one bit per group (1 << n), which is also what a saved mission's +Group value means. qtFRED now does the same.
The dialog kept its list of selected ships in a vector sized for every possible ship, filled only the first few entries, and then applied the values to all of them. The unused entries were zero, so every OK also wrote the special hitpoints, shields and explosion settings to ship 0, which is usually the player. The list now holds only the selected ships, and the separate count that indexed it is gone.
Goober5000
requested changes
Nov 11, 2026
Goober5000
left a comment
Contributor
There was a problem hiding this comment.
I'd split the All Teams At War fix into a separate PR. That PR should convert the global variable to a mission flag, similar to what was done for +Scramble: and +Red Alert:.
It moves to its own pull request, which stores the setting as a mission flag, as asked in the review. This reverts commit 93e7767.
A ship's group field is a set of bits, one per editor group, and 0 means no group. Ship creation set it to 0 until 2013 and the mission parser did until 2022; both now start at -1, which has every bit set. A ship placed in the editor, or loaded from a mission with no +Group line, therefore answered to every group, and its group was never saved because the save code skips negative values. Both defaults are 0 again, and the two comments describe the field as it is used. A mission that has no +Group lines gains "+Group: 0" on every ship the next time it is saved, the form retail missions such as SM1-01 already have.
Contributor
Author
|
Makes sense. I'll take All Teams at War out of this PR and redo it in its own PR as a mission flag, the way +Scramble: and +Red Alert: work. I also added one commit here so ships placed in the editor start with no group; it goes with the group fix already in this PR. |
This reverts ec05013 and f3afffd. scp-fs2open#8030 fixes the same selection group bug in both editors with shared helpers that keep -1 for "no group", so saved missions do not change. Dropping this version avoids a conflict in FredView.cpp.
Contributor
Author
|
The mission flag version is up as #8031. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Six small fixes to the mission editors, one commit each.
Both editors:
qtFRED only:
Why?
Most of these change or lose a mission designer's work with no message. They turned up while comparing qtFRED with FRED dialog by dialog: open a dialog, press OK without touching anything, save, and compare the file.
How?
Each fix is a few lines. The qtFRED fixes follow what FRED does. The FRED delete fix uses the reset FRED's events editor already does when an event is deleted. After a delete, FRED follows the row its tree selects next; qtFRED leaves nothing selected.
Testing?
Anything Else?
+Pbank Ammois still not saved. It is in FRED too.