1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 08:14:38 +01:00

Close #12518: Viewport Refactor (#12541)

* Remove viewport pointer from get_map_coordinates_from_pos

* Removed viewport from get_window

* Return a InteractionInfo from get_map_coord...

* Remove viewport_interaction_info struct

* Add Entity union to simplify code

* Name the enum used for viewport interaction

* Simplify functions further by returning the info struct

* Add default switches
This commit is contained in:
Duncan
2020-08-02 08:32:59 +01:00
committed by GitHub
parent 0f78d452a4
commit 733bc5a981
17 changed files with 376 additions and 451 deletions

View File

@@ -652,15 +652,11 @@ static int32_t cc_get(InteractiveConsole& console, const arguments_t& argv)
rct_window* w = window_get_main();
if (w != nullptr)
{
int32_t interactionType;
TileElement* tileElement;
CoordsXY mapCoord = {};
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,
&interactionType, &tileElement, nullptr);
auto info = get_map_coordinates_from_pos(
{ viewport->view_width / 2, viewport->view_height / 2 }, VIEWPORT_INTERACTION_MASK_TERRAIN);
auto tileMapCoord = TileCoordsXY(mapCoord);
auto tileMapCoord = TileCoordsXY(info.Loc);
console.WriteFormatLine("location %d %d", tileMapCoord.x, tileMapCoord.y);
}
}