Merge branch 'develop' into ea_refactoring

develop
bseiller 2021-02-01 23:36:04 +01:00
commit 56335977ab
12 changed files with 161 additions and 86 deletions

@ -184,9 +184,9 @@ if(NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhack
endif() endif()
# set up versioning. # set up versioning.
set(DF_VERSION "0.47.04") set(DF_VERSION "0.47.05")
set(DFHACK_RELEASE "r4") set(DFHACK_RELEASE "alpha0")
set(DFHACK_PRERELEASE FALSE) set(DFHACK_PRERELEASE TRUE)
set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")

@ -104,7 +104,7 @@ plants: {foodprefix}b{Right}{Down 4}p^
booze: {foodprefix}b{Right}{Down 5}p{Down}p^ booze: {foodprefix}b{Right}{Down 5}p{Down}p^
seeds: {foodprefix}b{Right}{Down 9}p^ seeds: {foodprefix}b{Right}{Down 9}p^
dye: {foodprefix}b{Right}{Down 11}{Right}{Down 28}{togglesequence 4}^ 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}stallow&p^
miscliquid: {foodprefix}b{Right}{Down 18}p^ miscliquid: {foodprefix}b{Right}{Down 18}p^
forbidpreparedfood: {foodprefix}u^ forbidpreparedfood: {foodprefix}u^
@ -113,7 +113,7 @@ forbidplants: {foodprefix}{Right}{Down 4}f^
forbidbooze: {foodprefix}{Right}{Down 5}f{Down}f^ forbidbooze: {foodprefix}{Right}{Down 5}f{Down}f^
forbidseeds: {foodprefix}{Right}{Down 9}f^ forbidseeds: {foodprefix}{Right}{Down 9}f^
forbiddye: {foodprefix}{Right}{Down 11}{Right}{Down 28}{togglesequence 4}^ 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}stallow&f^
forbidmiscliquid: {foodprefix}{Right}{Down 18}f^ forbidmiscliquid: {foodprefix}{Right}{Down 18}f^
permitpreparedfood: {forbidpreparedfood} permitpreparedfood: {forbidpreparedfood}
@ -122,7 +122,7 @@ permitplants: {foodprefix}{Right}{Down 4}p^
permitbooze: {foodprefix}{Right}{Down 5}p{Down}p^ permitbooze: {foodprefix}{Right}{Down 5}p{Down}p^
permitseeds: {foodprefix}{Right}{Down 9}p^ permitseeds: {foodprefix}{Right}{Down 9}p^
permitdye: {forbiddye} permitdye: {forbiddye}
permittallow: {forbidtallow} permittallow: {foodprefix}{Right}{Down 13}{Right}stallow&p^
permitmiscliquid: {foodprefix}{Right}{Down 18}p^ permitmiscliquid: {foodprefix}{Right}{Down 18}p^
# the next two aliases are for compatibility with previous implementations of # the next two aliases are for compatibility with previous implementations of
@ -312,8 +312,13 @@ finishedgoodsprefix: {enter_sp_config}{Down 10}
enablefinishedgoods: {finishedgoodsprefix}e^ enablefinishedgoods: {finishedgoodsprefix}e^
disablefinishedgoods: {finishedgoodsprefix}d^ 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^ 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 # cloth
@ -338,9 +343,10 @@ enableweapons: {weaponsprefix}e^
disableweapons: {weaponsprefix}d^ disableweapons: {weaponsprefix}d^
metalweapons: {forbidtrapcomponents}{forbidstoneweapons}{forbidotherweapons} metalweapons: {forbidtrapcomponents}{forbidstoneweapons}{forbidotherweapons}
ironweapons: {metalweapons}{forbidweapons}{permitironweapons} ironweapons: {metalweapons}{forbidmetalweapons}{permitironweapons}
copperweapons: {metalweapons}{forbidweapons}{permitcopperweapons} bronzeweapons: {metalweapons}{forbidmetalweapons}{permitbronzeweapons}
steelweapons: {metalweapons}{forbidweapons}{permitsteelweapons} copperweapons: {metalweapons}{forbidmetalweapons}{permitcopperweapons}
steelweapons: {metalweapons}{forbidmetalweapons}{permitsteelweapons}
forbidweapons: {weaponsprefix}{Right}f^ forbidweapons: {weaponsprefix}{Right}f^
forbidtrapcomponents: {weaponsprefix}{Right}{Down}f^ forbidtrapcomponents: {weaponsprefix}{Right}{Down}f^
@ -348,6 +354,7 @@ forbidmetalweapons: {weaponsprefix}{Right}{Down 2}f^
forbidstoneweapons: {weaponsprefix}{Right}{Down 3}f^ forbidstoneweapons: {weaponsprefix}{Right}{Down 3}f^
forbidotherweapons: {weaponsprefix}{Right}{Down 4}f^ forbidotherweapons: {weaponsprefix}{Right}{Down 4}f^
forbidironweapons: {weaponsprefix}{Right}{Down 2}{Right}&^ forbidironweapons: {weaponsprefix}{Right}{Down 2}{Right}&^
forbidbronzeweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 6}&^
forbidcopperweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 3}&^ forbidcopperweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 3}&^
forbidsteelweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 8}&^ forbidsteelweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 8}&^
@ -357,6 +364,7 @@ permitmetalweapons: {weaponsprefix}{Right}{Down 2}p^
permitstoneweapons: {weaponsprefix}{Right}{Down 3}p^ permitstoneweapons: {weaponsprefix}{Right}{Down 3}p^
permitotherweapons: {weaponsprefix}{Right}{Down 4}p^ permitotherweapons: {weaponsprefix}{Right}{Down 4}p^
permitironweapons: {forbidironweapons} permitironweapons: {forbidironweapons}
permitbronzeweapons: {forbidbronzeweapons}
permitcopperweapons: {forbidcopperweapons} permitcopperweapons: {forbidcopperweapons}
permitsteelweapons: {forbidsteelweapons} permitsteelweapons: {forbidsteelweapons}
@ -381,18 +389,21 @@ disablearmor: {armorprefix}d^
metalarmor: {forbidotherarmor} metalarmor: {forbidotherarmor}
otherarmor: {forbidmetalarmor} otherarmor: {forbidmetalarmor}
ironarmor: {metalarmor}{forbidmetalarmor}{permitironarmor} ironarmor: {metalarmor}{forbidmetalarmor}{permitironarmor}
bronzearmor: {metalarmor}{forbidmetalarmor}{permitbronzearmor}
copperarmor: {metalarmor}{forbidmetalarmor}{permitcopperarmor} copperarmor: {metalarmor}{forbidmetalarmor}{permitcopperarmor}
steelarmor: {metalarmor}{forbidmetalarmor}{permitsteelarmor} steelarmor: {metalarmor}{forbidmetalarmor}{permitsteelarmor}
forbidmetalarmor: {armorprefix}{Right}{Down 6}f^ forbidmetalarmor: {armorprefix}{Right}{Down 6}f^
forbidotherarmor: {armorprefix}{Right}{Down 7}f^ forbidotherarmor: {armorprefix}{Right}{Down 7}f^
forbidironarmor: {armorprefix}{Right}{Down 6}{Right}&^ forbidironarmor: {armorprefix}{Right}{Down 6}{Right}&^
forbidbronzearmor: {armorprefix}{Right}{Down 6}{Right}{Down 6}&^
forbidcopperarmor: {armorprefix}{Right}{Down 6}{Right}{Down 3}&^ forbidcopperarmor: {armorprefix}{Right}{Down 6}{Right}{Down 3}&^
forbidsteelarmor: {armorprefix}{Right}{Down 6}{Right}{Down 8}&^ forbidsteelarmor: {armorprefix}{Right}{Down 6}{Right}{Down 8}&^
permitmetalarmor: {armorprefix}{Right}{Down 6}p^ permitmetalarmor: {armorprefix}{Right}{Down 6}p^
permitotherarmor: {armorprefix}{Right}{Down 7}p^ permitotherarmor: {armorprefix}{Right}{Down 7}p^
permitironarmor: {forbidironarmor} permitironarmor: {forbidironarmor}
permitbronzearmor: {forbidbronzearmor}
permitcopperarmor: {forbidcopperarmor} permitcopperarmor: {forbidcopperarmor}
permitsteelarmor: {forbidsteelarmor} permitsteelarmor: {forbidsteelarmor}

