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

Function ExpandRectWithViewportSignMargins

src/viewport.cpp:1351–1364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1349}
1350
1351static Rect ExpandRectWithViewportSignMargins(Rect r, ZoomLevel zoom)
1352{
1353 const int fh = std::max(GetCharacterHeight(FS_NORMAL), GetCharacterHeight(FS_SMALL));
1354 const int max_tw = _viewport_sign_maxwidth / 2 + 1;
1355 const int expand_y = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + fh + WidgetDimensions::scaled.fullbevel.bottom, zoom);
1356 const int expand_x = ScaleByZoom(WidgetDimensions::scaled.fullbevel.left + max_tw + WidgetDimensions::scaled.fullbevel.right, zoom);
1357
1358 r.left -= expand_x;
1359 r.right += expand_x;
1360 r.top -= expand_y;
1361 r.bottom += expand_y;
1362
1363 return r;
1364}
1365
1366/**
1367 * Add town strings to a viewport.

Callers 2

ViewportAddKdtreeSignsFunction · 0.85
CheckClickOnViewportSignFunction · 0.85

Calls 2

GetCharacterHeightFunction · 0.85
ScaleByZoomFunction · 0.85

Tested by

no test coverage detected