1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 16:54:52 +01:00

Add viewport getter

This commit is contained in:
Marijn van der Werf
2018-01-05 23:31:56 +01:00
committed by Aaron van Geffen
parent aa0933d08a
commit 430bf482f2
8 changed files with 32 additions and 17 deletions

View File

@@ -147,7 +147,7 @@ void console_update()
// When scrolling the map, the console pixels get copied... therefore invalidate the screen
rct_window *mainWindow = window_get_main();
if (mainWindow != nullptr) {
rct_viewport *mainViewport = mainWindow->viewport;
rct_viewport *mainViewport = window_get_viewport(mainWindow);
if (mainViewport != nullptr) {
if (_lastMainViewportX != mainViewport->view_x || _lastMainViewportY != mainViewport->view_y) {
_lastMainViewportX = mainViewport->view_x;
@@ -834,7 +834,8 @@ static sint32 cc_get(const utf8 **argv, sint32 argc)
sint32 interactionType;
rct_tile_element *tileElement;
LocationXY16 mapCoord = { 0 };
get_map_coordinates_from_pos(w->viewport->view_width / 2, w->viewport->view_height / 2, VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &tileElement, nullptr);
rct_viewport * viewport = window_get_viewport(w);
get_map_coordinates_from_pos(viewport->view_width / 2, viewport->view_height / 2, VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &tileElement, nullptr);
mapCoord.x -= 16;
mapCoord.x /= 32;
mapCoord.y -= 16;