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

Function GetTileZoomCenterWindow

src/viewport.cpp:462–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460
461
462Point GetTileZoomCenterWindow(bool in, Window * w)
463{
464 int x, y;
465 const Viewport &vp = *w->viewport;
466
467 if (in) {
468 x = ((_cursor.pos.x - vp.left) >> 1) + (vp.width >> 2);
469 y = ((_cursor.pos.y - vp.top) >> 1) + (vp.height >> 2);
470 } else {
471 x = vp.width - (_cursor.pos.x - vp.left);
472 y = vp.height - (_cursor.pos.y - vp.top);
473 }
474 /* Get the tile below the cursor and center on the zoomed-out center */
475 return GetTileFromScreenXY(_cursor.pos.x, _cursor.pos.y, x + vp.left, y + vp.top);
476}
477
478/**
479 * Update the status of the zoom-buttons according to the zoom-level

Callers 1

Calls 1

GetTileFromScreenXYFunction · 0.85

Tested by

no test coverage detected