From: Holger Schemel Date: Sat, 4 Sep 2021 11:28:48 +0000 (+0200) Subject: moved code to initialize level set when auto playing tapes X-Git-Tag: 4.3.0.0~78 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=13e49c43c3b41630f9eab6cdd0e29aa2ec37eae5;p=rocksndiamonds.git moved code to initialize level set when auto playing tapes --- diff --git a/src/tape.c b/src/tape.c index 63b9e402..44c6163a 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1439,6 +1439,7 @@ void AutoPlayTapes(void) -1 }; + boolean init_level_set = FALSE; int i; if (autoplay.initialized) @@ -1563,29 +1564,36 @@ void AutoPlayTapes(void) if (autoplay.leveldir == NULL) Fail("no such level identifier: '%s'", global.autoplay_leveldir); - leveldir_current = autoplay.leveldir; - - if (autoplay.leveldir->first_level < 0) - autoplay.leveldir->first_level = 0; - if (autoplay.leveldir->last_level >= MAX_TAPES_PER_SET) - autoplay.leveldir->last_level = MAX_TAPES_PER_SET - 1; - - autoplay.level_nr = autoplay.leveldir->first_level; - - PrintTapeReplayHeader(&autoplay); - - for (i = 0; i < MAX_TAPES_PER_SET; i++) - autoplay.level_failed[i] = FALSE; - // only private tapes may be modified if (global.autoplay_mode == AUTOPLAY_MODE_FIX) options.mytapes = TRUE; + init_level_set = TRUE; + autoplay.initialized = TRUE; } while (1) { + if (init_level_set) + { + leveldir_current = autoplay.leveldir; + + if (autoplay.leveldir->first_level < 0) + autoplay.leveldir->first_level = 0; + if (autoplay.leveldir->last_level >= MAX_TAPES_PER_SET) + autoplay.leveldir->last_level = MAX_TAPES_PER_SET - 1; + + autoplay.level_nr = autoplay.leveldir->first_level; + + PrintTapeReplayHeader(&autoplay); + + for (i = 0; i < MAX_TAPES_PER_SET; i++) + autoplay.level_failed[i] = FALSE; + + init_level_set = FALSE; + } + if (global.autoplay_mode != AUTOPLAY_MODE_FIX || patch_nr == 0) level_nr = autoplay.level_nr++;