From 2ebc318daa91553355c4b67c6940b5901e9c99ec Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Thu, 6 Nov 2014 21:47:14 -0700 Subject: [PATCH] Removing autotrade's obsolete Mark All --- NEWS | 2 + plugins/autotrade.cpp | 86 +------------------------------------------ 2 files changed, 4 insertions(+), 84 deletions(-) diff --git a/NEWS b/NEWS index 42559f069..b31d30197 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ DFHack Future + Fixes: + - autotrade: Removed the newly obsolete "Mark all" functionality. DFHack 0.40.14-r1 Internals: diff --git a/plugins/autotrade.cpp b/plugins/autotrade.cpp index eff1b5d64..26c51c348 100644 --- a/plugins/autotrade.cpp +++ b/plugins/autotrade.cpp @@ -25,7 +25,7 @@ using df::global::ui; using df::building_stockpilest; DFHACK_PLUGIN("autotrade"); -#define PLUGIN_VERSION 0.4 +#define PLUGIN_VERSION 0.5 static const string PERSISTENCE_KEY = "autotrade/stockpiles"; @@ -445,86 +445,6 @@ struct trade_hook : public df::viewscreen_dwarfmodest IMPLEMENT_VMETHOD_INTERPOSE(trade_hook, feed); IMPLEMENT_VMETHOD_INTERPOSE(trade_hook, render); -struct tradeview_hook : public df::viewscreen_tradegoodsst -{ - typedef df::viewscreen_tradegoodsst interpose_base; - - bool handleInput(set *input) - { - if (input->count(interface_key::CUSTOM_M)) - { - for (int i = 0; i < trader_selected.size(); i++) - { - // Only mark containers, not their contents. - // Granted, this behaves poorly with the search plugin... - trader_selected[i] = !trader_items[i]->flags.bits.in_inventory; - } - } - else if (input->count(interface_key::CUSTOM_U)) - { - for (int i = 0; i < trader_selected.size(); i++) - { - trader_selected[i] = 0; - } - } - else if (input->count(interface_key::CUSTOM_SHIFT_M)) - { - for (int i = 0; i < broker_selected.size(); i++) - { - // Only mark containers, not their contents. - broker_selected[i] = !broker_items[i]->flags.bits.in_inventory; - } - } - else if (input->count(interface_key::CUSTOM_SHIFT_U)) - { - for (int i = 0; i < broker_selected.size(); i++) - { - broker_selected[i] = 0; - } - } - else - { - return false; - } - - return true; - } - - DEFINE_VMETHOD_INTERPOSE(void, feed, (set *input)) - { - if (!handleInput(input)) - INTERPOSE_NEXT(feed)(input); - } - - DEFINE_VMETHOD_INTERPOSE(void, render, ()) - { - INTERPOSE_NEXT(render)(); - - if (counteroffer.size() > 0) - { - // The merchant is proposing a counteroffer, - // so there is nothing to mark. - return; - } - - // Insert into the blank line between trade items and standard keys. - // The blank line at the bottom is taken by the search plugin. - auto dim = Screen::getWindowSize(); - int y = dim.y - 5; - - int x = 2; - OutputHotkeyString(x, y, "Mark all, ", "m", false, x, COLOR_WHITE, COLOR_LIGHTRED); - OutputHotkeyString(x, y, "Unmark all", "u", false, x, COLOR_WHITE, COLOR_LIGHTRED); - - x = 42; - OutputHotkeyString(x, y, "Mark all, ", "M", false, x, COLOR_WHITE, COLOR_LIGHTRED); - OutputHotkeyString(x, y, "Unmark all", "U", false, x, COLOR_WHITE, COLOR_LIGHTRED); - } -}; - -IMPLEMENT_VMETHOD_INTERPOSE(tradeview_hook, feed); -IMPLEMENT_VMETHOD_INTERPOSE(tradeview_hook, render); - static command_result autotrade_cmd(color_ostream &out, vector & parameters) { @@ -568,9 +488,7 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) monitor.reset(); if (!INTERPOSE_HOOK(trade_hook, feed).apply(enable) || - !INTERPOSE_HOOK(trade_hook, render).apply(enable) || - !INTERPOSE_HOOK(tradeview_hook, feed).apply(enable) || - !INTERPOSE_HOOK(tradeview_hook, render).apply(enable)) + !INTERPOSE_HOOK(trade_hook, render).apply(enable)) return CR_FAILURE; is_enabled = enable;