Skip to content

Commit d73e2dc

Browse files
committed
confirm: allow multiple confirmations to be paused
Allowing only a single, mutually exclusive, paused confirmation was likely to be confusing. Per review from lethosor.
1 parent fb25d4d commit d73e2dc

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

changelog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Template for new versions:
4242
- `confirm`: when removing a manager order, show correct order description when using non-100% interface setting
4343
- `confirm`: when removing a manager order, show correct order description after prior order removal or window resize (when scrolled to bottom of order list)
4444
- `confirm`: when removing a manager order, show specific item/job type for ammo, shield, helm, gloves, shoes, trap component, and meal orders
45-
- `confirm`: the pause option now only pauses future instances of the current confirmation instead of all confirmations in the current context
45+
- `confirm`: the pause option now pauses individual confirmation types, allowing multiple different confirmations to be paused independently
4646

4747
## Misc Improvements
4848

confirm.lua

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function ConfirmOverlay:init()
6363
}
6464
end
6565
end
66+
self.paused_confs = {}
6667
end
6768

6869
function ConfirmOverlay:preUpdateLayout()
@@ -77,11 +78,14 @@ function ConfirmOverlay:preUpdateLayout()
7778
end
7879

7980
function ConfirmOverlay:overlay_onupdate()
80-
if self.paused_conf and
81-
not dfhack.gui.matchFocusString(self.paused_conf.context,
81+
for conf in pairs(self.paused_confs) do
82+
if not dfhack.gui.matchFocusString(conf.context,
8283
dfhack.gui.getDFViewscreen(true))
83-
then
84-
self.paused_conf = nil
84+
then
85+
self.paused_confs[conf] = nil
86+
end
87+
end
88+
if not next(self.paused_confs) then
8589
self.overlay_onupdate_max_freq_seconds = 300
8690
end
8791
end
@@ -114,7 +118,7 @@ function ConfirmOverlay:onInput(keys)
114118
local scr = dfhack.gui.getDFViewscreen(true)
115119
for id, conf in pairs(specs.REGISTRY) do
116120
if specs.config.data[id].enabled and self:matches_conf(conf, keys, scr) then
117-
if conf == self.paused_conf then
121+
if self.paused_confs[conf] then
118122
return false
119123
end
120124
local mouse_pos = xy2pos(dfhack.screen.getMousePos())
@@ -123,7 +127,7 @@ function ConfirmOverlay:onInput(keys)
123127
conf.on_propagate()
124128
end
125129
if pause then
126-
self.paused_conf = conf
130+
self.paused_confs[conf] = true
127131
self.overlay_onupdate_max_freq_seconds = 0
128132
end
129133
if keys._MOUSE_L then

0 commit comments

Comments
 (0)