Call free_mission() if a demo is corrupt, so the editor doesn't load a corrupt level

This commit is contained in:
Chris Taylor 2012-04-17 15:45:58 +08:00
parent 670219fa5a
commit 7971e8cff8
2 changed files with 6 additions and 0 deletions

View file

@ -6,6 +6,7 @@ main/gameseq.c: Allow level progressing if playing the builtin mission with EDIT
editor/med.c: Reset the player object for the editor, since demo playback mucks it up
main/render.c: Skip rendering of OBJ_NONE objects to avoid a failed Assert (can happen when playing a demo then going to the editor)
main/newdemo.c: Set object lifeleft to IMMORTAL_TIME if the byte read in demo playback is -1. This allows the objects to stay when playing a demo, going to the editor then playing the game from the editor
main/newdemo.c: Call free_mission() if a demo is corrupt, so the editor doesn't load a corrupt level
20120416
--------

View file

@ -2577,11 +2577,13 @@ int newdemo_read_frame_information(int rewrite)
#ifdef DEST_SAT
if ( (loaded_level < Last_secret_level) || (loaded_level > Last_level - 1) ) {
nm_messagebox( NULL, 1, TXT_OK, TXT_NO_DESTSAT_LVL );
free_mission();
return -1;
}
#else
if ((loaded_level < Last_secret_level) || (loaded_level > Last_level)) {
nm_messagebox( NULL, 1, TXT_OK, "%s\n%s\n%s", TXT_CANT_PLAYBACK, TXT_LEVEL_CANT_LOAD, TXT_DEMO_OLD_CORRUPT );
free_mission();
return -1;
}
#endif
@ -2631,6 +2633,7 @@ int newdemo_read_frame_information(int rewrite)
if (nd_playback_v_bad_read) {
nm_messagebox( NULL, 1, TXT_OK, "%s %s", TXT_DEMO_ERR_READING, TXT_DEMO_OLD_CORRUPT );
free_mission();
}
return done;
@ -2666,6 +2669,7 @@ void newdemo_goto_end(int to_rewrite)
{
if ((level < Last_secret_level) || (level > Last_level)) {
nm_messagebox( NULL, 1, TXT_OK, "%s\n%s\n%s", TXT_CANT_PLAYBACK, TXT_LEVEL_CANT_LOAD, TXT_DEMO_OLD_CORRUPT );
free_mission();
newdemo_stop_playback();
return;
}
@ -3389,6 +3393,7 @@ void newdemo_stop_playback()
Rear_view=0;
nd_playback_v_dead = nd_playback_v_rear = 0;
Newdemo_game_mode = Game_mode = GM_GAME_OVER;
if (Game_wind)
window_close(Game_wind); // Exit game loop
}