No longer overwrites stockpile links

The new lines added to the stockpile 'q' menu are usually drawn at the bottom, where the last few Give/Take links are written.  Now, they notice when they would overwrite one of those links, and move somewhere else.  The 'Done' line can now be overwritten by stockflow, but that hint isn't necessary for experienced players.
develop
Eric Wald 2014-08-19 14:19:13 -06:00
parent c95ad05a7e
commit 6f77372367
3 changed files with 25 additions and 0 deletions

@ -422,6 +422,15 @@ struct trade_hook : public df::viewscreen_dwarfmodest
int left_margin = dims.menu_x1 + 1; int left_margin = dims.menu_x1 + 1;
int x = left_margin; int x = left_margin;
int y = dims.y2 - 4; 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); OutputToggleString(x, y, "Auto trade", "T", monitor.isMonitored(sp), true, left_margin, COLOR_WHITE, COLOR_LIGHTRED);
} }
}; };

@ -208,6 +208,14 @@ public:
int x = left_margin; int x = left_margin;
int y = dims.y2 - 3; 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)
OutputHotkeyString(x, y, current_trigger, " J", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED); OutputHotkeyString(x, y, current_trigger, " J", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED);

@ -1377,6 +1377,14 @@ struct stocks_stockpile_hook : public df::viewscreen_dwarfmodest
int left_margin = dims.menu_x1 + 1; int left_margin = dims.menu_x1 + 1;
int x = left_margin; int x = left_margin;
int y = dims.y2 - 5; 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); OutputHotkeyString(x, y, "Show Inventory", "i", true, left_margin, COLOR_WHITE, COLOR_LIGHTRED);
} }