MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawAcceptedCargo

Method DrawAcceptedCargo

src/station_gui.cpp:1874–1881  ·  view source on GitHub ↗

* Draw accepted cargo in the #WID_SV_ACCEPT_RATING_LIST widget. * @param r Rectangle of the widget. * @return Number of lines needed for drawing the accepted cargo. */

Source from the content-addressed store, hash-verified

1872 * @return Number of lines needed for drawing the accepted cargo.
1873 */
1874 int DrawAcceptedCargo(const Rect &r) const
1875 {
1876 const Station *st = Station::Get(this->window_number);
1877 Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
1878
1879 int bottom = DrawStringMultiLine(tr.left, tr.right, tr.top, INT32_MAX, GetString(STR_STATION_VIEW_ACCEPTS_CARGO, GetAcceptanceMask(st)));
1880 return CeilDiv(bottom - r.top - WidgetDimensions::scaled.framerect.top, GetCharacterHeight(FS_NORMAL));
1881 }
1882
1883 /**
1884 * Draw cargo ratings in the #WID_SV_ACCEPT_RATING_LIST widget.

Callers 1

OnPaintMethod · 0.95

Calls 6

GetAcceptanceMaskFunction · 0.85
CeilDivFunction · 0.85
GetCharacterHeightFunction · 0.85
ShrinkMethod · 0.80
DrawStringMultiLineFunction · 0.70
GetStringFunction · 0.70

Tested by

no test coverage detected