diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2021-01-08 10:16:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 11:16:18 +0100 |
commit | 9b800a96ed32720ff60b74e498a0e0a6351004f9 (patch) | |
tree | 3f287d339e15c4902ee415556475fd9b2918d33c /src/depot_gui.cpp | |
parent | c1fddb9a6ae5c3af6865461a7295788a341011a2 (diff) | |
download | openttd-9b800a96ed32720ff60b74e498a0e0a6351004f9.tar.xz |
Codechange: Remove min/max functions in favour of STL variants (#8502)
Diffstat (limited to 'src/depot_gui.cpp')
-rw-r--r-- | src/depot_gui.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index e4663c602..026382b28 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -194,12 +194,12 @@ static void InitBlocksizeForVehicles(VehicleType type, EngineImageType image_typ 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); |