diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -110,7 +110,7 @@ struct GraphLegendWindow : Window { static NWidgetBase *MakeNWidgetCompanyLines(int *biggest_index) { NWidgetVertical *vert = new NWidgetVertical(); - uint line_height = max(GetSpriteSize(SPR_COMPANY_ICON).height, FONT_HEIGHT_NORMAL) + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; + uint line_height = std::max(GetSpriteSize(SPR_COMPANY_ICON).height, FONT_HEIGHT_NORMAL) + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; for (int widnum = WID_GL_FIRST_COMPANY; widnum <= WID_GL_LAST_COMPANY; widnum++) { NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum); @@ -212,8 +212,8 @@ protected: OverflowSafeInt64 datapoint = this->cost[i][j]; if (datapoint != INVALID_DATAPOINT) { - current_interval.highest = max(current_interval.highest, datapoint); - current_interval.lowest = min(current_interval.lowest, datapoint); + current_interval.highest = std::max(current_interval.highest, datapoint); + current_interval.lowest = std::min(current_interval.lowest, datapoint); } } } @@ -240,7 +240,7 @@ protected: /* Get the required grid size for each side and use the maximum one. */ int64 grid_size_higher = (abs_higher > 0) ? ((int64)abs_higher + num_pos_grids - 1) / num_pos_grids : 0; int64 grid_size_lower = (abs_lower > 0) ? ((int64)abs_lower + num_hori_lines - num_pos_grids - 1) / (num_hori_lines - num_pos_grids) : 0; - grid_size = max(grid_size_higher, grid_size_lower); + grid_size = std::max(grid_size_higher, grid_size_lower); } else { /* If both values are zero, show an empty graph. */ num_pos_grids = num_hori_lines / 2; @@ -435,7 +435,7 @@ protected: * least significant bits are removed. */ int mult_range = FindLastBit(x_axis_offset) + FindLastBit(abs(datapoint)); - int reduce_range = max(mult_range - 31, 0); + int reduce_range = std::max(mult_range - 31, 0); /* Handle negative values differently (don't shift sign) */ if (datapoint < 0) { @@ -496,7 +496,7 @@ public: SetDParam(0, month + STR_MONTH_ABBREV_JAN); SetDParam(1, month + STR_MONTH_ABBREV_JAN + 2); SetDParam(2, year); - x_label_width = max(x_label_width, GetStringBoundingBox(month == 0 ? STR_GRAPH_X_LABEL_MONTH_YEAR : STR_GRAPH_X_LABEL_MONTH).width); + x_label_width = std::max(x_label_width, GetStringBoundingBox(month == 0 ? STR_GRAPH_X_LABEL_MONTH_YEAR : STR_GRAPH_X_LABEL_MONTH).width); month += 3; if (month >= 12) { @@ -514,9 +514,9 @@ public: SetDParam(1, INT64_MAX); uint y_label_width = GetStringBoundingBox(STR_GRAPH_Y_LABEL).width; - size->width = max(size->width, 5 + y_label_width + this->num_on_x_axis * (x_label_width + 5) + 9); - size->height = max(size->height, 5 + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->month != 0xFF ? 3 : 1)) * FONT_HEIGHT_SMALL + 4); - size->height = max(size->height, size->width / 3); + size->width = std::max(size->width, 5 + y_label_width + this->num_on_x_axis * (x_label_width + 5) + 9); + size->height = std::max(size->height, 5 + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->month != 0xFF ? 3 : 1)) * FONT_HEIGHT_SMALL + 4); + size->height = std::max(size->height, size->width / 3); } void DrawWidget(const Rect &r, int widget) const override @@ -568,7 +568,7 @@ public: byte nums = 0; for (const Company *c : Company::Iterate()) { - nums = min(this->num_vert_lines, max(nums, c->num_valid_stat_ent)); + nums = std::min(this->num_vert_lines, std::max(nums, c->num_valid_stat_ent)); } int mo = (_cur_month / 3 - nums) * 3; @@ -1115,7 +1115,7 @@ static const StringID _performance_title static inline StringID GetPerformanceTitleFromValue(uint value) { - return _performance_titles[minu(value, 1000) >> 6]; + return _performance_titles[std::min(value, 1000u) >> 6]; } class CompanyLeagueWindow : public Window { @@ -1199,7 +1199,7 @@ public: this->ordinal_width = 0; for (uint i = 0; i < MAX_COMPANIES; i++) { - this->ordinal_width = max(this->ordinal_width, GetStringBoundingBox(STR_ORDINAL_NUMBER_1ST + i).width); + this->ordinal_width = std::max(this->ordinal_width, GetStringBoundingBox(STR_ORDINAL_NUMBER_1ST + i).width); } this->ordinal_width += 5; // Keep some extra spacing @@ -1215,13 +1215,13 @@ public: Dimension d = GetSpriteSize(SPR_COMPANY_ICON); this->icon_width = d.width + 2; - this->line_height = max(d.height + 2, FONT_HEIGHT_NORMAL); + this->line_height = std::max(d.height + 2, FONT_HEIGHT_NORMAL); for (const Company *c : Company::Iterate()) { SetDParam(0, c->index); SetDParam(1, c->index); SetDParam(2, _performance_titles[widest_title]); - widest_width = max(widest_width, GetStringBoundingBox(STR_COMPANY_LEAGUE_COMPANY_NAME).width); + widest_width = std::max(widest_width, GetStringBoundingBox(STR_COMPANY_LEAGUE_COMPANY_NAME).width); } this->text_width = widest_width + 30; // Keep some extra spacing @@ -1321,7 +1321,7 @@ struct PerformanceRatingDetailWindow : W uint score_info_width = 0; for (uint i = SCORE_BEGIN; i < SCORE_END; i++) { - score_info_width = max(score_info_width, GetStringBoundingBox(STR_PERFORMANCE_DETAIL_VEHICLES + i).width); + score_info_width = std::max(score_info_width, GetStringBoundingBox(STR_PERFORMANCE_DETAIL_VEHICLES + i).width); } SetDParamMaxValue(0, 1000); score_info_width += GetStringBoundingBox(STR_BLACK_COMMA).width + WD_FRAMERECT_LEFT;