mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-29 17:39:09 +00:00
(svn r15448) -Codechange: Don't show rail types in selection drop downs if they have no label.
This commit is contained in:
@@ -347,7 +347,8 @@ public:
|
|||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||||
|
/* Skip rail type if it has no label */
|
||||||
|
if (rti->label == 0) continue;
|
||||||
list->push_back(new DropDownListStringItem(rti->strings.replace_text, rt, !HasBit(c->avail_railtypes, rt)));
|
list->push_back(new DropDownListStringItem(rti->strings.replace_text, rt, !HasBit(c->avail_railtypes, rt)));
|
||||||
}
|
}
|
||||||
ShowDropDownList(this, list, sel_railtype, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN);
|
ShowDropDownList(this, list, sel_railtype, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN);
|
||||||
|
@@ -628,6 +628,8 @@ static void ToolbarBuildRailClick(Window *w)
|
|||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||||
|
/* Skip rail type if it has no label */
|
||||||
|
if (rti->label == 0) continue;
|
||||||
list->push_back(new DropDownListStringItem(rti->strings.menu_text, rt, !HasBit(c->avail_railtypes, rt)));
|
list->push_back(new DropDownListStringItem(rti->strings.menu_text, rt, !HasBit(c->avail_railtypes, rt)));
|
||||||
}
|
}
|
||||||
ShowDropDownList(w, list, _last_built_railtype, TBN_RAILS, 140, true, true);
|
ShowDropDownList(w, list, _last_built_railtype, TBN_RAILS, 140, true, true);
|
||||||
|
Reference in New Issue
Block a user