New command for clearing the stockpile order.

Shift-Space by default, using the SETUPGAME_SAVE_PROFILE_ABORT key.
develop
Eric Wald 2016-05-14 23:35:07 -06:00
parent 8c7d5366c9
commit 3e8d4f9257
1 changed files with 15 additions and 0 deletions

@ -816,6 +816,10 @@ function screen:onRenderBody(dc)
dc:string(gui.getKeyDisplay("STANDARDSCROLL_RIGHT"), COLOR_LIGHTGREEN) dc:string(gui.getKeyDisplay("STANDARDSCROLL_RIGHT"), COLOR_LIGHTGREEN)
dc:string(": Select", COLOR_WHITE) dc:string(": Select", COLOR_WHITE)
dc:seek(CenterCol, FirstRow + self.page_size + 2)
dc:string(gui.getKeyDisplay("SETUPGAME_SAVE_PROFILE_ABORT"), COLOR_LIGHTGREEN)
dc:string(": No order", COLOR_WHITE)
-- Reaction lines. -- Reaction lines.
for _, item in ipairs(self.displayed) do for _, item in ipairs(self.displayed) do
dc:seek(item.x, item.y):string(item.name, item.color) dc:seek(item.x, item.y):string(item.name, item.color)
@ -831,6 +835,9 @@ function screen:onInput(keys)
if selected then if selected then
store_order(self.stockpile, selected.index) store_order(self.stockpile, selected.index)
end end
elseif keys.SETUPGAME_SAVE_PROFILE_ABORT then
self:dismiss()
clear_order(self.stockpile)
elseif keys.STANDARDSCROLL_UP then elseif keys.STANDARDSCROLL_UP then
self.position = self.position - 1 self.position = self.position - 1
elseif keys.STANDARDSCROLL_DOWN then elseif keys.STANDARDSCROLL_DOWN then
@ -1002,6 +1009,14 @@ function screen:refilter()
self.displayed = displayed self.displayed = displayed
end end
function clear_order(stockpile)
local saved = saved_orders[stockpile.id]
if saved then
saved.entry:delete()
saved_orders[stockpile.id] = nil
end
end
function store_order(stockpile, order_number) function store_order(stockpile, order_number)
local name = reaction_list[order_number].name local name = reaction_list[order_number].name
-- print("Setting stockpile #"..stockpile.stockpile_number.." to "..name.." (#"..order_number..")") -- print("Setting stockpile #"..stockpile.stockpile_number.." to "..name.." (#"..order_number..")")