File static-order.patch of Package descent3

References: https://github.com/DescentDevelopers/Descent3/pull/719

diff --git a/Descent3/config.cpp a/Descent3/config.cpp
index 900f03aa..fe854719 100644
--- a/Descent3/config.cpp
+++ a/Descent3/config.cpp
@@ -353,7 +353,7 @@ void ConfigureDisplayResolutions() {
     return;
   }
 
-  std::set<tVideoResolution, tVideoResolution::tVideoResolutionCompare> resolutions;
+  std::set<tVideoResolution> resolutions;
   for (int d = 0; d < display_count; d++) {
     SDL_DisplayID display_id = displays[d];
 
@@ -417,7 +417,7 @@ void ConfigureDisplayResolutions() {
   if (resolutions_vec.empty()) {
     return;
   }
-  std::swap(resolutions_vec, Video_res_list);
+  Video_res_list = std::move(resolutions_vec);
   SDL_free(displays);
 
   // Find the index of the current screen resolution in the list
diff --git a/Descent3/config.h a/Descent3/config.h
index 3ffe50de..5a35ab8c 100644
--- a/Descent3/config.h
+++ a/Descent3/config.h
@@ -145,21 +145,14 @@ struct tVideoResolution
     return ss.str();
   }
 
-  bool operator==(const tVideoResolution& other) {
+  bool operator==(const tVideoResolution& other) const {
     return other.width == this->width && other.height == this->height;
   }
 
-  struct tVideoResolutionCompare
+  bool operator<(const tVideoResolution& other) const
   {
-    bool operator()(const tVideoResolution &lres, const tVideoResolution &rres) const
-    {
-      if (lres.width != rres.width)
-      {
-        return lres.width < rres.width;
-      }
-      return lres.height < rres.height;
-    }
-  };
+    return width != other.width ? width < other.width : height < other.height;
+  }
 };
 
 extern std::vector<tVideoResolution> Video_res_list;