@ -10,6 +10,7 @@ or make a pull request!
Name Github Other Name Github Other
======================= ======================= =========================== ======================= ======================= ===========================
8Z 8Z 8Z 8Z
Abel abstern
acwatkins acwatkins acwatkins acwatkins
Alexander Gavrilov angavrilov ag Alexander Gavrilov angavrilov ag
Amostubal Amostubal Amostubal Amostubal
@ -158,6 +159,7 @@ simon
Simon Jackson sizeak Simon Jackson sizeak
stolencatkarma stolencatkarma
Stoyan Gaydarov sgayda2 Stoyan Gaydarov sgayda2
Su Moth-Tolias
suokko suokko shrieker suokko suokko shrieker
sv-esk sv-esk sv-esk sv-esk
Tachytaenius wolfboyft Tachytaenius wolfboyft

@ -33,18 +33,27 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
# Future # Future
# 0.47.04-r5
## Fixes ## Fixes
- `embark-assistant`: fixed order of factors when calculating min temperature - `embark-assistant`: fixed order of factors when calculating min temperature
- `embark-assistant`: improved performance of surveying - `embark-assistant`: improved performance of surveying
- `quickfort`: creating zones no longer causes eventual crashes - `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 ``>`` - `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 - `stockflow`: fixed ``j`` character being intercepted when naming stockpiles
- `stockpiles`: no longer outputs hotkey help text beneath `stockflow` hotkey help text
## Misc Improvements ## Misc Improvements
- `buildingplan`: set global settings from the ``DFHack#`` prompt: e.g. ``buildingplan set boulders false`` - Lua label widgets (used in all standard message boxes) are now scrollable with Up/Down/PgUp/PgDn keys
- `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 - `autofarm`: now fallows farms if all plants have reached the desired count
- `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. - `buildingplan`: added ability to set global settings from the console, e.g. ``buildingplan set boulders false``
- `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 "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 ## 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 - ``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

@ -282,14 +282,18 @@ library, discussing their intended usage and detailing sub-aliases that you
can define to customize their behavior. can define to customize their behavior.
If you do define your own custom aliases in If you do define your own custom aliases in
``dfhack-config/quickfort/aliases.txt``, try to build on the library aliases. ``dfhack-config/quickfort/aliases.txt``, try to build on library alias
For example, if you create an alias to modify particular furniture stockpile components. For example, if you create an alias to modify particular furniture
settings, start your alias with ``{furnitureprefix}`` instead of stockpile settings, start your alias with ``{furnitureprefix}`` instead of
``s{Down 2}``. Using library prefixes will allow sub-aliases to work with your ``s{Down 2}``. Using library prefixes will allow library sub-aliases to work
aliases just like they do with library aliases. In this case, using with your aliases just like they do with library aliases. In this case, using
``{furnitureprefix}`` will allow your stockpile customization alias to work ``{furnitureprefix}`` will allow your stockpile customization alias to work
with both stockpiles and hauling routes. 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` plugin is
enabled.
Naming aliases Naming aliases
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
@ -760,11 +764,12 @@ cutstone forbidcutstone
Finished goods stockpile adjustments Finished goods stockpile adjustments
```````````````````````````````````` ````````````````````````````````````
+-----------+ ========= ============ ============
| Exclusive | Exclusive Forbid Permit
+===========+ ========= ============ ============
| jugs | jugs
+-----------+ crafts forbidcrafts permitcrafts
========= ============ ============
Cloth stockpile adjustments Cloth stockpile adjustments
``````````````````````````` ```````````````````````````
@ -793,6 +798,7 @@ metalweapons forbidmetalweapons permitmetalweapons
\ forbidstoneweapons permitstoneweapons \ forbidstoneweapons permitstoneweapons
\ forbidotherweapons permitotherweapons \ forbidotherweapons permitotherweapons
ironweapons forbidironweapons permitironweapons ironweapons forbidironweapons permitironweapons
bronzeweapons forbidbronzeweapons permitbronzeweapons
copperweapons forbidcopperweapons permitcopperweapons copperweapons forbidcopperweapons permitcopperweapons
steelweapons forbidsteelweapons permitsteelweapons steelweapons forbidsteelweapons permitsteelweapons
masterworkweapons forbidmasterworkweapons permitmasterworkweapons masterworkweapons forbidmasterworkweapons permitmasterworkweapons
@ -808,6 +814,7 @@ Exclusive Forbid Permit
metalarmor forbidmetalarmor permitmetalarmor metalarmor forbidmetalarmor permitmetalarmor
otherarmor forbidotherarmor permitotherarmor otherarmor forbidotherarmor permitotherarmor
ironarmor forbidironarmor permitironarmor ironarmor forbidironarmor permitironarmor
bronzearmor forbidbronzearmor permitbronzearmor
copperarmor forbidcopperarmor permitcopperarmor copperarmor forbidcopperarmor permitcopperarmor
steelarmor forbidsteelarmor permitsteelarmor steelarmor forbidsteelarmor permitsteelarmor
masterworkarmor forbidmasterworkarmor permitmasterworkarmor masterworkarmor forbidmasterworkarmor permitmasterworkarmor

