From 2797061b04122e36cb54f0b1d234dfe4eba9d5ea Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Wed, 4 Nov 2020 18:06:50 -0800 Subject: [PATCH 01/37] scroll Label text when height exceeds viewrect --- library/lua/gui/widgets.lua | 54 ++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 99733b84b..07f2b0eb3 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -235,9 +235,13 @@ end function render_text(obj,dc,x0,y0,pen,dpen,disabled) local width = 0 for iline,line in ipairs(obj.text_lines) do + if dc and obj.start_line_num and iline < obj.start_line_num then + goto continue + end local x = 0 if dc then - dc:seek(x+x0,y0+iline-1) + local offset = (obj.start_line_num or 1) - 1 + dc:seek(x+x0,y0+iline-offset-1) end for _,token in ipairs(line) do token.line = iline @@ -323,6 +327,7 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled) token.x2 = x end width = math.max(width, x) + ::continue:: end obj.text_width = width end @@ -340,6 +345,13 @@ end Label = defclass(Label, Widget) +STANDARDSCROLL = { + STANDARDSCROLL_UP = -1, + STANDARDSCROLL_DOWN = 1, + STANDARDSCROLL_PAGEUP = '-page', + STANDARDSCROLL_PAGEDOWN = '+page', +} + Label.ATTRS{ text_pen = COLOR_WHITE, text_dpen = COLOR_DARKGREY, -- disabled @@ -350,9 +362,11 @@ Label.ATTRS{ auto_width = false, on_click = DEFAULT_NIL, on_rclick = DEFAULT_NIL, + scroll_keys = STANDARDSCROLL, } function Label:init(args) + self.start_line_num = 1 self:setText(args.text) if not self.text_hpen then self.text_hpen = ((tonumber(self.text_pen) or tonumber(self.text_pen.fg) or 0) + 8) % 16 @@ -399,16 +413,33 @@ function Label:onRenderBody(dc) render_text(self,dc,0,0,text_pen,self.text_dpen,is_disabled(self)) end +function Label:scroll(nlines) + local n = self.start_line_num + nlines + n = math.min(n, self:getTextHeight() - self.frame_body.height) + n = math.max(n, 1) + self.start_line_num = n +end + function Label:onInput(keys) - if not is_disabled(self) then - if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then - self:on_click() - end - if keys._MOUSE_R_DOWN and self:getMousePos() and self.on_rclick then - self:on_rclick() + if is_disabled(self) then return false end + if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then + self:on_click() + end + if keys._MOUSE_R_DOWN and self:getMousePos() and self.on_rclick then + self:on_rclick() + end + for k,v in pairs(self.scroll_keys) do + if keys[k] then + if v == '+page' then + v = self.frame_body.height + elseif v == '-page' then + v = -self.frame_body.height + end + self:scroll(v) + return true end - return check_text_keys(self, keys) end + return check_text_keys(self, keys) end ---------- @@ -417,13 +448,6 @@ end List = defclass(List, Widget) -STANDARDSCROLL = { - STANDARDSCROLL_UP = -1, - STANDARDSCROLL_DOWN = 1, - STANDARDSCROLL_PAGEUP = '-page', - STANDARDSCROLL_PAGEDOWN = '+page', -} - SECONDSCROLL = { SECONDSCROLL_UP = -1, SECONDSCROLL_DOWN = 1, From dac9538fd9b5de0aa87ac13dc979a7100ccb5c8b Mon Sep 17 00:00:00 2001 From: myk002 Date: Mon, 11 Jan 2021 15:02:12 -0800 Subject: [PATCH 02/37] let navigation keys propagate so other components can use them for simultaneous control --- library/lua/gui/widgets.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 07f2b0eb3..2d056a599 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -436,7 +436,7 @@ function Label:onInput(keys) v = -self.frame_body.height end self:scroll(v) - return true + return false end end return check_text_keys(self, keys) From 97309e45f51082c1f1ebda824baec2583a347a6a Mon Sep 17 00:00:00 2001 From: myk002 Date: Mon, 11 Jan 2021 15:02:58 -0800 Subject: [PATCH 03/37] update changelog --- docs/changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index fdc7c13e7..09559ff62 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,6 +36,9 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature +## Misc Improvements +- Lua widget library Label class (used in all standard message boxes) is now scrollable with Up/Down/PgUp/PgDn keys + # 0.47.04-r4 ## Fixes From 80674f76977f38ad1750531d9e990c73957fd1cd Mon Sep 17 00:00:00 2001 From: abstern <58846922+abstern@users.noreply.github.com> Date: Tue, 12 Jan 2021 21:37:51 +0100 Subject: [PATCH 04/37] [feature] autofarm: fallow farms when no further plants requested --- plugins/autofarm.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/plugins/autofarm.cpp b/plugins/autofarm.cpp index dd7aca977..a50f761d2 100644 --- a/plugins/autofarm.cpp +++ b/plugins/autofarm.cpp @@ -201,11 +201,26 @@ public: { // this algorithm attempts to change as few farms as possible, while ensuring that // the number of farms planting each eligible plant is "as equal as possible" - - if (farms.empty() || plants.empty()) - return; // do nothing if there are no farms or no plantable plants - + int season = *df::global::cur_season; + + if (farms.empty() || plants.empty()) + { + // if no more plants were requested, fallow all farms + // if there were no farms, do nothing + for (auto farm : farms) + { + int o = farm->plant_id[season]; + if (o != -1) + { + farm->plant_id[season] = -1; + out << "autofarm: changing farm #" << farm->id << + " from " << ((o == -1) ? "NONE" : world->raws.plants.all[o]->name) << + " to NONE" << endl; + } + } + return; + } int min = farms.size() / plants.size(); // the number of farms that should plant each eligible plant, rounded down int extra = farms.size() - min * plants.size(); // the remainder that cannot be evenly divided From d4fbf4261fc0c00fbd93a8aeb8dbbe0250349a62 Mon Sep 17 00:00:00 2001 From: myk002 Date: Tue, 12 Jan 2021 23:27:14 -0800 Subject: [PATCH 05/37] address review comments --- library/lua/gui/widgets.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 2d056a599..d9d8d4bf4 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -234,11 +234,10 @@ end function render_text(obj,dc,x0,y0,pen,dpen,disabled) local width = 0 - for iline,line in ipairs(obj.text_lines) do - if dc and obj.start_line_num and iline < obj.start_line_num then - goto continue - end - local x = 0 + -- note that lines outside of the containing frame are not displayed, so + -- we only have to bound the start condition, not the end condition + for iline = dc and obj.start_line_num or 1, #obj.text_lines do + local x, line = 0, obj.text_lines[iline] if dc then local offset = (obj.start_line_num or 1) - 1 dc:seek(x+x0,y0+iline-offset-1) @@ -327,7 +326,6 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled) token.x2 = x end width = math.max(width, x) - ::continue:: end obj.text_width = width end From 78df8902172b2d6518014bf78357b03b961afb8b Mon Sep 17 00:00:00 2001 From: abstern <58846922+abstern@users.noreply.github.com> Date: Wed, 13 Jan 2021 08:55:48 +0100 Subject: [PATCH 06/37] factor out functions to get plant names and set individual farms --- plugins/autofarm.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/plugins/autofarm.cpp b/plugins/autofarm.cpp index a50f761d2..b20158ce2 100644 --- a/plugins/autofarm.cpp +++ b/plugins/autofarm.cpp @@ -197,6 +197,27 @@ public: } } + string get_plant_name(int plant_id) + { + df::plant_raw *raw = df::plant_raw::find(plant_id); + if (raw) + return raw->name; + else + return "NONE"; + } + + void set_farm(color_ostream& out, int new_plant_id, df::building_farmplotst* farm, int season) + { + int old_plant_id = farm->plant_id[season]; + if (old_plant_id != new_plant_id) + { + farm->plant_id[season] = new_plant_id; + out << "autofarm: changing farm #" << farm->id << + " from " << get_plant_name(old_plant_id) << + " to " << get_plant_name(new_plant_id) << endl; + } + } + void set_farms(color_ostream& out, set plants, vector farms) { // this algorithm attempts to change as few farms as possible, while ensuring that @@ -210,14 +231,7 @@ public: // if there were no farms, do nothing for (auto farm : farms) { - int o = farm->plant_id[season]; - if (o != -1) - { - farm->plant_id[season] = -1; - out << "autofarm: changing farm #" << farm->id << - " from " << ((o == -1) ? "NONE" : world->raws.plants.all[o]->name) << - " to NONE" << endl; - } + set_farm(out, -1, farm, season); } return; } @@ -251,11 +265,7 @@ public: { // pick one of the excess farms and change it to plant this plant df::building_farmplotst* farm = toChange.front(); - int o = farm->plant_id[season]; - farm->plant_id[season] = n; - out << "autofarm: changing farm #" << farm->id << - " from " << ((o == -1) ? "NONE" : world->raws.plants.all[o]->name) << - " to " << ((n == -1) ? "NONE" : world->raws.plants.all[n]->name) << endl; + set_farm(out, n, farm, season); toChange.pop(); if (c++ == min) extra--; From 5a2181d55eb860809828d389d774f1e056fe6b1e Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 13 Jan 2021 22:02:22 -0800 Subject: [PATCH 07/37] don't render overflow text --- library/lua/gui/widgets.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index d9d8d4bf4..29d5aa827 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -234,13 +234,14 @@ end function render_text(obj,dc,x0,y0,pen,dpen,disabled) local width = 0 - -- note that lines outside of the containing frame are not displayed, so - -- we only have to bound the start condition, not the end condition for iline = dc and obj.start_line_num or 1, #obj.text_lines do local x, line = 0, obj.text_lines[iline] if dc then local offset = (obj.start_line_num or 1) - 1 - dc:seek(x+x0,y0+iline-offset-1) + local y = y0 + iline - offset - 1 + -- skip text outside of the containing frame + if y > dc.height - 1 then break end + dc:seek(x+x0, y) end for _,token in ipairs(line) do token.line = iline From b506f0a2403beb862a2ac6eece1540c29156969f Mon Sep 17 00:00:00 2001 From: Susan Date: Sat, 16 Jan 2021 23:01:25 +0000 Subject: [PATCH 08/37] remove misleading comment per https://github.com/DFHack/dfhack/issues/682#issuecomment-138705257, seedwatch supports linux and has done for over a decade. --- plugins/seedwatch.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index 5f254a955..bc65bc4ff 100644 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -1,4 +1,3 @@ -// This does not work with Linux Dwarf Fortress // With thanks to peterix for DFHack and Quietust for information http://www.bay12forums.com/smf/index.php?topic=91166.msg2605147#msg2605147 #include From 7a14bf475ffa020b53bbc67b8fb482068536880d Mon Sep 17 00:00:00 2001 From: Susan Date: Sat, 16 Jan 2021 23:23:05 +0000 Subject: [PATCH 09/37] don't turn off seedwatch on map load fixes #682 --- plugins/seedwatch.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index bc65bc4ff..378433957 100644 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -283,6 +283,9 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan { switch (event) { case SC_MAP_LOADED: + if(running) + out.print("seedwatch supervision started.\n"); + break; case SC_MAP_UNLOADED: if (running) out.printerr("seedwatch deactivated due to game load/unload\n"); From 84b07005d874e6c4c0d9198caf7f62bf623d59cc Mon Sep 17 00:00:00 2001 From: Susan Date: Sat, 16 Jan 2021 23:47:41 +0000 Subject: [PATCH 10/37] tabs to spaces [whoops] --- plugins/seedwatch.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index 378433957..3be0bf845 100644 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -283,9 +283,9 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan { switch (event) { case SC_MAP_LOADED: - if(running) - out.print("seedwatch supervision started.\n"); - break; + if(running) + out.print("seedwatch supervision started.\n"); + break; case SC_MAP_UNLOADED: if (running) out.printerr("seedwatch deactivated due to game load/unload\n"); From b57286c59c2dc26f3b2c869fcf7a56488da76be1 Mon Sep 17 00:00:00 2001 From: Susan Date: Sun, 17 Jan 2021 17:32:31 +0000 Subject: [PATCH 11/37] update changelog --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index fdc7c13e7..2e46d7644 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -35,6 +35,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature +- `seedwatch`: don't turn off upon map load # 0.47.04-r4 From cd476a943c905e59e146066952d246e6cd594fd1 Mon Sep 17 00:00:00 2001 From: myk002 Date: Sun, 24 Jan 2021 09:00:38 -0800 Subject: [PATCH 12/37] fix quickfort library aliases for weapons --- data/quickfort/aliases-common.txt | 6 +++--- docs/changelog.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index d021a2f5f..39eeed88c 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -338,9 +338,9 @@ enableweapons: {weaponsprefix}e^ disableweapons: {weaponsprefix}d^ metalweapons: {forbidtrapcomponents}{forbidstoneweapons}{forbidotherweapons} -ironweapons: {metalweapons}{forbidweapons}{permitironweapons} -copperweapons: {metalweapons}{forbidweapons}{permitcopperweapons} -steelweapons: {metalweapons}{forbidweapons}{permitsteelweapons} +ironweapons: {metalweapons}{forbidmetalweapons}{permitironweapons} +copperweapons: {metalweapons}{forbidmetalweapons}{permitcopperweapons} +steelweapons: {metalweapons}{forbidmetalweapons}{permitsteelweapons} forbidweapons: {weaponsprefix}{Right}f^ forbidtrapcomponents: {weaponsprefix}{Right}{Down}f^ diff --git a/docs/changelog.txt b/docs/changelog.txt index 758a54fb5..3bfb23e91 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature - `embark-assistant`: improved performance of surveying +- `quickfort`: fix library aliases for iron, copper, and steel weapons ## Misc Improvements - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` From cf8f9386f4b6207145edf241eca1c202660e0777 Mon Sep 17 00:00:00 2001 From: myk002 Date: Sun, 24 Jan 2021 17:02:26 -0800 Subject: [PATCH 13/37] add alias for bronze weapons --- data/quickfort/aliases-common.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index 39eeed88c..650d38a3e 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -339,6 +339,7 @@ disableweapons: {weaponsprefix}d^ metalweapons: {forbidtrapcomponents}{forbidstoneweapons}{forbidotherweapons} ironweapons: {metalweapons}{forbidmetalweapons}{permitironweapons} +bronzeweapons: {metalweapons}{forbidmetalweapons}{permitbronzeweapons} copperweapons: {metalweapons}{forbidmetalweapons}{permitcopperweapons} steelweapons: {metalweapons}{forbidmetalweapons}{permitsteelweapons} @@ -348,6 +349,7 @@ forbidmetalweapons: {weaponsprefix}{Right}{Down 2}f^ forbidstoneweapons: {weaponsprefix}{Right}{Down 3}f^ forbidotherweapons: {weaponsprefix}{Right}{Down 4}f^ forbidironweapons: {weaponsprefix}{Right}{Down 2}{Right}&^ +forbidbronzeweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 6}&^ forbidcopperweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 3}&^ forbidsteelweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 8}&^ @@ -357,6 +359,7 @@ permitmetalweapons: {weaponsprefix}{Right}{Down 2}p^ permitstoneweapons: {weaponsprefix}{Right}{Down 3}p^ permitotherweapons: {weaponsprefix}{Right}{Down 4}p^ permitironweapons: {forbidironweapons} +permitbronzeweapons: {forbidbronzeweapons} permitcopperweapons: {forbidcopperweapons} permitsteelweapons: {forbidsteelweapons} From 99fa1916f8f4edd77ae678aa14401d9b381c6bb7 Mon Sep 17 00:00:00 2001 From: myk002 Date: Sun, 24 Jan 2021 17:03:13 -0800 Subject: [PATCH 14/37] update changelog --- docs/changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 3bfb23e91..51254d116 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,7 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature - `embark-assistant`: improved performance of surveying -- `quickfort`: fix library aliases for iron, copper, and steel weapons +- `quickfort`: fix library aliases for iron, copper, and steel weapons; add aliases for bronze weapons ## Misc Improvements - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` From 3372099f964b9ff3ecfe9011e0c607dc9b10cbd8 Mon Sep 17 00:00:00 2001 From: myk002 Date: Sun, 24 Jan 2021 17:11:17 -0800 Subject: [PATCH 15/37] add aliases for bronze armor too --- data/quickfort/aliases-common.txt | 3 +++ docs/changelog.txt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index 650d38a3e..609746e50 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -384,18 +384,21 @@ disablearmor: {armorprefix}d^ metalarmor: {forbidotherarmor} otherarmor: {forbidmetalarmor} ironarmor: {metalarmor}{forbidmetalarmor}{permitironarmor} +bronzearmor: {metalarmor}{forbidmetalarmor}{permitbronzearmor} copperarmor: {metalarmor}{forbidmetalarmor}{permitcopperarmor} steelarmor: {metalarmor}{forbidmetalarmor}{permitsteelarmor} forbidmetalarmor: {armorprefix}{Right}{Down 6}f^ forbidotherarmor: {armorprefix}{Right}{Down 7}f^ forbidironarmor: {armorprefix}{Right}{Down 6}{Right}&^ +forbidbronzearmor: {armorprefix}{Right}{Down 6}{Right}{Down 6}&^ forbidcopperarmor: {armorprefix}{Right}{Down 6}{Right}{Down 3}&^ forbidsteelarmor: {armorprefix}{Right}{Down 6}{Right}{Down 8}&^ permitmetalarmor: {armorprefix}{Right}{Down 6}p^ permitotherarmor: {armorprefix}{Right}{Down 7}p^ permitironarmor: {forbidironarmor} +permitcopperarmor: {forbidbronzearmor} permitcopperarmor: {forbidcopperarmor} permitsteelarmor: {forbidsteelarmor} diff --git a/docs/changelog.txt b/docs/changelog.txt index 51254d116..01dc36faa 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,7 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature - `embark-assistant`: improved performance of surveying -- `quickfort`: fix library aliases for iron, copper, and steel weapons; add aliases for bronze weapons +- `quickfort`: fix library aliases for iron, copper, and steel weapons; add aliases for bronze weapons and armor ## Misc Improvements - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` From a32a90570862ac68c5e3139bf37dd1b096719196 Mon Sep 17 00:00:00 2001 From: myk002 Date: Mon, 25 Jan 2021 14:53:10 -0800 Subject: [PATCH 16/37] fix typo --- data/quickfort/aliases-common.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index 609746e50..603ee4e15 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -398,7 +398,7 @@ forbidsteelarmor: {armorprefix}{Right}{Down 6}{Right}{Down 8}&^ permitmetalarmor: {armorprefix}{Right}{Down 6}p^ permitotherarmor: {armorprefix}{Right}{Down 7}p^ permitironarmor: {forbidironarmor} -permitcopperarmor: {forbidbronzearmor} +permitbronzearmor: {forbidbronzearmor} permitcopperarmor: {forbidcopperarmor} permitsteelarmor: {forbidsteelarmor} From a0151cc157e3b38b86e06095fecbe5b0de3b71fb Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 27 Jan 2021 08:20:00 -0800 Subject: [PATCH 17/37] add 'crafts' alias --- data/quickfort/aliases-common.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index 603ee4e15..e6482b407 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -312,7 +312,8 @@ finishedgoodsprefix: {enter_sp_config}{Down 10} enablefinishedgoods: {finishedgoodsprefix}e^ disablefinishedgoods: {finishedgoodsprefix}d^ -jugs: {finishedgoodsprefix}{Right}f{Right}{Up 2}&{Left}{Down 2}f{Down}f{Down}f^ +crafts: {finishedgoodsprefix}{Right}f{Right}{Down 9}{togglesequence 9}^ +jugs: {finishedgoodsprefix}{Right}f{Right}{Up 2}&{Left}{Down 2}f{Down}f{Down}f^ ################################## From b7c598bb07ffdceab107ee6ad885d3919143c21e Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 27 Jan 2021 08:21:34 -0800 Subject: [PATCH 18/37] update changelog --- docs/changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 01dc36faa..3d968f09f 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,7 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature - `embark-assistant`: improved performance of surveying -- `quickfort`: fix library aliases for iron, copper, and steel weapons; add aliases for bronze weapons and armor +- `quickfort`: fix library aliases for iron, copper, and steel weapons; add aliases for bronze weapons and armor; add alias for tradeable crafts ## Misc Improvements - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` From 42ae0727fe9c0879fd21248f55ca0394a21f6e3e Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 27 Jan 2021 08:37:12 -0800 Subject: [PATCH 19/37] resolve hotkey help text conflict between stockflow and stockpiles I removed stockpiles's dynamic placement code as well. it attempted to move the hotkey help text down if it covered any stockpile links, but this will no longer work since other hotkey text already takes up all the lines below stockpiles' hotkey text. --- docs/changelog.txt | 1 + plugins/stockpiles/stockpiles.cpp | 13 +------------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index c947797f7..bd22793c7 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -37,6 +37,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `embark-assistant`: fixed order of factors when calculating min temperature - `embark-assistant`: improved performance of surveying - `quickfort`: creating zones no longer causes eventual crashes +- `stockpiles`: no longer outputs hotkey help text beneath `stockflow` hotkey help text ## Misc Improvements - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` diff --git a/plugins/stockpiles/stockpiles.cpp b/plugins/stockpiles/stockpiles.cpp index 51d4ccb53..4b94de497 100644 --- a/plugins/stockpiles/stockpiles.cpp +++ b/plugins/stockpiles/stockpiles.cpp @@ -409,18 +409,7 @@ struct stockpiles_import_hook : public df::viewscreen_dwarfmodest auto dims = Gui::getDwarfmodeViewDims(); int left_margin = dims.menu_x1 + 1; int x = left_margin; - int y = dims.y2 - 3; - - int links = 0; - links += sp->links.give_to_pile.size(); - links += sp->links.take_from_pile.size(); - links += sp->links.give_to_workshop.size(); - links += sp->links.take_from_workshop.size(); - if ( links + 12 >= y ) - { - y += 1; - } - + int y = dims.y2 - 7; // above automelt, autotrade, stocks, and stockflow OutputHotkeyString ( x, y, "Load/Save Settings", "l", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED ); } }; From bd75c4293f9224ddc88e6fe59f3df59e62454251 Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 27 Jan 2021 13:23:17 -0800 Subject: [PATCH 20/37] add forbidcrafts alias --- data/quickfort/aliases-common.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index e6482b407..9cef22417 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -315,6 +315,10 @@ disablefinishedgoods: {finishedgoodsprefix}d^ crafts: {finishedgoodsprefix}{Right}f{Right}{Down 9}{togglesequence 9}^ jugs: {finishedgoodsprefix}{Right}f{Right}{Up 2}&{Left}{Down 2}f{Down}f{Down}f^ +forbidcrafts: {finishedgoodsprefix}{Right 2}{Down 9}{togglesequence 9}^ + +permitcrafts: {forbidcrafts} + ################################## # cloth From aeb911878b69ff7bf7710d115e44f148e79dddd2 Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 27 Jan 2021 14:57:03 -0800 Subject: [PATCH 21/37] document new aliases --- docs/guides/quickfort-alias-guide.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/guides/quickfort-alias-guide.rst b/docs/guides/quickfort-alias-guide.rst index 7cd8e26c1..aedb07173 100644 --- a/docs/guides/quickfort-alias-guide.rst +++ b/docs/guides/quickfort-alias-guide.rst @@ -760,11 +760,12 @@ cutstone forbidcutstone Finished goods stockpile adjustments ```````````````````````````````````` -+-----------+ -| Exclusive | -+===========+ -| jugs | -+-----------+ +========= ============ ============ +Exclusive Forbid Permit +========= ============ ============ +jugs +crafts forbidcrafts permitcrafts +========= ============ ============ Cloth stockpile adjustments ``````````````````````````` @@ -793,6 +794,7 @@ metalweapons forbidmetalweapons permitmetalweapons \ forbidstoneweapons permitstoneweapons \ forbidotherweapons permitotherweapons ironweapons forbidironweapons permitironweapons +bronzeweapons forbidbronzeweapons permitbronzeweapons copperweapons forbidcopperweapons permitcopperweapons steelweapons forbidsteelweapons permitsteelweapons masterworkweapons forbidmasterworkweapons permitmasterworkweapons @@ -808,6 +810,7 @@ Exclusive Forbid Permit metalarmor forbidmetalarmor permitmetalarmor otherarmor forbidotherarmor permitotherarmor ironarmor forbidironarmor permitironarmor +bronzearmor forbidbronzearmor permitbronzearmor copperarmor forbidcopperarmor permitcopperarmor steelarmor forbidsteelarmor permitsteelarmor masterworkarmor forbidmasterworkarmor permitmasterworkarmor From 98f3142c92e4410b0c9f4e7657f819b5ab5092b4 Mon Sep 17 00:00:00 2001 From: Su Date: Thu, 28 Jan 2021 18:00:34 +0000 Subject: [PATCH 22/37] change deactivation message to be more accurate Co-authored-by: Alan --- plugins/seedwatch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index 3be0bf845..83e2e1be9 100644 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -288,7 +288,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan break; case SC_MAP_UNLOADED: if (running) - out.printerr("seedwatch deactivated due to game load/unload\n"); + out.printerr("seedwatch deactivated due to game unload\n"); running = false; break; default: From 8a728c5170398335a0199f71567de732f63895dc Mon Sep 17 00:00:00 2001 From: myk002 Date: Thu, 28 Jan 2021 12:17:26 -0800 Subject: [PATCH 23/37] fix tallow alias --- data/quickfort/aliases-common.txt | 4 ++-- docs/changelog.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index 9cef22417..483085bb4 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -104,7 +104,7 @@ plants: {foodprefix}b{Right}{Down 4}p^ booze: {foodprefix}b{Right}{Down 5}p{Down}p^ seeds: {foodprefix}b{Right}{Down 9}p^ dye: {foodprefix}b{Right}{Down 11}{Right}{Down 28}{togglesequence 4}^ -tallow: {foodprefix}b{Right}{Down 13}{Right}{Down}{togglesequence2 811}^ +tallow: {foodprefix}b{Right}{Down 13}{Right}{Down}{togglesequence2 822}^ miscliquid: {foodprefix}b{Right}{Down 18}p^ forbidpreparedfood: {foodprefix}u^ @@ -113,7 +113,7 @@ forbidplants: {foodprefix}{Right}{Down 4}f^ forbidbooze: {foodprefix}{Right}{Down 5}f{Down}f^ forbidseeds: {foodprefix}{Right}{Down 9}f^ forbiddye: {foodprefix}{Right}{Down 11}{Right}{Down 28}{togglesequence 4}^ -forbidtallow: {foodprefix}{Right}{Down 13}{Right}{Down}{togglesequence2 811}^ +forbidtallow: {foodprefix}{Right}{Down 13}{Right}{Down}{togglesequence2 822}^ forbidmiscliquid: {foodprefix}{Right}{Down 18}f^ permitpreparedfood: {forbidpreparedfood} diff --git a/docs/changelog.txt b/docs/changelog.txt index 3d968f09f..bf9b9fbfc 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,7 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature - `embark-assistant`: improved performance of surveying -- `quickfort`: fix library aliases for iron, copper, and steel weapons; add aliases for bronze weapons and armor; add alias for tradeable crafts +- `quickfort`: fix library aliases for tallow and iron, copper, and steel weapons; add aliases for bronze weapons and armor; add alias for tradeable crafts ## Misc Improvements - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` From a3b0cda069cda0f27ac7a1c63c4f879fd8d23dcd Mon Sep 17 00:00:00 2001 From: Susan Date: Fri, 29 Jan 2021 11:26:46 +0000 Subject: [PATCH 24/37] don't enable if no world is loaded --- plugins/seedwatch.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index 3be0bf845..171b2d9a4 100644 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -142,8 +142,17 @@ command_result df_seedwatch(color_ostream &out, vector& parameters) } else if(par == "start") { - running = true; - out.print("seedwatch supervision started.\n"); + if(Core::getInstance().isWorldLoaded()) + { + running = true; + out.print("seedwatch supervision started.\n"); + } else { + out.printerr( + "This plugin needs a fortress to be loaded and will deactivate automatically otherwise.\n" + "Activate with 'seedwatch start' after you load the game.\n" + ); + } + } else if(par == "stop") { From 4bad609e3377d7f9171eaff2f77f7fcafa400ebd Mon Sep 17 00:00:00 2001 From: myk002 Date: Fri, 29 Jan 2021 12:20:25 -0800 Subject: [PATCH 25/37] use the search plugin for tallow aliases and document the dependency --- data/quickfort/aliases-common.txt | 6 +++--- docs/guides/quickfort-alias-guide.rst | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index 483085bb4..721aadacf 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -104,7 +104,7 @@ plants: {foodprefix}b{Right}{Down 4}p^ booze: {foodprefix}b{Right}{Down 5}p{Down}p^ seeds: {foodprefix}b{Right}{Down 9}p^ dye: {foodprefix}b{Right}{Down 11}{Right}{Down 28}{togglesequence 4}^ -tallow: {foodprefix}b{Right}{Down 13}{Right}{Down}{togglesequence2 822}^ +tallow: {foodprefix}b{Right}{Down 13}{Right}stallow&p^ miscliquid: {foodprefix}b{Right}{Down 18}p^ forbidpreparedfood: {foodprefix}u^ @@ -113,7 +113,7 @@ forbidplants: {foodprefix}{Right}{Down 4}f^ forbidbooze: {foodprefix}{Right}{Down 5}f{Down}f^ forbidseeds: {foodprefix}{Right}{Down 9}f^ forbiddye: {foodprefix}{Right}{Down 11}{Right}{Down 28}{togglesequence 4}^ -forbidtallow: {foodprefix}{Right}{Down 13}{Right}{Down}{togglesequence2 822}^ +forbidtallow: {foodprefix}{Right}{Down 13}{Right}stallow&f^ forbidmiscliquid: {foodprefix}{Right}{Down 18}f^ permitpreparedfood: {forbidpreparedfood} @@ -122,7 +122,7 @@ permitplants: {foodprefix}{Right}{Down 4}p^ permitbooze: {foodprefix}{Right}{Down 5}p{Down}p^ permitseeds: {foodprefix}{Right}{Down 9}p^ permitdye: {forbiddye} -permittallow: {forbidtallow} +permittallow: {foodprefix}{Right}{Down 13}{Right}stallow&p^ permitmiscliquid: {foodprefix}{Right}{Down 18}p^ # the next two aliases are for compatibility with previous implementations of diff --git a/docs/guides/quickfort-alias-guide.rst b/docs/guides/quickfort-alias-guide.rst index aedb07173..efd8daea1 100644 --- a/docs/guides/quickfort-alias-guide.rst +++ b/docs/guides/quickfort-alias-guide.rst @@ -282,14 +282,18 @@ library, discussing their intended usage and detailing sub-aliases that you can define to customize their behavior. If you do define your own custom aliases in -``dfhack-config/quickfort/aliases.txt``, try to build on the library aliases. -For example, if you create an alias to modify particular furniture stockpile -settings, start your alias with ``{furnitureprefix}`` instead of -``s{Down 2}``. Using library prefixes will allow sub-aliases to work with your -aliases just like they do with library aliases. In this case, using +``dfhack-config/quickfort/aliases.txt``, try to build on library alias +components. For example, if you create an alias to modify particular furniture +stockpile settings, start your alias with ``{furnitureprefix}`` instead of +``s{Down 2}``. Using library prefixes will allow library sub-aliases to work +with your aliases just like they do with library aliases. In this case, using ``{furnitureprefix}`` will allow your stockpile customization alias to work with both stockpiles and hauling routes. +Note that some aliases use the DFHack-provided search prompts. If you get errors +while running ``#query`` blueprints, ensure the DFHack `search ` +plugin is enabled. + Naming aliases ~~~~~~~~~~~~~~ From 8e53fb450cd0b24097a5547c9862e627a6fd1ea0 Mon Sep 17 00:00:00 2001 From: myk002 Date: Sat, 30 Jan 2021 00:56:36 -0800 Subject: [PATCH 26/37] use normal title replacement for search-plugin --- docs/guides/quickfort-alias-guide.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/quickfort-alias-guide.rst b/docs/guides/quickfort-alias-guide.rst index efd8daea1..447f6d236 100644 --- a/docs/guides/quickfort-alias-guide.rst +++ b/docs/guides/quickfort-alias-guide.rst @@ -291,8 +291,8 @@ with your aliases just like they do with library aliases. In this case, using with both stockpiles and hauling routes. Note that some aliases use the DFHack-provided search prompts. If you get errors -while running ``#query`` blueprints, ensure the DFHack `search ` -plugin is enabled. +while running ``#query`` blueprints, ensure the DFHack `search-plugin` plugin is +enabled. Naming aliases ~~~~~~~~~~~~~~ From 8540fd84a4924d132a40dcf7218e5b1cc00be466 Mon Sep 17 00:00:00 2001 From: Susan Date: Sat, 30 Jan 2021 15:14:46 +0000 Subject: [PATCH 27/37] move world loaded check and message printing to plugin_enable() --- plugins/seedwatch.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index 36863ec8d..f233cb27f 100644 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -100,7 +100,23 @@ string searchAbbreviations(string in) DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) { - running = enable; + if(enable == true) + { + if(Core::getInstance().isWorldLoaded()) + { + running = true; + out.print("seedwatch supervision started.\n"); + } else { + out.printerr( + "This plugin needs a fortress to be loaded and will deactivate automatically otherwise.\n" + "Activate with 'seedwatch start' after you load the game.\n" + ); + } + } else { + running = false; + out.print("seedwatch supervision stopped.\n"); + } + return CR_OK; } @@ -142,22 +158,12 @@ command_result df_seedwatch(color_ostream &out, vector& parameters) } else if(par == "start") { - if(Core::getInstance().isWorldLoaded()) - { - running = true; - out.print("seedwatch supervision started.\n"); - } else { - out.printerr( - "This plugin needs a fortress to be loaded and will deactivate automatically otherwise.\n" - "Activate with 'seedwatch start' after you load the game.\n" - ); - } + plugin_enable(out, true); } else if(par == "stop") { - running = false; - out.print("seedwatch supervision stopped.\n"); + plugin_enable(out, false); } else if(par == "clear") { From 62870e9aeebdc541d4b5deebf77d44d28ec38d2f Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 30 Jan 2021 18:08:17 -0500 Subject: [PATCH 28/37] Remove extra log statement, reorder changelog ref #1753 --- docs/changelog.txt | 2 +- plugins/seedwatch.cpp | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index d5edef15c..d06037b87 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -35,9 +35,9 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature -- `seedwatch`: don't turn off upon map load - `embark-assistant`: improved performance of surveying - `quickfort`: creating zones no longer causes eventual crashes +- `seedwatch`: fixed an issue where the plugin would disable itself on map load - `search`: fixed crash when searching the ``k`` sidebar and navigating to another tile with certain keys, like ``<`` or ``>`` - `stockflow`: fixed ``j`` character being intercepted when naming stockpiles diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index f233cb27f..9a54d4f1a 100644 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -296,18 +296,10 @@ DFhackCExport command_result plugin_init(color_ostream &out, vector Date: Sat, 30 Jan 2021 18:08:32 -0500 Subject: [PATCH 29/37] Update xml --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index 4b3b0f004..be0444cc1 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 4b3b0f0046af33749bf3e5e61f1374c4c461d332 +Subproject commit be0444cc165a1abff053d5893dc1f780f06526b7 From 6c379752fe2e4fbab879c6197309857710f4fe26 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 30 Jan 2021 18:11:39 -0500 Subject: [PATCH 30/37] Update changelog, authors Ref #1752, #1753 --- docs/Authors.rst | 2 ++ docs/changelog.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/docs/Authors.rst b/docs/Authors.rst index b9edfa3d5..bfac252a1 100644 --- a/docs/Authors.rst +++ b/docs/Authors.rst @@ -10,6 +10,7 @@ or make a pull request! Name Github Other ======================= ======================= =========================== 8Z 8Z +Abel abstern acwatkins acwatkins Alexander Gavrilov angavrilov ag Amostubal Amostubal @@ -158,6 +159,7 @@ simon Simon Jackson sizeak stolencatkarma Stoyan Gaydarov sgayda2 +Su Moth-Tolias suokko suokko shrieker sv-esk sv-esk Tachytaenius wolfboyft diff --git a/docs/changelog.txt b/docs/changelog.txt index d06037b87..1c6541d4b 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -42,6 +42,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `stockflow`: fixed ``j`` character being intercepted when naming stockpiles ## Misc Improvements +- `autofarm`: now fallows farms if all plants have reached the desired count - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` - `buildingplan`: add 'enable all' option for buildingplan (so you don't have to enable all building types individually). this setting is not persisted (just like quickfort_mode is not persisted), but it can be set from onMapLoad.init - `buildingplan`: modified ``Planning Mode`` status in the UI to show whether we're in quickfort mode, enable all mode, or whether just the building type is enabled. From 7e12f3fd3d1cd8f766f8093e10a1f38de61f0aab Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 30 Jan 2021 19:40:15 -0500 Subject: [PATCH 31/37] Fix off-by-one, adjust changelog, move scroll keys to consistent place Ref #1748 --- docs/changelog.txt | 4 +--- library/lua/gui/widgets.lua | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 0fa9872c2..aee5aa850 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -42,6 +42,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `stockflow`: fixed ``j`` character being intercepted when naming stockpiles ## Misc Improvements +- Lua label widgets (used in all standard message boxes) are now scrollable with Up/Down/PgUp/PgDn keys - `autofarm`: now fallows farms if all plants have reached the desired count - `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` - `buildingplan`: add 'enable all' option for buildingplan (so you don't have to enable all building types individually). this setting is not persisted (just like quickfort_mode is not persisted), but it can be set from onMapLoad.init @@ -55,9 +56,6 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Documentation - Added documentation for Lua's ``dfhack.run_command()`` and variants -## Misc Improvements -- Lua widget library Label class (used in all standard message boxes) is now scrollable with Up/Down/PgUp/PgDn keys - # 0.47.04-r4 ## Fixes diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 29d5aa827..d3e32b910 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -29,6 +29,20 @@ local function map_opttab(tab,idx) end end +STANDARDSCROLL = { + STANDARDSCROLL_UP = -1, + STANDARDSCROLL_DOWN = 1, + STANDARDSCROLL_PAGEUP = '-page', + STANDARDSCROLL_PAGEDOWN = '+page', +} + +SECONDSCROLL = { + SECONDSCROLL_UP = -1, + SECONDSCROLL_DOWN = 1, + SECONDSCROLL_PAGEUP = '-page', + SECONDSCROLL_PAGEDOWN = '+page', +} + ------------ -- Widget -- ------------ @@ -344,13 +358,6 @@ end Label = defclass(Label, Widget) -STANDARDSCROLL = { - STANDARDSCROLL_UP = -1, - STANDARDSCROLL_DOWN = 1, - STANDARDSCROLL_PAGEUP = '-page', - STANDARDSCROLL_PAGEDOWN = '+page', -} - Label.ATTRS{ text_pen = COLOR_WHITE, text_dpen = COLOR_DARKGREY, -- disabled @@ -414,7 +421,7 @@ end function Label:scroll(nlines) local n = self.start_line_num + nlines - n = math.min(n, self:getTextHeight() - self.frame_body.height) + n = math.min(n, self:getTextHeight() - self.frame_body.height + 1) n = math.max(n, 1) self.start_line_num = n end @@ -447,13 +454,6 @@ end List = defclass(List, Widget) -SECONDSCROLL = { - SECONDSCROLL_UP = -1, - SECONDSCROLL_DOWN = 1, - SECONDSCROLL_PAGEUP = '-page', - SECONDSCROLL_PAGEDOWN = '+page', -} - List.ATTRS{ text_pen = COLOR_CYAN, cursor_pen = COLOR_LIGHTCYAN, From d80867d6eb3a33d873cb14e653c74c3751bdea37 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 30 Jan 2021 20:58:44 -0500 Subject: [PATCH 32/37] Update scripts --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index e20fa9f5c..3b7be1ac3 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit e20fa9f5ca7707377477b3d9c032ec1f3a2e6414 +Subproject commit 3b7be1ac34fb9a066c0d824cd427445274dad85a From eed1f2db6ae78440c6447e8abc4ca898ce3846d8 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 30 Jan 2021 21:03:05 -0500 Subject: [PATCH 33/37] Update scripts --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 3b7be1ac3..86788f5bf 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 3b7be1ac34fb9a066c0d824cd427445274dad85a +Subproject commit 86788f5bf975da2506c61372ebfbe36ca47ed57c From fd7c3fc4aae75338ab03d41dab286fb8819e0206 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 30 Jan 2021 21:12:06 -0500 Subject: [PATCH 34/37] Prevent stockpiles hotkey label from overlapping with autodump stockflow moved to last slot because it isn't enabled in dfhack.init-example Ref #1764 --- plugins/stockflow.cpp | 2 +- plugins/stockpiles/stockpiles.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/stockflow.cpp b/plugins/stockflow.cpp index 22e4abdf9..9533f1f6b 100644 --- a/plugins/stockflow.cpp +++ b/plugins/stockflow.cpp @@ -212,7 +212,7 @@ public: auto dims = Gui::getDwarfmodeViewDims(); int left_margin = dims.menu_x1 + 1; int x = left_margin; - int y = dims.y2 - 3; + int y = dims.y2 - 2; // below autodump, automelt, autotrade, stocks, stockpiles int links = 0; links += sp->links.give_to_pile.size(); diff --git a/plugins/stockpiles/stockpiles.cpp b/plugins/stockpiles/stockpiles.cpp index 4b94de497..f8f56b9bc 100644 --- a/plugins/stockpiles/stockpiles.cpp +++ b/plugins/stockpiles/stockpiles.cpp @@ -409,7 +409,7 @@ struct stockpiles_import_hook : public df::viewscreen_dwarfmodest auto dims = Gui::getDwarfmodeViewDims(); int left_margin = dims.menu_x1 + 1; int x = left_margin; - int y = dims.y2 - 7; // above automelt, autotrade, stocks, and stockflow + int y = dims.y2 - 3; // below autodump, automelt, autotrade, stocks; above stockflow OutputHotkeyString ( x, y, "Load/Save Settings", "l", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED ); } }; From d2f3ec607667c0b42e1307f94a801f58cfaa52db Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 30 Jan 2021 21:23:44 -0500 Subject: [PATCH 35/37] Bump to 0.47.04-r5, adjust changelog --- CMakeLists.txt | 2 +- docs/changelog.txt | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc9611eb9..3de10ea2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,7 +185,7 @@ endif() # set up versioning. set(DF_VERSION "0.47.04") -set(DFHACK_RELEASE "r4") +set(DFHACK_RELEASE "r5") set(DFHACK_PRERELEASE FALSE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") diff --git a/docs/changelog.txt b/docs/changelog.txt index d8081f96e..989a9c558 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -33,11 +33,13 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: # Future +# 0.47.04-r5 + ## Fixes - `embark-assistant`: fixed order of factors when calculating min temperature - `embark-assistant`: improved performance of surveying -- `quickfort`: creating zones no longer causes eventual crashes -- `quickfort`: fix library aliases for tallow and iron, copper, and steel weapons; add aliases for bronze weapons and armor; add alias for tradeable crafts +- `quickfort`: fixed eventual crashes when creating zones +- `quickfort`: fixed library aliases for tallow and iron, copper, and steel weapons - `seedwatch`: fixed an issue where the plugin would disable itself on map load - `search`: fixed crash when searching the ``k`` sidebar and navigating to another tile with certain keys, like ``<`` or ``>`` - `stockflow`: fixed ``j`` character being intercepted when naming stockpiles @@ -46,10 +48,12 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Misc Improvements - Lua label widgets (used in all standard message boxes) are now scrollable with Up/Down/PgUp/PgDn keys - `autofarm`: now fallows farms if all plants have reached the desired count -- `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` -- `buildingplan`: add 'enable all' option for buildingplan (so you don't have to enable all building types individually). this setting is not persisted (just like quickfort_mode is not persisted), but it can be set from onMapLoad.init -- `buildingplan`: modified ``Planning Mode`` status in the UI to show whether we're in quickfort mode, enable all mode, or whether just the building type is enabled. -- `quickfort`: Dreamfort blueprint set improvements: add a streamlined checklist for all required dreamfort commands and give names to stockpiles, levers, bridges, and zones +- `buildingplan`: added ability to set global settings from the console, e.g. ``buildingplan set boulders false`` +- `buildingplan`: added "enable all" option for buildingplan (so you don't have to enable all building types individually). This setting is not persisted (just like quickfort_mode is not persisted), but it can be set from onMapLoad.init +- `buildingplan`: modified ``Planning Mode`` status in the UI to show whether the plugin is in quickfort mode, "enable all" mode, or whether just the building type is enabled. +- `quickfort`: Dreamfort blueprint set improvements: added a streamlined checklist for all required dreamfort commands and gave names to stockpiles, levers, bridges, and zones +- `quickfort`: added aliases for bronze weapons and armor +- `quickfort`: added alias for tradeable crafts ## Lua - ``dfhack.run_command()``: changed to interface directly with the console when possible, which allows interactive commands and commands that detect the console encoding to work properly From 233925ec754a30b179d4d508690d90b0226368b6 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 31 Jan 2021 12:10:00 -0500 Subject: [PATCH 36/37] Bump to 0.47.05-alpha0, update xml --- CMakeLists.txt | 6 +++--- library/xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3de10ea2a..f17d8e6d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,9 +184,9 @@ if(NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhack endif() # set up versioning. -set(DF_VERSION "0.47.04") -set(DFHACK_RELEASE "r5") -set(DFHACK_PRERELEASE FALSE) +set(DF_VERSION "0.47.05") +set(DFHACK_RELEASE "alpha0") +set(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") diff --git a/library/xml b/library/xml index be0444cc1..ee1ea04d1 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit be0444cc165a1abff053d5893dc1f780f06526b7 +Subproject commit ee1ea04d1cc0f5d80da78b7872dba8b58eab55a5 From 353b8b71f528966c275dc1d2a33ea65678292a97 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 31 Jan 2021 13:24:21 -0500 Subject: [PATCH 37/37] Update xml --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index ee1ea04d1..b7222848d 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit ee1ea04d1cc0f5d80da78b7872dba8b58eab55a5 +Subproject commit b7222848dbfd4391d8acafc926303bc4f6253d24