diff --git a/Descent3/init.cpp a/Descent3/init.cpp
index 65573807..23f912da 100644
--- a/Descent3/init.cpp
+++ a/Descent3/init.cpp
@@ -2061,12 +2061,9 @@ void DeleteTempFiles() {
  *
  */
 
-static int Init_old_screen_mode;
 static void (*Init_old_ui_callback)() = NULL;
 static bool Init_old_control_mode;
-static bool Init_ui_cursor_visible;
 static bool Init_was_game_paused = false;
-static pilot Init_old_pilot;
 
 // TODO: MTS: Unused in project
 void ShutdownD3() {
@@ -2096,81 +2093,14 @@ void ShutdownD3() {
     Sound_system.PauseSounds();
   }
 
-  SaveControlConfig(&Init_old_pilot);
   CloseControls();
 
   //	shutdown cinematics.
 
   //	shutdown screen.
-  Init_ui_cursor_visible = ui_IsCursorVisible();
-  Init_old_screen_mode = GetScreenMode();
   Init_old_ui_callback = GetUICallback();
   SetScreenMode(SM_NULL);
 
   // shutdown IO
   ddio_Close();
 }
-
-// TODO: MTS: unused in project
-//	This function restarts all game systems
-void RestartD3() {
-  ddio_init_info io_info;
-
-  if (!Init_systems_init)
-    return;
-
-  LOG_INFO << "Restarting D3...";
-
-  if (!FindArg("-windowed")) {
-    if (Dedicated_server) {
-      ddio_MouseMode(MOUSE_STANDARD_MODE);
-    } else {
-      ddio_MouseMode(MOUSE_EXCLUSIVE_MODE);
-    }
-  }
-
-  // startup io
-  io_info.obj = Descent;
-  if (!ddio_Init(&io_info)) {
-    Error("I/O initialization failed.");
-  }
-
-  //	startup screen.
-  ddio_KeyFlush();
-  SetScreenMode(Init_old_screen_mode);
-  SetUICallback(Init_old_ui_callback);
-  if (Init_ui_cursor_visible)
-    ui_ShowCursor();
-
-  //	startup game systems
-  InitControls();
-  LoadControlConfig(&Init_old_pilot);
-
-  // resume game sounds and time as needed
-  if (GetFunctionMode() == GAME_MODE) {
-    if (!(Game_mode & GM_MULTI)) {
-      if (!Init_was_game_paused) {
-        ResumeGame();
-      } else {
-        D3MusicResume();
-      }
-    }
-  } else {
-    Sound_system.ResumeSounds();
-    D3MusicResume();
-  }
-
-  // resume controller if it was active before alt-tabbing out.
-  if (Init_old_control_mode) {
-    ResumeControls();
-  }
-
-  // Restart Force Feedback
-  ForceRestart();
-
-  //	startup cinematics.
-
-  //	startup sound.
-  //	Sound_system.ResumeSounds();
-  //	Sound_system.InitSoundLib(Descent, Sound_mixer, Sound_quality, false);
-}
diff --git a/Descent3/pilot.cpp a/Descent3/pilot.cpp
index 2a0448b5..201cb703 100644
--- a/Descent3/pilot.cpp
+++ a/Descent3/pilot.cpp
@@ -682,7 +682,6 @@ void ShipSelectDeleteLogo(newuiListBox *lb);
 void ShowPilotPicDialog(pilot *Pilot);
 
 UITextItem *pilot_items = nullptr;        // array of UITextItems for use in Pilot listbox
-pilot temp;                               // pilot in use by the listbox
 static std::vector<std::string> filelist; // list of pilot filenames
 static int filecount;                     // number of pilot filenames found
 void PilotListSelectChangeCallback(int index);
@@ -825,7 +824,7 @@ struct {
   bool initial_call;
   bool all_setup;
 } PilotChooseDialogInfo;
-pilot working_pilot;
+static pilot working_pilot;
 
 void PilotListSelectChangeCallback(int index) {
   if (!filecount || !PilotChooseDialogInfo.all_setup)
diff --git a/Descent3/pilot_class.cpp a/Descent3/pilot_class.cpp
index 59f101a3..dee8a99b 100644
--- a/Descent3/pilot_class.cpp
+++ a/Descent3/pilot_class.cpp
@@ -172,48 +172,22 @@ extern float Key_ramp_speed;
 
 pilot::~pilot() { clean(false); }
 
-pilot::pilot() {
-  write_pending = false;
-  initialize();
+pilot::pilot() :
+	difficulty{DIFFICULTY_ROOKIE},
+	hud_mode{HUD_COCKPIT},
+	hud_graphical_stat{STAT_STANDARD}
+{
 }
 
-pilot::pilot(pilot *copy) {
-  write_pending = true;
-  initialize();
-}
-
-pilot::pilot(char *fname) {
-  write_pending = true;
-  initialize();
-}
-
-// initializes all the data (for constructors)
+// Two-stage construction (because it references global vars)
 void pilot::initialize(void) {
   int i;
 
   filename.clear();
-  name = NULL;
   ship_model = mem_strdup("Pyro-GL");
-  ship_logo = NULL;
-  audio1_file = NULL;
-  audio2_file = NULL;
-  audio3_file = NULL;
-  audio4_file = NULL;
   guidebot_name = mem_strdup("GB");
-  picture_id = PPIC_INVALID_ID;
-  difficulty = DIFFICULTY_ROOKIE;
-  hud_mode = (uint8_t)HUD_COCKPIT;
-  hud_stat = 0;
-  hud_graphical_stat = STAT_STANDARD;
   game_window_w = Video_res_list[Current_video_resolution_id].width;
   game_window_h = Video_res_list[Current_video_resolution_id].height;
-  num_missions_flown = 0;
-  mission_data = NULL;
-  mouselook_control = false;
-  key_ramping = 0.35f;
-  lrearview_enabled = false;
-  rrearview_enabled = false;
-
   bool kiddie_settings = true;
 
   if (Database) {
@@ -237,8 +211,6 @@ void pilot::initialize(void) {
     strcpy(taunts[i], TXT(TXT_TAUNT_TEXT + i));
   }
 
-  read_controller = READF_MOUSE + READF_JOY;
-
   if (Controller) {
     for (i = 0; i < NUM_CONTROLLER_FUNCTIONS; i++) {
       Controller->get_controller_function(Controller_needs[i].id, controls[i].type, &controls[i].value,
diff --git a/Descent3/pilot_class.h a/Descent3/pilot_class.h
index a9c180cc..11c094ed 100644
--- a/Descent3/pilot_class.h
+++ a/Descent3/pilot_class.h
@@ -170,8 +170,6 @@ class pilot {
 public:
   ~pilot();
   pilot();
-  pilot(pilot *copy);
-  pilot(char *fname);
 
   // This function guts the data so it's virgin (fresh for reading)
   // frees any memory that needs to be freed, etc.
@@ -235,9 +233,9 @@ public:
   void get_mission_data(int index, tMissionData *data);
   int find_mission_data(const char *mission_name);
 
-private:
   void initialize(void); // initializes all the data (for constructors)
-  bool write_pending;    // data has changed and pilot data is out of sync with file
+private:
+  bool write_pending = false; // data has changed and pilot data is out of sync with file
 private:
   // internal file access functions
   void write_name(CFILE *file);
@@ -256,7 +254,7 @@ private:
 
   // for the read functions, skip is true if the data should actually
   // just be skipped and not processed
-  int file_version;
+  int file_version = 0;
   void read_name(CFILE *file, bool skip);
   void read_ship_info(CFILE *file, bool skip);
   void read_custom_multiplayer_data(CFILE *file, bool skip);
@@ -275,46 +273,46 @@ private:
   //--- Pilot data				---//
   //--- Try to preserve alignment	---//
   std::string filename;// filename location of this pilot
-  char *name;          // name of the pilot (used in the game)
-  char *ship_logo;     // ship logo for multiplayer play (filename)
-  char *ship_model;    // what ship does this pilot fly
-  char *audio1_file;   // audio taunt #1 (filename)
-  char *audio2_file;   // audio taunt #2 (filename)
-  char *audio3_file;   // audio taunt #1 (filename)
-  char *audio4_file;   // audio taunt #2 (filename)
-  char *guidebot_name; // guidebot name
-
-  uint16_t picture_id; // pilot picture image id
+  char *name = nullptr;          // name of the pilot (used in the game)
+  char *ship_logo = nullptr;     // ship logo for multiplayer play (filename)
+  char *ship_model = nullptr;    // what ship does this pilot fly
+  char *audio1_file = nullptr;   // audio taunt #1 (filename)
+  char *audio2_file = nullptr;   // audio taunt #2 (filename)
+  char *audio3_file = nullptr;   // audio taunt #1 (filename)
+  char *audio4_file = nullptr;   // audio taunt #2 (filename)
+  char *guidebot_name = nullptr; // guidebot name
+
+  uint16_t picture_id = PPIC_INVALID_ID; // pilot picture image id
   uint8_t difficulty;  // difficulty setting for this pilot (DIFFICULTY_*)
   uint8_t hud_mode;    // hud display mode
-  bool profanity_filter_on, audiotaunts;
+  bool profanity_filter_on = false, audiotaunts = true;
 
-  uint16_t hud_stat; // hud layout using the STAT mask
+  uint16_t hud_stat = 0; // hud layout using the STAT mask
   uint16_t hud_graphical_stat;
 
-  int game_window_w, game_window_h; // game window size
+  int game_window_w = 0, game_window_h = 0; // game window size
 
-  int num_missions_flown;     // number of mission's flown
-  tMissionData *mission_data; // mission data
+  int num_missions_flown = 0;     // number of mission's flown
+  tMissionData *mission_data = nullptr; // mission data
 
-  uint16_t PrimarySelectList[MAX_PRIMARY_WEAPONS];
-  uint16_t SecondarySelectList[MAX_SECONDARY_WEAPONS];
+  uint16_t PrimarySelectList[MAX_PRIMARY_WEAPONS]{};
+  uint16_t SecondarySelectList[MAX_SECONDARY_WEAPONS]{};
 
-  tGameToggles gameplay_toggles; // special options in config menu.
+  tGameToggles gameplay_toggles{}; // special options in config menu.
 
 public:
-  char taunts[MAX_PILOT_TAUNTS][PILOT_TAUNT_SIZE]; // taunt macros
-
-  cntrldata controls[NUM_CONTROLLER_FUNCTIONS]; // controller settings
-  float mouse_sensitivity[N_MOUSE_AXIS];        // axis sensitivities
-  float joy_sensitivity[N_JOY_AXIS];            // axis sensitivities
-  float key_ramping;
-  char read_controller;   // do we read the controller port also (beyond keyboard/mouse)
-  bool mouselook_control; // mouselook control.
-  bool lrearview_enabled;
-  bool rrearview_enabled; // are these small views enabled?
-
-  uint8_t ingame_difficulty; // DAJ for optimization
+  char taunts[MAX_PILOT_TAUNTS][PILOT_TAUNT_SIZE]{}; // taunt macros
+
+  cntrldata controls[NUM_CONTROLLER_FUNCTIONS]{}; // controller settings
+  float mouse_sensitivity[N_MOUSE_AXIS]{};        // axis sensitivities
+  float joy_sensitivity[N_JOY_AXIS]{};            // axis sensitivities
+  float key_ramping = 0.35;
+  char read_controller = READF_MOUSE + READF_JOY;   // do we read the controller port also (beyond keyboard/mouse)
+  bool mouselook_control = false; // mouselook control.
+  bool lrearview_enabled = false;
+  bool rrearview_enabled = false; // are these small views enabled?
+
+  uint8_t ingame_difficulty = 0; // DAJ for optimization
 };
 
 #endif
diff --git a/Descent3/sdlmain.cpp a/Descent3/sdlmain.cpp
index 92974f5d..c6138297 100644
--- a/Descent3/sdlmain.cpp
+++ a/Descent3/sdlmain.cpp
@@ -45,6 +45,7 @@
 #include "init.h"
 #include "log.h"
 #include "config.h"
+#include "pilot.h"
 
 #ifdef WIN32
 #include "debug.h"
@@ -222,6 +223,7 @@ int main(int argc, char *argv[]) {
   GatherArgs(argv);
   bool enable_winconsole = true;
 #endif
+  Current_pilot.initialize();
 
   orig_pwd = std::filesystem::current_path();
 
openSUSE Build Service is sponsored by