|
@@ -194,12 +194,12 @@ static void InitBlocksizeForVehicles(Veh
|
|
|
|
|
|
switch (image_type) {
|
|
|
case EIT_IN_DEPOT:
|
|
|
_base_block_sizes_depot[type].height = max<uint>(ScaleGUITrad(GetVehicleHeight(type)), max_height);
|
|
|
_base_block_sizes_depot[type].height = std::max<uint>(ScaleGUITrad(GetVehicleHeight(type)), max_height);
|
|
|
_base_block_sizes_depot[type].extend_left = Clamp(max_extend_left, min_extend, max_extend);
|
|
|
_base_block_sizes_depot[type].extend_right = Clamp(max_extend_right, min_extend, max_extend);
|
|
|
break;
|
|
|
case EIT_PURCHASE:
|
|
|
_base_block_sizes_purchase[type].height = max<uint>(ScaleGUITrad(GetVehicleHeight(type)), max_height);
|
|
|
_base_block_sizes_purchase[type].height = std::max<uint>(ScaleGUITrad(GetVehicleHeight(type)), max_height);
|
|
|
_base_block_sizes_purchase[type].extend_left = Clamp(max_extend_left, min_extend, max_extend);
|
|
|
_base_block_sizes_purchase[type].extend_right = Clamp(max_extend_right, min_extend, max_extend);
|
|
|
break;
|
|
@@ -395,7 +395,7 @@ struct DepotWindow : Window {
|
|
|
uint16 rows_in_display = wid->current_y / wid->resize_y;
|
|
|
|
|
|
uint16 num = this->vscroll->GetPosition() * this->num_columns;
|
|
|
int maxval = min((uint)this->vehicle_list.size(), num + (rows_in_display * this->num_columns));
|
|
|
uint maxval = static_cast<uint>(std::min<size_t>(this->vehicle_list.size(), num + (rows_in_display * this->num_columns)));
|
|
|
int y;
|
|
|
for (y = r.top + 1; num < maxval; y += this->resize.step_height) { // Draw the rows
|
|
|
for (byte i = 0; i < this->num_columns && num < maxval; i++, num++) {
|
|
@@ -410,7 +410,7 @@ struct DepotWindow : Window {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
maxval = min((uint)this->vehicle_list.size() + (uint)this->wagon_list.size(), (this->vscroll->GetPosition() * this->num_columns) + (rows_in_display * this->num_columns));
|
|
|
maxval = static_cast<uint>(std::min<size_t>(this->vehicle_list.size() + this->wagon_list.size(), (this->vscroll->GetPosition() * this->num_columns) + (rows_in_display * this->num_columns)));
|
|
|
|
|
|
/* Draw the train wagons without an engine in front. */
|
|
|
for (; num < maxval; num++, y += this->resize.step_height) {
|
|
@@ -668,15 +668,15 @@ struct DepotWindow : Window {
|
|
|
this->flag_height = UnScaleGUI(spr->height);
|
|
|
|
|
|
if (this->type == VEH_TRAIN || this->type == VEH_ROAD) {
|
|
|
min_height = max<uint>(unumber.height + WD_MATRIX_TOP, UnScaleGUI(spr->height));
|
|
|
min_height = std::max<uint>(unumber.height + WD_MATRIX_TOP, UnScaleGUI(spr->height));
|
|
|
this->header_width = unumber.width + this->flag_width + WD_FRAMERECT_LEFT;
|
|
|
} else {
|
|
|
min_height = unumber.height + UnScaleGUI(spr->height) + WD_MATRIX_TOP + WD_PAR_VSEP_NORMAL + WD_MATRIX_BOTTOM;
|
|
|
this->header_width = max<uint>(unumber.width, this->flag_width) + WD_FRAMERECT_RIGHT;
|
|
|
this->header_width = std::max<uint>(unumber.width, this->flag_width) + WD_FRAMERECT_RIGHT;
|
|
|
}
|
|
|
int base_width = this->count_width + this->header_width;
|
|
|
|
|
|
resize->height = max<uint>(GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).height, min_height);
|
|
|
resize->height = std::max<uint>(GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).height, min_height);
|
|
|
if (this->type == VEH_TRAIN) {
|
|
|
resize->width = 1;
|
|
|
size->width = base_width + 2 * ScaleGUITrad(29); // about 2 parts
|
|
@@ -728,7 +728,7 @@ struct DepotWindow : Window {
|
|
|
for (const Train *v = Train::From(this->vehicle_list[num]); v != nullptr; v = v->Next()) {
|
|
|
width += v->GetDisplayImageWidth();
|
|
|
}
|
|
|
max_width = max(max_width, width);
|
|
|
max_width = std::max(max_width, width);
|
|
|
}
|
|
|
/* Always have 1 empty row, so people can change the setting of the train */
|
|
|
this->vscroll->SetCount((uint)this->vehicle_list.size() + (uint)this->wagon_list.size() + 1);
|