Merge pull request #298 from eswald/stockpile-lines

Stockpile lines
develop
Quietust 2014-08-28 14:53:09 -05:00
commit 8bfc0e93ec
4 changed files with 35 additions and 9 deletions

@ -421,8 +421,17 @@ struct trade_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 = 24; int y = dims.y2 - 4;
OutputToggleString(x, y, "Auto trade", "Shift-T", monitor.isMonitored(sp), true, left_margin);
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);
} }
}; };

@ -206,7 +206,15 @@ 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 = 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); OutputHotkeyString(x, y, current_job, "j", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED);
if (*current_trigger) if (*current_trigger)

@ -1376,9 +1376,17 @@ struct stocks_stockpile_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 = 23; int y = dims.y2 - 5;
OutputHotkeyString(x, y, "Show Inventory", "i", true, left_margin); 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);
} }
}; };

@ -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); 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); OutputHotkeyString(x, y, text, hotkey, false, 0, color, hotkey_color);
OutputString(COLOR_WHITE, x, y, ": "); OutputString(color, x, y, ": ");
if (state) if (state)
OutputString(COLOR_GREEN, x, y, "On", newline, left_margin); OutputString(COLOR_GREEN, x, y, "On", newline, left_margin);
else else