Merge branch 'master' into jgrpp

# Conflicts:
#	src/core/geometry_type.hpp
#	src/error_gui.cpp
#	src/rail_gui.cpp
#	src/tree_gui.cpp
#	src/vehicle_gui.cpp
#	src/widgets/dropdown.cpp
This commit is contained in:
Jonathan G Rennison
2022-12-03 23:40:22 +00:00
33 changed files with 174 additions and 147 deletions

View File

@@ -1387,20 +1387,20 @@ void GetTrainSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs,
VehicleSpriteSeq seq;
GetRailIcon(engine, false, y, image_type, &seq);
Rect16 rect = seq.GetBounds();
Rect rect = ConvertRect<Rect16, Rect>(seq.GetBounds());
width = UnScaleGUI(rect.right - rect.left + 1);
height = UnScaleGUI(rect.bottom - rect.top + 1);
width = UnScaleGUI(rect.Width());
height = UnScaleGUI(rect.Height());
xoffs = UnScaleGUI(rect.left);
yoffs = UnScaleGUI(rect.top);
if (RailVehInfo(engine)->railveh_type == RAILVEH_MULTIHEAD) {
GetRailIcon(engine, true, y, image_type, &seq);
rect = seq.GetBounds();
rect = ConvertRect<Rect16, Rect>(seq.GetBounds());
/* Calculate values relative to an imaginary center between the two sprites. */
width = ScaleGUITrad(TRAININFO_DEFAULT_VEHICLE_WIDTH) + UnScaleGUI(rect.right) - xoffs;
height = std::max<uint>(height, UnScaleGUI(rect.bottom - rect.top + 1));
height = std::max<uint>(height, UnScaleGUI(rect.Height()));
xoffs = xoffs - ScaleGUITrad(TRAININFO_DEFAULT_VEHICLE_WIDTH) / 2;
yoffs = std::min(yoffs, UnScaleGUI(rect.top));
}