Skip to content

Commit

Permalink
use new walkability group api
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Oct 29, 2023
1 parent 996c040 commit 31dd3ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
11 changes: 1 addition & 10 deletions devel/unit-path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ local function getTileType(cursor)
end
end

local function getTileWalkable(cursor)
local block = dfhack.maps.getTileBlock(cursor)
if block then
return block.walkable[cursor.x%16][cursor.y%16]
else
return 0
end
end

local function paintMapTile(dc, vp, cursor, pos, ...)
if not same_xyz(cursor, pos) then
local stile = vp:tileToScreen(pos)
Expand Down Expand Up @@ -115,7 +106,7 @@ function UnitPathUI:renderPath(dc,vp,cursor)
end
end
local color = COLOR_LIGHTGREEN
if getTileWalkable(pt) == 0 then color = COLOR_LIGHTRED end
if dfhack.maps.getWalkableGroup(pt) == 0 then color = COLOR_LIGHTRED end
paintMapTile(dc, vp, cursor, pt, char, color)
end
end
Expand Down
3 changes: 1 addition & 2 deletions gui/pathable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ function Pathable:onRenderBody()
return
end

local block = dfhack.maps.getTileBlock(target)
local walk_group = block and block.walkable[target.x % 16][target.y % 16] or 0
local walk_group = dfhack.maps.getWalkableGroup(target)
group:setText(walk_group == 0 and 'None' or tostring(walk_group))

if self.subviews.draw:getOptionValue() then
Expand Down
2 changes: 1 addition & 1 deletion warn-stranded.lua
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ end
local function getWalkGroup(pos)
local block = dfhack.maps.getTileBlock(pos)
if not block then return end
local walkGroup = block.walkable[pos.x % 16][pos.y % 16]
local walkGroup = dfhack.maps.getWalkableGroup(pos)
return walkGroup ~= 0 and walkGroup or nil
end

Expand Down

0 comments on commit 31dd3ee

Please sign in to comment.