mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use maxdim instead of setting width/height separately. (#11535)
parent
aae6e0481e
commit
17c3ce8632
|
@ -1466,12 +1466,9 @@ public:
|
||||||
*size = maxdim(*size, GetStringBoundingBox(STR_FACE_MOUSTACHE));
|
*size = maxdim(*size, GetStringBoundingBox(STR_FACE_MOUSTACHE));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_SCMF_FACE: {
|
case WID_SCMF_FACE:
|
||||||
Dimension face_size = GetScaledSpriteSize(SPR_GRADIENT);
|
*size = maxdim(*size, GetScaledSpriteSize(SPR_GRADIENT));
|
||||||
size->width = std::max(size->width, face_size.width);
|
|
||||||
size->height = std::max(size->height, face_size.height);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case WID_SCMF_HAS_MOUSTACHE_EARRING:
|
case WID_SCMF_HAS_MOUSTACHE_EARRING:
|
||||||
case WID_SCMF_HAS_GLASSES:
|
case WID_SCMF_HAS_GLASSES:
|
||||||
|
@ -2323,12 +2320,9 @@ struct CompanyWindow : Window
|
||||||
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
|
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_C_FACE: {
|
case WID_C_FACE:
|
||||||
Dimension face_size = GetScaledSpriteSize(SPR_GRADIENT);
|
*size = maxdim(*size, GetScaledSpriteSize(SPR_GRADIENT));
|
||||||
size->width = std::max(size->width, face_size.width);
|
|
||||||
size->height = std::max(size->height, face_size.height);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case WID_C_DESC_COLOUR_SCHEME_EXAMPLE: {
|
case WID_C_DESC_COLOUR_SCHEME_EXAMPLE: {
|
||||||
Point offset;
|
Point offset;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
/** @file error_gui.cpp GUI related to errors. */
|
/** @file error_gui.cpp GUI related to errors. */
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "core/geometry_func.hpp"
|
||||||
#include "core/mem_func.hpp"
|
#include "core/mem_func.hpp"
|
||||||
#include "landscape.h"
|
#include "landscape.h"
|
||||||
#include "newgrf_text.h"
|
#include "newgrf_text.h"
|
||||||
|
@ -208,12 +209,9 @@ public:
|
||||||
size->height = std::max(size->height, panel_height);
|
size->height = std::max(size->height, panel_height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WID_EM_FACE: {
|
case WID_EM_FACE:
|
||||||
Dimension face_size = GetScaledSpriteSize(SPR_GRADIENT);
|
*size = maxdim(*size, GetScaledSpriteSize(SPR_GRADIENT));
|
||||||
size->width = std::max(size->width, face_size.width);
|
|
||||||
size->height = std::max(size->height, face_size.height);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue