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

Method DrawWidgetCompanyButton

src/script/script_gui.cpp:844–850  ·  view source on GitHub ↗

* Draw a company button icon. * @param r Rect area to draw within. * @param widget Widget index to start. * @param start Widget index of first company button. */

Source from the content-addressed store, hash-verified

842 * @param start Widget index of first company button.
843 */
844 void DrawWidgetCompanyButton(const Rect &r, WidgetID widget, int start) const
845 {
846 if (this->IsWidgetDisabled(widget)) return;
847 CompanyID cid = static_cast<CompanyID>(widget - start);
848 Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
849 DrawCompanyIcon(cid, CentreBounds(r.left, r.right, sprite_size.width), CentreBounds(r.top, r.bottom, sprite_size.height));
850 }
851
852 /**
853 * Draw the AI/GS log.

Callers 1

DrawWidgetMethod · 0.95

Calls 4

GetSpriteSizeFunction · 0.85
DrawCompanyIconFunction · 0.85
CentreBoundsFunction · 0.85
IsWidgetDisabledMethod · 0.80

Tested by

no test coverage detected