@@ -78,13 +78,13 @@ static const StringID _start_replace_dro
class ReplaceVehicleWindow : public Window {
EngineID sel_engine[2]; ///< Selected engine left and right.
GUIEngineList engines[2]; ///< Left and right list of engines.
bool replace_engines; ///< If \c true, engines are replaced, if \c false, wagons are replaced (only for trains).
bool reset_sel_engine; ///< Also reset #sel_engine while updating left and/or right and no valid engine selected.
GroupID sel_group; ///< Group selected to replace.
int details_height; ///< Minimal needed height of the details panels (found so far).
int details_height; ///< Minimal needed height of the details panels, in text lines (found so far).
byte sort_criteria; ///< Criteria of sorting vehicles.
bool descending_sort_order; ///< Order of sorting vehicles.
bool show_hidden_engines; ///< Whether to show the hidden engines.
RailType sel_railtype; ///< Type of rail tracks selected. #INVALID_RAILTYPE to show all.
RoadType sel_roadtype; ///< Type of road selected. #INVALID_ROADTYPE to show all.
Scrollbar *vscroll[2];
@@ -226,13 +226,13 @@ public:
this->sel_railtype = INVALID_RAILTYPE;
this->sel_roadtype = INVALID_ROADTYPE;
this->replace_engines = true; // start with locomotives (all other vehicles will not read this bool)
this->engines[0].ForceRebuild();
this->engines[1].ForceRebuild();
this->reset_sel_engine = true;
this->details_height = ((vehicletype == VEH_TRAIN) ? 10 : 9) * FONT_HEIGHT_NORMAL + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
this->details_height = ((vehicletype == VEH_TRAIN) ? 10 : 9);
this->sel_engine[0] = INVALID_ENGINE;
this->sel_engine[1] = INVALID_ENGINE;
this->show_hidden_engines = _engine_sort_show_hidden_engines[vehicletype];
this->CreateNestedTree();
this->vscroll[0] = this->GetScrollbar(WID_RV_LEFT_SCROLLBAR);
@@ -271,13 +271,13 @@ public:
resize->height = GetEngineListHeight((VehicleType)this->window_number);
size->height = (this->window_number <= VEH_ROAD ? 8 : 4) * resize->height;
break;
case WID_RV_LEFT_DETAILS:
case WID_RV_RIGHT_DETAILS:
size->height = this->details_height;
size->height = FONT_HEIGHT_NORMAL * this->details_height + padding.height;
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
SetDParam(0, STR_CONFIG_SETTING_ON);
Dimension d = GetStringBoundingBox(str);
@@ -479,13 +479,13 @@ public:
ted.cargo = e->GetDefaultCargoType();
ted.capacity = e->GetDisplayDefaultCapacity(&ted.mail_capacity);
NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? WID_RV_LEFT_DETAILS : WID_RV_RIGHT_DETAILS);
int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT,
nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side], ted);
needed_height = std::max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM);
needed_height = std::max(needed_height, (text_end - (int)nwi->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL);
}
if (needed_height != this->details_height) { // Details window are not high enough, enlarge them.
this->details_height = needed_height;
this->ReInit();
return;
@@ -1052,13 +1052,13 @@ struct BuildVehicleWindow : Window {
EngineID sel_engine; ///< Currently selected engine, or #INVALID_ENGINE
EngineID rename_engine; ///< Engine being renamed.
GUIEngineList eng_list;
CargoID cargo_filter[NUM_CARGO + 3]; ///< Available cargo filters; CargoID or CF_ANY or CF_NONE or CF_ENGINES
StringID cargo_filter_texts[NUM_CARGO + 4]; ///< Texts for filter_cargo, terminated by INVALID_STRING_ID
byte cargo_filter_criteria; ///< Selected cargo filter
Scrollbar *vscroll;
TestedEngineDetails te; ///< Tested cost and capacity after refit.
void SetBuyVehicleText()
{
NWidgetCore *widget = this->GetWidget<NWidgetCore>(WID_BV_BUILD);
@@ -1112,13 +1112,13 @@ struct BuildVehicleWindow : Window {
widget = this->GetWidget<NWidgetCore>(WID_BV_SHOW_HIDDEN_ENGINES);
widget->widget_data = STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN + type;
widget->tool_tip = STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN_TOOLTIP + type;
widget->SetLowered(this->show_hidden_engines);
this->details_height = ((this->vehicle_type == VEH_TRAIN) ? 10 : 9) * FONT_HEIGHT_NORMAL + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
this->details_height = ((this->vehicle_type == VEH_TRAIN) ? 10 : 9);
this->FinishInitNested(tile == INVALID_TILE ? (int)type : tile);
this->owner = (tile != INVALID_TILE) ? GetTileOwner(tile) : _local_company;
this->eng_list.ForceRebuild();
@@ -1550,13 +1550,13 @@ struct BuildVehicleWindow : Window {
resize->height = GetEngineListHeight(this->vehicle_type);
size->height = 3 * resize->height;
size->width = std::max(size->width, GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_left + GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_right + 165);
case WID_BV_PANEL:
case WID_BV_SORT_ASCENDING_DESCENDING: {
Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
d.width += padding.width + Window::SortButtonWidth() * 2; // Doubled since the string is centred and it also looks better.
d.height += padding.height;
@@ -1617,18 +1617,18 @@ struct BuildVehicleWindow : Window {
int needed_height = this->details_height;
/* Draw details panels. */
if (this->sel_engine != INVALID_ENGINE) {
NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_BV_PANEL);
nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine, this->te);
int resize = needed_height - this->details_height;
this->ReInit(0, resize);
this->ReInit(0, resize * FONT_HEIGHT_NORMAL);
void OnQueryTextFinished(char *str) override
Status change: