Fix error due to -Werror -Wmissing-declarations in write_mission

This error was reported for gcc. Also set file extension correctly for 'enhanced' missions (though currently unused). Also some tidying up in response to feedback.
This commit is contained in:
Chris Taylor 2016-11-15 15:03:34 +08:00
parent 0e0bc755be
commit 6df1b85b87

View file

@ -1088,11 +1088,11 @@ int select_mission(int anarchy_mode, const char *message, window_event_result (*
}
#if DXX_USE_EDITOR
int write_mission(void)
static int write_mission(void)
{
auto &msn_extension =
#if defined(DXX_BUILD_DESCENT_II)
(Current_mission->descent_version == Mission::descent_version_type::descent2) ? MISSION_EXTENSION_DESCENT_II :
(Current_mission->descent_version != Mission::descent_version_type::descent1) ? MISSION_EXTENSION_DESCENT_II :
#endif
MISSION_EXTENSION_DESCENT_I;
array<char, PATH_MAX> mission_filename;
@ -1107,19 +1107,20 @@ int write_mission(void)
return 0;
}
const char *prefix = "";
#if defined(DXX_BUILD_DESCENT_II)
switch (Current_mission->descent_version)
{
case Mission::descent_version_type::descent2x:
PHYSFSX_printf(mfile, "x");
prefix = "x";
break;
case Mission::descent_version_type::descent2z:
PHYSFSX_printf(mfile, "z");
prefix = "z";
break;
case Mission::descent_version_type::descent2a:
PHYSFSX_printf(mfile, "!");
prefix = "!";
break;
default:
@ -1127,7 +1128,7 @@ int write_mission(void)
}
#endif
PHYSFSX_printf(mfile, "name = %s\n", static_cast<const char *>(Current_mission->mission_name));
PHYSFSX_printf(mfile, "%sname = %s\n", prefix, static_cast<const char *>(Current_mission->mission_name));
PHYSFSX_printf(mfile, "type = %s\n", Current_mission->anarchy_only_flag ? "anarchy" : "normal");
@ -1155,8 +1156,6 @@ int write_mission(void)
PHYSFSX_printf(mfile, "ham = %s\n", static_cast<const char *>(*Current_mission->alternate_ham_file.get()));
#endif
mfile.reset();
return 1;
}