Codechange: Remove min/max functions in favour of STL variants (#8502)

This commit is contained in:
Charles Pigott
2021-01-08 10:16:18 +00:00
committed by GitHub
parent c1fddb9a6a
commit 9b800a96ed
181 changed files with 900 additions and 954 deletions

View File

@@ -374,12 +374,12 @@ struct NewGRFInspectWindow : Window {
case WID_NGRFI_VEH_CHAIN: {
assert(this->HasChainIndex());
GrfSpecFeature f = GetFeatureNum(this->window_number);
size->height = max(size->height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WD_BEVEL_TOP + WD_BEVEL_BOTTOM);
size->height = std::max(size->height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WD_BEVEL_TOP + WD_BEVEL_BOTTOM);
break;
}
case WID_NGRFI_MAINPANEL:
resize->height = max(11, FONT_HEIGHT_NORMAL + 1);
resize->height = std::max(11, FONT_HEIGHT_NORMAL + 1);
resize->width = 1;
size->height = 5 * resize->height + TOP_OFFSET + BOTTOM_OFFSET;
@@ -430,7 +430,7 @@ struct NewGRFInspectWindow : Window {
int skip = 0;
if (total_width > width) {
int sel_center = (sel_start + sel_end) / 2;
if (sel_center > width / 2) skip = min(total_width - width, sel_center - width / 2);
if (sel_center > width / 2) skip = std::min(total_width - width, sel_center - width / 2);
}
GrfSpecFeature f = GetFeatureNum(this->window_number);
@@ -861,7 +861,7 @@ struct SpriteAlignerWindow : Window {
size->height = ScaleGUITrad(200);
break;
case WID_SA_LIST:
resize->height = max(11, FONT_HEIGHT_NORMAL + 1);
resize->height = std::max(11, FONT_HEIGHT_NORMAL + 1);
resize->width = 1;
break;
default:
@@ -897,7 +897,7 @@ struct SpriteAlignerWindow : Window {
int step_size = nwid->resize_y;
std::vector<SpriteID> &list = _newgrf_debug_sprite_picker.sprites;
int max = min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)list.size());
int max = std::min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)list.size());
int y = r.top + WD_FRAMERECT_TOP;
for (int i = this->vscroll->GetPosition(); i < max; i++) {