From e76b8c4b6b4027670002cebce966b497e236ffeb Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Tue, 9 Sep 2014 21:08:38 -0600 Subject: [PATCH] Merging automelt hotkey into autotrade line when links intrude. The new interface looks significantly different, but only when there are too many stockpile links to show the lines in their usual places. The difference between bright green and grey should be obvious most of the time, right? --- plugins/automelt.cpp | 18 ++++++++++++++++-- plugins/autotrade.cpp | 13 ++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/plugins/automelt.cpp b/plugins/automelt.cpp index 0fac4ed86..58cbdd20c 100644 --- a/plugins/automelt.cpp +++ b/plugins/automelt.cpp @@ -210,8 +210,22 @@ struct melt_hook : public df::viewscreen_dwarfmodest int left_margin = dims.menu_x1 + 1; int x = left_margin; int y = dims.y2 - 6; - - OutputToggleString(x, y, "Auto melt", "M", monitor.isMonitored(sp), true, left_margin, COLOR_WHITE, COLOR_LIGHTRED); + + 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(); + bool state = monitor.isMonitored(sp); + + if (links + 12 >= y) { + y = dims.y2; + OutputString(COLOR_WHITE, x, y, "Auto: "); + OutputString(COLOR_LIGHTRED, x, y, "M"); + OutputString(state? COLOR_LIGHTGREEN: COLOR_GREY, x, y, "elt "); + } else { + OutputToggleString(x, y, "Auto melt", "M", state, true, left_margin, COLOR_WHITE, COLOR_LIGHTRED); + } } }; diff --git a/plugins/autotrade.cpp b/plugins/autotrade.cpp index 3194dd0d6..da7da3204 100644 --- a/plugins/autotrade.cpp +++ b/plugins/autotrade.cpp @@ -428,10 +428,17 @@ struct trade_hook : public df::viewscreen_dwarfmodest 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 += 5; + bool state = monitor.isMonitored(sp); - OutputToggleString(x, y, "Auto trade", "T", monitor.isMonitored(sp), true, left_margin, COLOR_WHITE, COLOR_LIGHTRED); + if (links + 12 >= y) { + y = dims.y2; + OutputString(COLOR_WHITE, x, y, "Auto: "); + x += 5; + OutputString(COLOR_LIGHTRED, x, y, "T"); + OutputString(state? COLOR_LIGHTGREEN: COLOR_GREY, x, y, "rade "); + } else { + OutputToggleString(x, y, "Auto trade", "T", state, true, left_margin, COLOR_WHITE, COLOR_LIGHTRED); + } } };