Includes adding a LUA binding dgn.grid_see_grid.
N22Z7L4XI5LX7UVPSONQNHHPPZF3GLDHGUFDJU265JQYZ3JZEZTQC
end
end
end
local function test_gridseegrid_symmetry()
-- Clear messages to prevent them accumulating and forcing a --more--
crawl.mesclr()
-- Send the player to a random spot on the level.
you.random_teleport()
checks = checks + 1
local you_x, you_y = you.pos()
for y = -9, 9 do
for x = -9, 9 do
local px, py = x + you_x, y + you_y
if (x ~= 0 or y ~= 0) and dgn.in_bounds(px, py) then
local foreward = dgn.grid_see_grid(you_x, you_y, px, py)
local backward = dgn.grid_see_grid(px, py, you_x, you_y)
this_p = dgn.point(you_x, you_y)
other_p = dgn.point(px, py)
if not forward then
you.moveto(px, py)
local temp = this_p
this_p = other_p
other_p = temp
end
if forward ~= backward then
dgn.grid(other_p.x, other_p.y, "floor_special")
dgn.dbg_dump_map(FAILMAP)
assert(false,
"grid_see_grid asymmetry detected (iter #" .. checks .. "): "
.. this_p .. " sees " .. other_p .. ", but not vice versa."
.. " Map saved to " .. FAILMAP)
end
end