From 20460feccad16c365b5901ed2823e158e4e1467f Mon Sep 17 00:00:00 2001 From: shevernitskiy Date: Sun, 13 Aug 2023 07:40:35 +0300 Subject: [PATCH] tiny refactor texpos methods --- library/lua/gui.lua | 3 +-- plugins/lua/buildingplan/pens.lua | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/library/lua/gui.lua b/library/lua/gui.lua index aaca5b849..d9f826cd1 100644 --- a/library/lua/gui.lua +++ b/library/lua/gui.lua @@ -915,8 +915,7 @@ local BASE_FRAME = { local function make_frame(name, double_line) local tp = function(offset) local texpos = dfhack.textures.getAsset('hack/data/art/border-'..name:lower()..'.png', offset) - if texpos == -1 then return nil end - return texpos + return texpos >= 0 and texpos or nil end local frame = copyall(BASE_FRAME) diff --git a/plugins/lua/buildingplan/pens.lua b/plugins/lua/buildingplan/pens.lua index 30ce478d8..7e9b24300 100644 --- a/plugins/lua/buildingplan/pens.lua +++ b/plugins/lua/buildingplan/pens.lua @@ -11,8 +11,7 @@ local to_pen = dfhack.pen.parse local tp = function(asset, offset) local texpos = dfhack.textures.getAsset(asset, offset) - if texpos == -1 then return nil end - return texpos + return texpos >= 0 and texpos or nil end function reload_pens()