|
@@ -999,13 +999,13 @@ struct BuildVehicleWindow : Window {
|
|
|
EngList_Sort(&this->eng_list, _sorter[this->vehicle_type][this->sort_criteria]);
|
|
|
|
|
|
this->eng_list.Compact();
|
|
|
this->eng_list.RebuildDone();
|
|
|
}
|
|
|
|
|
|
void OnClick(Point pt, int widget)
|
|
|
void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
switch (widget) {
|
|
|
case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING:
|
|
|
this->descending_sort_order ^= true;
|
|
|
_last_sort_order[this->vehicle_type] = this->descending_sort_order;
|
|
|
this->eng_list.ForceRebuild();
|
|
@@ -1014,12 +1014,13 @@ struct BuildVehicleWindow : Window {
|
|
|
|
|
|
case BUILD_VEHICLE_WIDGET_LIST: {
|
|
|
uint i = (pt.y - this->GetWidget<NWidgetBase>(BUILD_VEHICLE_WIDGET_LIST)->pos_y) / this->resize.step_height + this->vscroll.GetPosition();
|
|
|
size_t num_items = this->eng_list.Length();
|
|
|
this->sel_engine = (i < num_items) ? this->eng_list[i] : INVALID_ENGINE;
|
|
|
this->SetDirty();
|
|
|
if (click_count > 1) this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD, 1);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: // Select sorting criteria dropdown menu
|
|
|
ShowDropDownMenu(this, _sort_listing[this->vehicle_type], this->sort_criteria, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, 0, 0);
|
|
|
break;
|
|
@@ -1125,20 +1126,12 @@ struct BuildVehicleWindow : Window {
|
|
|
this->ReInit();
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnDoubleClick(Point pt, int widget)
|
|
|
{
|
|
|
if (widget == BUILD_VEHICLE_WIDGET_LIST) {
|
|
|
/* When double clicking, we want to buy a vehicle */
|
|
|
this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnQueryTextFinished(char *str)
|
|
|
{
|
|
|
if (str == NULL) return;
|
|
|
|
|
|
DoCommandP(0, this->rename_engine, 0, CMD_RENAME_ENGINE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN_TYPE + this->vehicle_type), NULL, str);
|
|
|
}
|