diff --git a/autoload/rogue/level.lua b/autoload/rogue/level.lua index d3fdf29..92a03e4 100644 --- a/autoload/rogue/level.lua +++ b/autoload/rogue/level.lua @@ -188,7 +188,7 @@ local function hide_boxed_passage(row1, col1, row2, col2, n) for j = 0, 9 do row = g.get_rand(row1 + row_cut, row2 - row_cut) col = g.get_rand(col1 + col_cut, col2 - col_cut) - if g.dungeon[row][col][g.TUNNEL] then + if g.dungeon_equals(g.dungeon[row][col], g.TUNNEL) then g.dungeon[row][col][g.HIDDEN] = g.dungeon_desc[g.HIDDEN] break end diff --git a/autoload/rogue/monster.lua b/autoload/rogue/monster.lua index 80a32fd..daa732f 100644 --- a/autoload/rogue/monster.lua +++ b/autoload/rogue/monster.lua @@ -577,7 +577,7 @@ function g.move_mon_to(monster, row, col) end if g.dungeon[row][col][g.DOOR] and g.get_room_number(row, col) ~= g.cur_room and - g.dungeon[mrow][mcol][g.FLOOR] and g.blind == 0 then + g.dungeon_equals(g.dungeon[mrow][mcol], g.FLOOR) and g.blind == 0 then g.mvaddch(mrow, mcol, ' ') end if g.dungeon[row][col][g.DOOR] then diff --git a/autoload/rogue/object.lua b/autoload/rogue/object.lua index 7433c2d..b79ac02 100644 --- a/autoload/rogue/object.lua +++ b/autoload/rogue/object.lua @@ -225,8 +225,8 @@ local function put_gold() for j = 0, 49 do local row = g.get_rand(g.rooms[i].top_row+1, g.rooms[i].bottom_row-1) local col = g.get_rand(g.rooms[i].left_col+1, g.rooms[i].right_col-1) - if g.dungeon[row][col][g.FLOOR] or - g.dungeon[row][col][g.TUNNEL] then + if g.dungeon_equals(g.dungeon[row][col], g.FLOOR) or + g.dungeon_equals(g.dungeon[row][col], g.TUNNEL) then plant_gold(row, col, is_maze) break end diff --git a/autoload/rogue/room.lua b/autoload/rogue/room.lua index a5ae339..109125d 100644 --- a/autoload/rogue/room.lua +++ b/autoload/rogue/room.lua @@ -202,6 +202,18 @@ function g.gr_row_col(mask) return r, c end +function g.dungeon_equals(dun, t) + local found = false + for k, v in pairs(dun) do + if k == t then + found = true + else + return false + end + end + return found +end + function g.gr_room() local i repeat @@ -226,7 +238,8 @@ function g.party_objects(rn) while (not found) and (j < 250) do row = g.get_rand(g.rooms[rn].top_row+1, g.rooms[rn].bottom_row-1) col = g.get_rand(g.rooms[rn].left_col+1, g.rooms[rn].right_col-1) - if g.dungeon[row][col][g.FLOOR] or g.dungeon[row][col][g.TUNNEL] then + if g.dungeon_equals(g.dungeon[row][col], g.FLOOR) or + g.dungeon_equals(g.dungeon[row][col], g.TUNNEL) then found = true end