Saved games from editor generated levels now work

Editor generated levels use the dummy mission created by create_new_mission.
This commit is contained in:
Chris Taylor 2016-11-13 17:21:45 +08:00
parent cf0065da34
commit c6f5e91f4a
2 changed files with 11 additions and 2 deletions

View file

@ -1092,7 +1092,7 @@ void create_new_mission(void)
{
Current_mission = make_unique<Mission>();
*Current_mission = {};
Current_mission->path = "new_mission";
Current_mission->path = "new_miss"; // limited to eight characters because of savegame format
Current_mission->filename = begin(Current_mission->path);
Current_mission->builtin_hogsize = 0;

View file

@ -1431,10 +1431,19 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
// Read the mission info...
PHYSFS_read(fp, mission, sizeof(char) * 9, 1);
if (!load_mission_by_name( mission )) {
if (!load_mission_by_name( mission )
#if DXX_USE_EDITOR
&& strcmp(mission, "new_miss")
#endif
)
{
nm_messagebox( NULL, 1, "Ok", "Error!\nUnable to load mission\n'%s'\n", mission );
return 0;
}
#if DXX_USE_EDITOR
else if (!strcmp(mission, "new_miss"))
create_new_mission(); // use simple dummy mission
#endif
//Read level info
current_level = PHYSFSX_readSXE32(fp, swap);