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

@@ -120,7 +120,7 @@ struct StatusBarWindow : Window {
case WID_S_RIGHT: {
int64 max_money = UINT32_MAX;
for (const Company *c : Company::Iterate()) max_money = max<int64>(c->money, max_money);
for (const Company *c : Company::Iterate()) max_money = std::max<int64>(c->money, max_money);
SetDParam(0, 100LL * max_money);
d = GetStringBoundingBox(STR_COMPANY_MONEY);
break;
@@ -137,7 +137,7 @@ struct StatusBarWindow : Window {
void DrawWidget(const Rect &r, int widget) const override
{
int text_offset = max(0, ((int)(r.bottom - r.top + 1) - FONT_HEIGHT_NORMAL) / 2); // Offset for rendering the text vertically centered
int text_offset = std::max(0, ((int)(r.bottom - r.top + 1) - FONT_HEIGHT_NORMAL) / 2); // Offset for rendering the text vertically centered
int text_top = r.top + text_offset;
switch (widget) {
case WID_S_LEFT:
@@ -185,7 +185,7 @@ struct StatusBarWindow : Window {
if (!this->reminder_timeout.HasElapsed()) {
Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS);
DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + max(0, ((int)(r.bottom - r.top + 1) - (int)icon_size.height) / 2));
DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + std::max(0, ((int)(r.bottom - r.top + 1) - (int)icon_size.height) / 2));
}
break;
}