Skip to content

Commit 33dbe85

Browse files
authored
use getUnitsInBox(pos1, pos2) overload
1 parent 9484f8e commit 33dbe85

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

gui/tooltips.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ local function GetUnitNameAndJob(unit)
8585
return table.concat(sb)
8686
end
8787

88-
local function GetTooltipText(x,y,z)
88+
local function GetTooltipText(pos)
8989
local txt = {}
90-
local units = dfhack.units.getUnitsInBox(x,y,z,x,y,z) or {} -- todo: maybe (optionally) use filter parameter here?
90+
local units = dfhack.units.getUnitsInBox(pos, pos) or {} -- todo: maybe (optionally) use filter parameter here?
9191

9292
for _,unit in ipairs(units) do
9393
txt[#txt+1] = GetUnitNameAndJob(unit)
@@ -136,7 +136,7 @@ function MouseTooltip:render(dc)
136136
if not x then return end
137137

138138
local pos = dfhack.gui.getMousePos()
139-
local text = GetTooltipText(pos2xyz(pos))
139+
local text = GetTooltipText(pos)
140140
if #text == 0 then return end
141141
self.label:setText(text)
142142

@@ -210,7 +210,7 @@ function TooltipsVizualizer:onRenderFrame(dc, rect)
210210
local height = vp.max_y
211211
local bottomright = {x = topleft.x + width, y = topleft.y + height, z = topleft.z}
212212

213-
local units = dfhack.units.getUnitsInBox(topleft.x,topleft.y,topleft.z,bottomright.x,bottomright.y,bottomright.z) or {}
213+
local units = dfhack.units.getUnitsInBox(topleft, bottomright) or {}
214214
if #units == 0 then return end
215215

216216
local oneTileOffset = GetScreenCoordinates({x = topleft.x + 1, y = topleft.y + 1, z = topleft.z + 0})

0 commit comments

Comments
 (0)