Fix: IS_SUBROOM_INDEX range

The macro (currently unused, I think) for checking whether a particular
index designates a subroom was off by one on the maximum allowable
value.

Because of the dedicated extra space for the g.rooms array terminator
flag (hx == -1), subroom indices in g.rooms are set out in the range
[MAXNROFROOMS+1, MAXNROFROOMS*2], inclusive.

Also some minor formatting tweaks.
This commit is contained in:
Michael Meyer
2022-08-24 21:38:56 -04:00
committed by PatR
parent d74791f4a2
commit d1f4e7df85
2 changed files with 7 additions and 6 deletions

View File

@@ -313,7 +313,7 @@ makerooms(void)
iflags.in_lua = g.in_mk_themerooms = TRUE;
g.themeroom_failed = FALSE;
lua_getglobal(themes, "themerooms_generate");
if ( nhl_pcall(themes, 0, 0)){
if (nhl_pcall(themes, 0, 0)) {
impossible("Lua error: %s", lua_tostring(themes, -1));
}
iflags.in_lua = g.in_mk_themerooms = FALSE;
@@ -949,7 +949,7 @@ makelevel(void)
if (check_room(&g.vault_x, &w, &g.vault_y, &h, TRUE)) {
fill_vault:
add_room(g.vault_x, g.vault_y, g.vault_x + w, g.vault_y + h,
TRUE, VAULT, FALSE);
TRUE, VAULT, FALSE);
g.level.flags.has_vault = 1;
++room_threshold;
g.rooms[g.nroom - 1].needfill = FILL_NORMAL;