Repository navigation
P3: Fix more data-loss bugs in qtFRED, and a variable rename crash in both editors - #8029
Open
dustinspace217 wants to merge 11 commits into
Open
dustinspace217 wants to merge 11 commits into
dustinspace217 wants to merge 11 commits into
Conversation
… changes Changing a wing's arrival target set its arrival distance to 0 whenever the distance was larger than the new target's minimum, because the comparison was the wrong way round. The box went on showing the minimum, and the pre-save check then reported that the distance must be greater than 0. A distance below the minimum was left as it was. The distance is now raised to the minimum only when it is below it, as the arrival location handler a few lines up already does.
…e first stage The dialog edits the first fiction viewer stage, but a mission file can hold several. Clearing the story file and pressing OK deleted all of them. Only the first stage is removed now.
Changing a variable from number to string kept the number bit it was loaded with and added the string bit. The save code tests the number bit first, so the variable was written with its text value and the type "number". The old type bits are now cleared before the type chosen in the dialog is set. The team loadout reads the variables it uses by type when a mission loads, so with the type really saved, a changed one stopped the mission from loading. OK now refuses a type change for a variable the team loadout uses, which FRED's variable dialog refuses as well.
…e wing members alone The Rename button on the selection toolbar passed whatever was typed straight to the rename code. A name already used by another ship was accepted, which also pointed that ship's references in events and goals at the shared name. A name of 32 or more characters hit the length assert in Debug and did not fit the ship's name field. The first is refused now by the ship editor's name check, the second by a length check. The button was also offered for a wing member, whose name comes from its wing. Renaming one left the wing with a ship the pre-save check reports as an error. A wing member no longer gets the button.
…not changed Clicking into the Ship Name box and leaving it without typing reset a custom display name, and the next save lost it. So did a rename the editor refused, such as another ship's name. The display name is now reset only when the ship's name really changes.
…ames OK looked each variable up by its old name while earlier ones in the same pass had already been renamed. When two variables traded names, both found the same one: it ended up with the second variable's value and flags, and the first variable's value was lost. Every variable is now looked up before any is renamed.
…am loadout Events, cues and the team loadout refer to a variable by name, and renaming one in the variables editor left them on the old name. An event then saved the variable as undefined, and a team loadout count or class saved with a name that no longer existed, which hit an assert while saving in Debug. OK now renames those references in the mission as well, the same way container renames already reach events. An event editor that is open at the time keeps its own copy and still writes the old name back when it is closed with OK, as it does for container renames.
OK found variables by name without regard to case, and also matched slots whose variable was already deleted, since a deleted slot keeps its name. In a mission with both Cancer and cancer, OK with nothing changed saved cancer's value under both names and lost Cancer's, and deleting cancer deleted nothing. After deleting a variable and giving its name to another in one OK, the next OK brought the deleted one back as a second variable of that name. Variables are now found with the engine's own lookup, which matches the exact name among the variables in use, as the game and the save code do.
…not changed Leaving the Wing Name box without changing it still renamed the wing to its own name, which resets the display name, and the dialog then showed <none> in the Display Name box. Tabbing on through that box saved <none>, and the custom display name was lost. The wing is now renamed only when its name really changes, and the Display Name box is only refreshed then, as FRED does.
FRED renamed a variable only in the sexp tree it was renamed from. Events and cues held elsewhere, and the team loadout, which refers to a variable by name, stayed on the old name. After a rename from a wing's cue, saving showed "Couldn't find variable" warnings for the events and the file was not written. After a rename of a ship pool count variable, the next save (the autosave when the events editor closed) hit an assert in Debug builds; Release reads before the start of the variable list there. The reference update that qtFRED gained in the previous commits now sits beside the loadout counter in the shared editor code, and both editors call it.
This reverts 2777a2f. scp-fs2open#8030 makes the same change to WingEditorDialogModel::setArrivalTarget and also shares the minimum distance rule between the editors, so this copy is no longer needed.
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?
Small editor fixes, one commit each. The first three were in this PR when it opened; the rest came out of the same comparison and touch the same files.
Why?
Each of these loses or changes a mission designer's work, most of them with no message at the time. The rename one also takes FRED down in Debug builds, with whatever was not saved.
How?
Testing?
Anything Else?