Bug fixing.

Fixes for "tab" in hacked buildings.
develop
Warmist 2014-08-03 16:00:13 +03:00
parent ee2424c895
commit f04b93210a
2 changed files with 18 additions and 11 deletions

@ -423,12 +423,17 @@ WorkshopOverlay.ATTRS={
workshop=DEFAULT_NIL, workshop=DEFAULT_NIL,
} }
function WorkshopOverlay:onInput(keys) function WorkshopOverlay:onInput(keys)
local allowedKeys={ --TODO add options: job management, profile, etc... local allowedKeys={ --TODO add options: job management, profile, etc...
"CURSOR_RIGHT","CURSOR_LEFT","CURSOR_UP","CURSOR_DOWN", "CURSOR_RIGHT","CURSOR_LEFT","CURSOR_UP","CURSOR_DOWN",
"CURSOR_UPRIGHT","CURSOR_UPLEFT","CURSOR_DOWNRIGHT","CURSOR_DOWNLEFT","CURSOR_UP_Z","CURSOR_DOWN_Z","DESTROYBUILDING"} "CURSOR_UPRIGHT","CURSOR_UPLEFT","CURSOR_DOWNRIGHT","CURSOR_DOWNLEFT",
"CURSOR_UP_Z","CURSOR_DOWN_Z","DESTROYBUILDING","CHANGETAB"}
if keys.LEAVESCREEN then if keys.LEAVESCREEN then
self:dismiss() self:dismiss()
self:sendInputToParent('LEAVESCREEN') self:sendInputToParent('LEAVESCREEN')
elseif keys.CHANGETAB then
self:sendInputToParent("CHANGETAB")
self:inputToSubviews(keys)
self:updateLayout()
else else
for _,name in ipairs(allowedKeys) do for _,name in ipairs(allowedKeys) do
if keys[name] then if keys[name] then

@ -106,11 +106,13 @@ function registerSidebar(shop_name,callback)
else else
local function drawSidebar( wshop ) local function drawSidebar( wshop )
local valid_focus="dwarfmode/QueryBuilding/Some" local valid_focus="dwarfmode/QueryBuilding/Some"
if string.sub(dfhack.gui.getCurFocus(),1,#valid_focus)==valid_focus and if wshop:getMaxBuildStage()==wshop:getBuildStage() then
wshop:getMaxBuildStage()==wshop:getBuildStage()
then
local sidebar=callback{workshop=wshop} local sidebar=callback{workshop=wshop}
sidebar:show() if string.sub(dfhack.gui.getCurFocus(),1,#valid_focus)==valid_focus then
sidebar:show()
else
sidebar:show(dfhack.gui.getCurViewscreen(true).parent)
end
end end
end end
registerSidebar(shop_name,drawSidebar) registerSidebar(shop_name,drawSidebar)
@ -139,11 +141,11 @@ function addReactionToShop(reaction_name,shop_name)
dfhack.onStateChange.eventful=unregall dfhack.onStateChange.eventful=unregall
end end
local function invertTable(tbl) local function invertTable(tbl)
local ret={} local ret={}
for k,v in pairs(tbl) do for k,v in pairs(tbl) do
ret[v]=k ret[v]=k
end end
return ret return ret
end end
eventType=invertTable{ eventType=invertTable{
[0]="TICK", [0]="TICK",