From: Holger Schemel Date: Sun, 12 Sep 2021 23:09:13 +0000 (+0200) Subject: added checking for missing INFO chunk when loading tape by filename only X-Git-Tag: 4.3.0.0~60 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5a4a6f4051fc89de7e47cf41d4d3e78dab4283d6;p=rocksndiamonds.git added checking for missing INFO chunk when loading tape by filename only --- diff --git a/src/files.c b/src/files.c index e73ce9c5..61ea14cb 100644 --- a/src/files.c +++ b/src/files.c @@ -7763,6 +7763,7 @@ static void setTapeInfoToDefaults(void) tape.scr_fieldx = SCR_FIELDX_DEFAULT; tape.scr_fieldy = SCR_FIELDY_DEFAULT; + tape.no_info_chunk = TRUE; tape.no_valid_file = FALSE; } @@ -7867,6 +7868,8 @@ static int LoadTape_INFO(File *file, int chunk_size, struct TapeInfo *tape) int level_identifier_size; int i; + tape->no_info_chunk = FALSE; + level_identifier_size = getFile16BitBE(file); level_identifier = checked_malloc(level_identifier_size); diff --git a/src/tape.c b/src/tape.c index a22fc9a5..d7770329 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1589,6 +1589,9 @@ static int AutoPlayTapesExt(boolean initialize) Fail("cannot load tape file '%s'", autoplay.tape_filename); } + if (tape.no_info_chunk) + Fail("cannot get levelset from tape file '%s'", autoplay.tape_filename); + global.autoplay_leveldir = tape.level_identifier; if (tape.level_nr >= 0 && tape.level_nr < MAX_TAPES_PER_SET) diff --git a/src/tape.h b/src/tape.h index 09027d51..4b914c73 100644 --- a/src/tape.h +++ b/src/tape.h @@ -239,6 +239,7 @@ struct TapeInfo boolean show_game_buttons; // show game buttons in tape viewport + boolean no_info_chunk; // used to identify old tape file format boolean no_valid_file; // set when tape file missing or invalid };