@ -29,6 +29,20 @@ local function map_opttab(tab,idx)
end end
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 -- -- Widget --
------------ ------------
@ -234,10 +248,14 @@ end
function render_text(obj,dc,x0,y0,pen,dpen,disabled) function render_text(obj,dc,x0,y0,pen,dpen,disabled)
local width = 0 local width = 0
for iline,line in ipairs(obj.text_lines) do for iline = dc and obj.start_line_num or 1, #obj.text_lines do
local x = 0 local x, line = 0, obj.text_lines[iline]
if dc then if dc then
dc:seek(x+x0,y0+iline-1) local offset = (obj.start_line_num or 1) - 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 end
for _,token in ipairs(line) do for _,token in ipairs(line) do
token.line = iline token.line = iline
@ -350,9 +368,11 @@ Label.ATTRS{
auto_width = false, auto_width = false,
on_click = DEFAULT_NIL, on_click = DEFAULT_NIL,
on_rclick = DEFAULT_NIL, on_rclick = DEFAULT_NIL,
scroll_keys = STANDARDSCROLL,
} }
function Label:init(args) function Label:init(args)
self.start_line_num = 1
self:setText(args.text) self:setText(args.text)
if not self.text_hpen then if not self.text_hpen then
self.text_hpen = ((tonumber(self.text_pen) or tonumber(self.text_pen.fg) or 0) + 8) % 16 self.text_hpen = ((tonumber(self.text_pen) or tonumber(self.text_pen.fg) or 0) + 8) % 16
@ -399,16 +419,33 @@ function Label:onRenderBody(dc)
render_text(self,dc,0,0,text_pen,self.text_dpen,is_disabled(self)) render_text(self,dc,0,0,text_pen,self.text_dpen,is_disabled(self))
end end
function Label:scroll(nlines)
local n = self.start_line_num + nlines
n = math.min(n, self:getTextHeight() - self.frame_body.height + 1)
n = math.max(n, 1)
self.start_line_num = n
end
function Label:onInput(keys) function Label:onInput(keys)
if not is_disabled(self) then if is_disabled(self) then return false end
if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then
self:on_click() self:on_click()
end end
if keys._MOUSE_R_DOWN and self:getMousePos() and self.on_rclick then if keys._MOUSE_R_DOWN and self:getMousePos() and self.on_rclick then
self:on_rclick() self:on_rclick()
end end
return check_text_keys(self, keys) 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 false
end
end end
return check_text_keys(self, keys)
end end
---------- ----------
@ -417,20 +454,6 @@ end
List = defclass(List, Widget) List = defclass(List, Widget)
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',
}
List.ATTRS{ List.ATTRS{
text_pen = COLOR_CYAN, text_pen = COLOR_CYAN,
cursor_pen = COLOR_LIGHTCYAN, cursor_pen = COLOR_LIGHTCYAN,

@ -1 +1 @@
Subproject commit 4b3b0f0046af33749bf3e5e61f1374c4c461d332 Subproject commit b7222848dbfd4391d8acafc926303bc4f6253d24

@ -197,16 +197,45 @@ 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<int> plants, vector<df::building_farmplotst*> farms) void set_farms(color_ostream& out, set<int> plants, vector<df::building_farmplotst*> farms)
{ {
// this algorithm attempts to change as few farms as possible, while ensuring that // 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" // 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; 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)
{
set_farm(out, -1, farm, season);
}
return;
}
int min = farms.size() / plants.size(); // the number of farms that should plant each eligible plant, rounded down 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 int extra = farms.size() - min * plants.size(); // the remainder that cannot be evenly divided
@ -236,11 +265,7 @@ public:
{ {
// pick one of the excess farms and change it to plant this plant // pick one of the excess farms and change it to plant this plant
df::building_farmplotst* farm = toChange.front(); df::building_farmplotst* farm = toChange.front();
int o = farm->plant_id[season]; set_farm(out, n, farm, 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;
toChange.pop(); toChange.pop();
if (c++ == min) if (c++ == min)
extra--; extra--;

@ -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 // With thanks to peterix for DFHack and Quietust for information http://www.bay12forums.com/smf/index.php?topic=91166.msg2605147#msg2605147
#include <map> #include <map>
@ -101,7 +100,23 @@ string searchAbbreviations(string in)
DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) 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; return CR_OK;
} }
@ -143,13 +158,12 @@ command_result df_seedwatch(color_ostream &out, vector<string>& parameters)
} }
else if(par == "start") else if(par == "start")
{ {
running = true; plugin_enable(out, true);
out.print("seedwatch supervision started.\n");
} }
else if(par == "stop") else if(par == "stop")
{ {
running = false; plugin_enable(out, false);
out.print("seedwatch supervision stopped.\n");
} }
else if(par == "clear") else if(par == "clear")
{ {
@ -282,15 +296,10 @@ DFhackCExport command_result plugin_init(color_ostream &out, vector<PluginComman
DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event)
{ {
switch (event) { if (event == SC_MAP_UNLOADED) {
case SC_MAP_LOADED:
case SC_MAP_UNLOADED:
if (running) if (running)
out.printerr("seedwatch deactivated due to game load/unload\n"); out.print("seedwatch deactivated due to game unload\n");
running = false; running = false;
break;
default:
break;
} }
return CR_OK; return CR_OK;

@ -212,7 +212,7 @@ public:
auto dims = Gui::getDwarfmodeViewDims(); auto dims = Gui::getDwarfmodeViewDims();
int left_margin = dims.menu_x1 + 1; int left_margin = dims.menu_x1 + 1;
int x = left_margin; int x = left_margin;
int y = dims.y2 - 3; int y = dims.y2 - 2; // below autodump, automelt, autotrade, stocks, stockpiles
int links = 0; int links = 0;
links += sp->links.give_to_pile.size(); links += sp->links.give_to_pile.size();

@ -409,18 +409,7 @@ struct stockpiles_import_hook : public df::viewscreen_dwarfmodest
auto dims = Gui::getDwarfmodeViewDims(); auto dims = Gui::getDwarfmodeViewDims();
int left_margin = dims.menu_x1 + 1; int left_margin = dims.menu_x1 + 1;
int x = left_margin; int x = left_margin;
int y = dims.y2 - 3; int y = dims.y2 - 3; // below autodump, automelt, autotrade, stocks; above stockflow
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;
}
OutputHotkeyString ( x, y, "Load/Save Settings", "l", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED ); OutputHotkeyString ( x, y, "Load/Save Settings", "l", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED );
} }
}; };

@ -1 +1 @@
Subproject commit e20fa9f5ca7707377477b3d9c032ec1f3a2e6414 Subproject commit 86788f5bf975da2506c61372ebfbe36ca47ed57c