@@ -1107,53 +1107,31 @@ bool MenuNewGame() {
11071107  int  n_missions, res;
11081108  bool  found = false ;
11091109  bool  retval = true ;
1110+   std::filesystem::path mission_name;
1111+ 
11101112#ifdef  DEMO
1111-   if  (LoadMission (" d3demo.mn3"  )) {
1112-     CurrentPilotUpdateMissionStatus (true );
1113-     //  go into game mode.
1114-     SetGameMode (GM_NORMAL);
1115-     SetFunctionMode (GAME_MODE);
1116-     return  true ;
1117-   } else  {
1118-     DoMessageBox (TXT_ERROR, TXT_ERRLOADMSN, MSGBOX_OK);
1119-     return  false ;
1120-   }
1113+   mission_name = " d3demo.mn3"  ;
11211114#else 
11221115  if  (int  mission_arg = FindArg (" -mission"  )) {
1123-     std::filesystem::path filename = std::filesystem::path (GameArgs[mission_arg + 1 ]).filename ().replace_extension (" .mn3"  );
1124-     if  (LoadMission (filename.u8string ().c_str ())) {
1125-       CurrentPilotUpdateMissionStatus (true );
1126-       //  go into game mode.
1127-       SetGameMode (GM_NORMAL);
1128-       SetFunctionMode (GAME_MODE);
1129-       return  true ;
1130-     } else  {
1131-       DoMessageBox (TXT_ERROR, TXT_ERRLOADMSN, MSGBOX_OK);
1132-       return  false ;
1133-     }
1134-   }
1135-   if  ((!FirstGame) && (-1  == Current_pilot.find_mission_data (TRAINING_MISSION_NAME))) {
1136- 
1116+     //  If direct loading via cmdline option
1117+     mission_name = std::filesystem::path (GameArgs[mission_arg + 1 ]).filename ().replace_extension (" .mn3"  );
1118+   } else  if  ((!FirstGame) && (-1  == Current_pilot.find_mission_data (TRAINING_MISSION_NAME))) {
1119+     //  First time?
11371120    FirstGame = true ;
1138- 
1139-     if  (LoadMission (" training.mn3"  )) {
1140-       CurrentPilotUpdateMissionStatus (true );
1141-       //  go into game mode.
1142-       SetGameMode (GM_NORMAL);
1143-       SetFunctionMode (GAME_MODE);
1144-       return  true ;
1145-     } else  {
1146-       DoMessageBox (TXT_ERROR, TXT_ERRLOADMSN, MSGBOX_OK);
1147-       return  false ;
1148-     }
1121+     mission_name = " training.mn3"  ;
11491122  } else  if  (FirstGame) {
1123+     //  Already trained
11501124    FirstGame = false ;
11511125#ifdef  OEM
1152-     if  ( LoadMission ( OEM_MISSION_FILE)) 
1126+     mission_name =  OEM_MISSION_FILE; 
11531127#else 
1154-     if  (LoadMission (" d3.mn3"  ))
1155- #endif 
1156-     {
1128+     mission_name = " d3.mn3"  ;
1129+ #endif  //  OEM
1130+   }
1131+ #endif  //  DEMO
1132+ 
1133+   if  (!mission_name.empty ()) {
1134+     if  (LoadMission (mission_name)) {
11571135      CurrentPilotUpdateMissionStatus (true );
11581136      //  go into game mode.
11591137      SetGameMode (GM_NORMAL);
@@ -1291,7 +1269,6 @@ bool MenuNewGame() {
12911269  menu.Destroy ();
12921270
12931271  return  retval;
1294- #endif  //  DEMO
12951272}
12961273
12971274//  DisplayLevelWarpDlg
0 commit comments