File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,18 +130,18 @@ void Editor::update() {
130130 }
131131}
132132
133- std::string Editor::maybeUseAutosave (const std::string& filepath)
133+ void Editor::maybeUseAutosave (std::string& filepath)
134134{
135135 // first, just grab the info of this mission
136136 if (!parse_main (filepath.c_str (), MPF_ONLY_MISSION_INFO ))
137- return filepath ;
137+ return ;
138138 SCP_string created = The_mission.created ;
139139 CFileLocation res = cf_find_file_location (filepath.c_str (), CF_TYPE_ANY );
140140 time_t modified = res.m_time ;
141141 if (!res.found )
142142 {
143143 UNREACHABLE (" Couldn't find path '%s' even though parse_main() succeeded!" , filepath.c_str ());
144- return filepath; // just load the actual specified file
144+ return ;
145145 }
146146
147147 // now check all the autosaves
@@ -179,10 +179,8 @@ std::string Editor::maybeUseAutosave(const std::string& filepath)
179179 prompt.c_str (),
180180 { DialogButton::Yes, DialogButton::No });
181181 if (z == DialogButton::Yes)
182- return backup_res.full_name . c_str ();
182+ filepath = backup_res.full_name ; // replace the specified file with the autosave file
183183 }
184-
185- return filepath;
186184}
187185
188186bool Editor::loadMission (const std::string& mission_name, int flags) {
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class Editor : public QObject {
3939
4040 void createNewMission ();
4141
42- std::string maybeUseAutosave (const std::string& filepath);
42+ void maybeUseAutosave (std::string& filepath);
4343
4444 /* ! Load a mission. */
4545 bool loadMission (const std::string& filepath, int flags = 0 );
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ void FredView::loadMissionFile(const QString& pathName) {
143143 try {
144144 QApplication::setOverrideCursor (QCursor (Qt::WaitCursor));
145145
146- auto pathToLoad = fred->maybeUseAutosave (pathName.toStdString ());
146+ auto pathToLoad = pathName.toStdString ();
147+ fred->maybeUseAutosave (pathToLoad);
147148
148149 fred->loadMission (pathToLoad);
149150
You can’t perform that action at this time.
0 commit comments