1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-02 03:19:10 +00:00

(svn r24136) -Feature [FS#4465]: Autoreplace vehicles only when they get old. (Vikthor)

This commit is contained in:
michi_cc
2012-04-17 19:44:02 +00:00
parent ed56585388
commit 6a70abbd99
14 changed files with 126 additions and 49 deletions

View File

@@ -2050,6 +2050,7 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint16 data,
case WWT_TEXT:
case WWT_MATRIX:
case NWID_BUTTON_DROPDOWN:
case NWID_PUSHBUTTON_DROPDOWN:
case WWT_ARROWBTN:
case WWT_PUSHARROWBTN:
this->SetFill(0, 0);
@@ -2254,7 +2255,8 @@ void NWidgetLeaf::SetupSmallestSize(Window *w, bool init_array)
break;
}
case WWT_DROPDOWN:
case NWID_BUTTON_DROPDOWN: {
case NWID_BUTTON_DROPDOWN:
case NWID_PUSHBUTTON_DROPDOWN: {
static const Dimension extra = {WD_DROPDOWNTEXT_LEFT + WD_DROPDOWNTEXT_RIGHT, WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM};
padding = &extra;
if (this->index >= 0) w->SetStringParameters(this->index);
@@ -2380,6 +2382,7 @@ void NWidgetLeaf::Draw(const Window *w)
break;
case NWID_BUTTON_DROPDOWN:
case NWID_PUSHBUTTON_DROPDOWN:
if (this->index >= 0) w->SetStringParameters(this->index);
DrawButtonDropdown(r, this->colour, clicked, (this->disp_flags & ND_DROPDOWN_ACTIVE) != 0, this->widget_data);
break;
@@ -2582,7 +2585,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
default:
if (*dest != NULL) return num_used;
assert((parts->type & WWT_MASK) < WWT_LAST || parts->type == NWID_BUTTON_DROPDOWN);
assert((parts->type & WWT_MASK) < WWT_LAST || (parts->type & WWT_MASK) == NWID_BUTTON_DROPDOWN);
*dest = new NWidgetLeaf(parts->type, parts->u.widget.colour, parts->u.widget.index, 0x0, STR_NULL);
*biggest_index = max(*biggest_index, (int)parts->u.widget.index);
break;