diff --git a/plugins/autotrade.cpp b/plugins/autotrade.cpp index 5eacbf2d7..8fbc75b89 100644 --- a/plugins/autotrade.cpp +++ b/plugins/autotrade.cpp @@ -421,8 +421,17 @@ struct trade_hook : public df::viewscreen_dwarfmodest auto dims = Gui::getDwarfmodeViewDims(); int left_margin = dims.menu_x1 + 1; int x = left_margin; - int y = 24; - OutputToggleString(x, y, "Auto trade", "Shift-T", monitor.isMonitored(sp), true, left_margin); + int y = dims.y2 - 4; + + 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 += 4; + + OutputToggleString(x, y, "Auto trade", "T", monitor.isMonitored(sp), true, left_margin, COLOR_WHITE, COLOR_LIGHTRED); } }; diff --git a/plugins/stockflow.cpp b/plugins/stockflow.cpp index d061f02d5..257680682 100644 --- a/plugins/stockflow.cpp +++ b/plugins/stockflow.cpp @@ -206,7 +206,15 @@ public: auto dims = Gui::getDwarfmodeViewDims(); int left_margin = dims.menu_x1 + 1; int x = left_margin; - int y = 14; + 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; OutputHotkeyString(x, y, current_job, "j", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED); if (*current_trigger) diff --git a/plugins/stocks.cpp b/plugins/stocks.cpp index 3b9c0317d..64e4d4dba 100644 --- a/plugins/stocks.cpp +++ b/plugins/stocks.cpp @@ -1376,9 +1376,17 @@ struct stocks_stockpile_hook : public df::viewscreen_dwarfmodest auto dims = Gui::getDwarfmodeViewDims(); int left_margin = dims.menu_x1 + 1; int x = left_margin; - int y = 23; - - OutputHotkeyString(x, y, "Show Inventory", "i", true, left_margin); + int y = dims.y2 - 5; + + 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 = 3; + + OutputHotkeyString(x, y, "Show Inventory", "i", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED); } }; diff --git a/plugins/uicommon.h b/plugins/uicommon.h index 6854c7b19..1daabf4c7 100644 --- a/plugins/uicommon.h +++ b/plugins/uicommon.h @@ -133,10 +133,11 @@ void OutputFilterString(int &x, int &y, const char *text, const char *hotkey, bo OutputString((state) ? COLOR_WHITE : COLOR_GREY, x, y, text, newline, left_margin); } -void OutputToggleString(int &x, int &y, const char *text, const char *hotkey, bool state, bool newline = true, int left_margin = 0, int8_t color = COLOR_WHITE) +void OutputToggleString(int &x, int &y, const char *text, const char *hotkey, bool state, bool newline = true, + int left_margin = 0, int8_t color = COLOR_WHITE, int8_t hotkey_color = COLOR_LIGHTGREEN) { - OutputHotkeyString(x, y, text, hotkey); - OutputString(COLOR_WHITE, x, y, ": "); + OutputHotkeyString(x, y, text, hotkey, false, 0, color, hotkey_color); + OutputString(color, x, y, ": "); if (state) OutputString(COLOR_GREEN, x, y, "On", newline, left_margin); else