Skip to content

Commit

Permalink
Fix cave map generator producing passages along the map border
Browse files Browse the repository at this point in the history
Maps are 0-indexed even in Lua (so that 1 ends up as the lowest passable coordinate), so subtract 1 here

Closes #5407
  • Loading branch information
CelticMinstrel committed Feb 16, 2021
1 parent 2a83e78 commit a019edb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data/lua/cave_map_generator.lua
Expand Up @@ -122,7 +122,7 @@ function callbacks.generate_map(params)
local width = math.max(v.data.width or 1, 1)
local jagged = v.data.jagged or 0
local calc = function(x, y)
if x == 0 or x == params.map_width or y == 0 or y == params.map_height then
if x == 0 or x == params.map_width - 1 or y == 0 or y == params.map_height - 1 then
-- Map borders are impassable
return math.huge
end
Expand Down

0 comments on commit a019edb

Please sign in to comment.