From: Holger Schemel Date: Sun, 13 Jun 2021 15:07:30 +0000 (+0200) Subject: added adjusting level settings for (non-native) Sokoban-style levels X-Git-Tag: 4.3.0.0~135 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=430bdc71a2f180fafc4d7267d9282200cd2ad541;hp=5967c94482902b251e034b55e4f85343d94c9610;p=rocksndiamonds.git added adjusting level settings for (non-native) Sokoban-style levels --- diff --git a/src/files.c b/src/files.c index 8b50f8e2..2a66964a 100644 --- a/src/files.c +++ b/src/files.c @@ -6474,8 +6474,29 @@ static void LoadLevel_InitVersion(struct LevelInfo *level) level->keep_walkable_ce = TRUE; } +static void LoadLevel_InitSettings_SB(struct LevelInfo *level) +{ + boolean is_sokoban_level = TRUE; // unless non-Sokoban elements found + int x, y; + + // check if this level is (not) a Sokoban level + for (y = 0; y < level->fieldy; y++) + for (x = 0; x < level->fieldx; x++) + if (!IS_SB_ELEMENT(Tile[x][y])) + is_sokoban_level = FALSE; + + if (is_sokoban_level) + { + // set special level settings for Sokoban levels + level->time = 0; + level->use_step_counter = TRUE; + } +} + static void LoadLevel_InitSettings(struct LevelInfo *level) { + // adjust level settings for (non-native) Sokoban-style levels + LoadLevel_InitSettings_SB(level); } static void LoadLevel_InitStandardElements(struct LevelInfo *level)