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/settings_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/settings_gui.cpp')
-rw-r--r-- | src/settings_gui.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 751cf1a7d..f0d9b7f3b 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -370,7 +370,7 @@ struct GameOptionsWindow : Window { /* Find the biggest description for the default size. */ for (int i = 0; i < BaseGraphics::GetNumSets(); i++) { SetDParamStr(0, BaseGraphics::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); + size->height = std::max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); } break; @@ -389,7 +389,7 @@ struct GameOptionsWindow : Window { /* Find the biggest description for the default size. */ for (int i = 0; i < BaseSounds::GetNumSets(); i++) { SetDParamStr(0, BaseSounds::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); + size->height = std::max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); } break; @@ -397,7 +397,7 @@ struct GameOptionsWindow : Window { /* Find the biggest description for the default size. */ for (int i = 0; i < BaseMusic::GetNumSets(); i++) { SetDParamStr(0, BaseMusic::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); + size->height = std::max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); } break; @@ -1273,7 +1273,7 @@ uint SettingsContainer::GetMaxHelpHeight(int maxw) { uint biggest = 0; for (EntryVector::const_iterator it = this->entries.begin(); it != this->entries.end(); ++it) { - biggest = max(biggest, (*it)->GetMaxHelpHeight(maxw)); + biggest = std::max(biggest, (*it)->GetMaxHelpHeight(maxw)); } return biggest; } @@ -1852,7 +1852,7 @@ struct GameSettingsWindow : Window { { switch (widget) { case WID_GS_OPTIONSPANEL: - resize->height = SETTING_HEIGHT = max(max<int>(_circle_size.height, SETTING_BUTTON_HEIGHT), FONT_HEIGHT_NORMAL) + 1; + resize->height = SETTING_HEIGHT = std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL}) + 1; resize->width = 1; size->height = 5 * resize->height + SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET; @@ -1866,16 +1866,16 @@ struct GameSettingsWindow : Window { }; for (uint i = 0; i < lengthof(setting_types); i++) { SetDParam(0, setting_types[i]); - size->width = max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width); } size->height = 2 * FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL + - max(size->height, GetSettingsTree().GetMaxHelpHeight(size->width)); + std::max(size->height, GetSettingsTree().GetMaxHelpHeight(size->width)); break; } case WID_GS_RESTRICT_CATEGORY: case WID_GS_RESTRICT_TYPE: - size->width = max(GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_CATEGORY).width, GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_TYPE).width); + size->width = std::max(GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_CATEGORY).width, GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_TYPE).width); break; default: @@ -2631,7 +2631,7 @@ struct CustomCurrencyWindow : Window { case WID_CC_YEAR: { // Year to switch to euro int val = atoi(str); - _custom_currency.to_euro = (val < 2000 ? CF_NOEURO : min(val, MAX_YEAR)); + _custom_currency.to_euro = (val < 2000 ? CF_NOEURO : std::min(val, MAX_YEAR)); break; } } |