summaryrefslogtreecommitdiff
path: root/plugins/stockpiles.cpp
diff options
context:
space:
mode:
authorPetr Mrázek2011-12-31 13:09:12 +0100
committerPetr Mrázek2011-12-31 13:09:12 +0100
commitf35cdb84cdeaed99c0bb291423ffbc05183fd35f (patch)
tree84f910568748f97ed6f454e68b7b813687e0eb1a /plugins/stockpiles.cpp
parent9db20bd84de2b31a3a34f775af9ce6320f37d75a (diff)
parentb652ec4132ad97b88dfd648303bf7a99267f1742 (diff)
downloaddfhack-f35cdb84cdeaed99c0bb291423ffbc05183fd35f.tar.gz
dfhack-f35cdb84cdeaed99c0bb291423ffbc05183fd35f.tar.bz2
dfhack-f35cdb84cdeaed99c0bb291423ffbc05183fd35f.tar.xz
Merge https://github.com/angavrilov/dfhack
Conflicts: library/Core.cpp library/PluginManager.cpp library/include/Core.h library/include/PluginManager.h library/modules/Gui.cpp plugins/stockpiles.cpp
Diffstat (limited to 'plugins/stockpiles.cpp')
-rw-r--r--plugins/stockpiles.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/stockpiles.cpp b/plugins/stockpiles.cpp
index fb79f3e5..e104ec90 100644
--- a/plugins/stockpiles.cpp
+++ b/plugins/stockpiles.cpp
@@ -36,8 +36,12 @@ DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> &
if (world && ui) {
commands.push_back(
PluginCommand(
- "copystock", "Copy stockpile under cursor.", copystock,
- copystock_guard, &df::viewscreen_dwarfmodest::_identity
+ "copystock", "Copy stockpile under cursor.",
+ copystock, copystock_guard,
+ " - In 'q' or 't' mode: select a stockpile and invoke in order\n"
+ " to switch to the 'p' stockpile creation mode, and initialize\n"
+ " the custom settings from the selected stockpile.\n"
+ " - In 'p': invoke in order to switch back to 'q'.\n"
)
);
}
@@ -51,10 +55,13 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
-static bool copystock_guard(Core *c, df::viewscreen *)
+static bool copystock_guard(Core *c, df::viewscreen *top)
{
using namespace ui_sidebar_mode;
+ if (!dwarfmode_hotkey(c,top))
+ return false;
+
switch (ui->main.mode) {
case Stockpiles:
return true;
@@ -63,12 +70,12 @@ static bool copystock_guard(Core *c, df::viewscreen *)
return !!virtual_cast<building_stockpilest>(world->selected_building);
default:
return false;
- }
+ }
}
static command_result copystock(Core * c, vector <string> & parameters)
{
- /* HOTKEY COMMAND: CORE ALREADY SUSPENDED */
+ // HOTKEY COMMAND: CORE ALREADY SUSPENDED
// For convenience: when used in the stockpiles mode, switch to 'q'
if (ui->main.mode == ui_sidebar_mode::Stockpiles) {
@@ -81,9 +88,10 @@ static command_result copystock(Core * c, vector <string> & parameters)
}
building_stockpilest *sp = virtual_cast<building_stockpilest>(world->selected_building);
- if (!sp) {
+ if (!sp)
+ {
c->con.printerr("Selected building isn't a stockpile.\n");
- return CR_FAILURE;
+ return CR_WRONG_USAGE;
}
ui->stockpile.custom_settings = sp->settings;