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,
}
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_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
self:dismiss()
self:sendInputToParent('LEAVESCREEN')
elseif keys.CHANGETAB then
self:sendInputToParent("CHANGETAB")
self:inputToSubviews(keys)
self:updateLayout()
else
for _,name in ipairs(allowedKeys) do
if keys[name] then

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