Separate level flags for premapped and sokoban

This commit is contained in:
Pasi Kallinen
2023-10-29 12:35:32 +02:00
parent 638c487c59
commit 16ed7e49c3
13 changed files with 19 additions and 18 deletions

View File

@@ -1973,9 +1973,9 @@ warnreveal(void)
}
}
/* Pre-map the sokoban levels */
/* Pre-map (the sokoban) levels */
void
sokoban_detect(void)
premap_detect(void)
{
register coordxy x, y;
register struct trap *ttmp;
@@ -1997,9 +1997,6 @@ sokoban_detect(void)
for (ttmp = gf.ftrap; ttmp; ttmp = ttmp->ntrap) {
ttmp->tseen = 1;
map_trap(ttmp, 1);
/* set sokoban_rules when there is at least one pit or hole */
if (ttmp->ttyp == PIT || ttmp->ttyp == HOLE)
Sokoban = 1;
}
}

View File

@@ -3714,6 +3714,8 @@ lspo_level_flags(lua_State *L)
gc.coder->premapped = 1;
else if (!strcmpi(s, "solidify"))
gc.coder->solidify = 1;
else if (!strcmpi(s, "sokoban"))
Sokoban = 1; /* gl.level.flags.sokoban_rules */
else if (!strcmpi(s, "inaccessibles"))
gc.coder->check_inaccessibles = 1;
else if (!strcmpi(s, "noflipx"))
@@ -6612,12 +6614,12 @@ lspo_finalize_level(lua_State *L UNUSED)
if (L && gc.coder->solidify)
solidify_map();
/* This must be done before sokoban_detect(),
/* This must be done before premap_detect(),
* otherwise branch stairs won't be premapped. */
fixup_special();
if (L && gc.coder->premapped)
sokoban_detect();
premap_detect();
level_finalize_topology();
@@ -7075,12 +7077,12 @@ load_special(const char *name)
if (gc.coder->solidify)
solidify_map();
/* This must be done before sokoban_detect(),
/* This must be done before premap_detect(),
* otherwise branch stairs won't be premapped. */
fixup_special();
if (gc.coder->premapped)
sokoban_detect();
premap_detect();
result = TRUE;
give_up: