Add settings callback field to re-order setting options in GUI

This commit is contained in:
Jonathan G Rennison
2017-08-20 01:39:49 +01:00
parent 46050820c5
commit a3d1585826
10 changed files with 46 additions and 26 deletions

View File

@@ -2092,7 +2092,9 @@ struct GameSettingsWindow : Window {
DropDownList *list = new DropDownList();
for (int i = sdb->min; i <= (int)sdb->max; i++) {
*list->Append() = new DropDownListStringItem(sdb->str_val + i - sdb->min, i, false);
int val = sd->orderproc ? sd->orderproc(i - sdb->min) : i;
assert_msg(val >= sdb->min && val <= (int)sdb->max, "min: %d, max: %d, val: %d", sdb->min, sdb->max, val);
*list->Append() = new DropDownListStringItem(sdb->str_val + val - sdb->min, val, false);
}
ShowDropDownListAt(this, list, value, -1, wi_rect, COLOUR_ORANGE, true);