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?
develop
Eric Wald 2014-09-09 21:08:38 -06:00
parent 8bc2f02aee
commit e76b8c4b6b
2 changed files with 26 additions and 5 deletions

@ -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);
}
}
};

@ -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);
}
}
};