MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / getCentreMapPosition

Method getCentreMapPosition

src/OpenLoco/src/Viewport.cpp:299–314  ·  view source on GitHub ↗

0x0045F997

Source from the content-addressed store, hash-verified

297
298 // 0x0045F997
299 Pos2 Viewport::getCentreMapPosition() const
300 {
301 const viewport_pos initialVPPos = getCentre();
302
303 const auto rotation = getRotation();
304 // Vanilla unrolled on rotation at this point
305
306 auto result = viewportCoordToMapCoord(initialVPPos.x, initialVPPos.y, 0, rotation);
307 for (auto i = 0; i < 6; i++)
308 {
309 const auto z = World::TileManager::getHeight(result);
310 result = viewportCoordToMapCoord(initialVPPos.x, initialVPPos.y, z.landHeight, rotation);
311 }
312
313 return result;
314 }
315
316 std::optional<Pos2> Viewport::getCentreScreenMapPosition() const
317 {

Callers 4

updateOwnerStatusFunction · 0.80
viewportRotateMethod · 0.80
updateAmbientNoiseFunction · 0.80
drawSavePreviewImageFunction · 0.80

Calls 2

viewportCoordToMapCoordFunction · 0.85
getHeightFunction · 0.85

Tested by

no test coverage detected