1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Use mapCoords instead of ScreenCoords

This commit is contained in:
Tulio Leao
2019-11-12 20:13:14 -03:00
parent 3fa4b7b964
commit 5e888747de
3 changed files with 12 additions and 20 deletions

View File

@@ -719,8 +719,6 @@ static void window_footpath_set_provisional_path_at_point(ScreenCoordsXY screenC
get_map_coordinates_from_pos(
screenCoords.x, screenCoords.y, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x,
&mapCoord.y, &interactionType, &tileElement, nullptr);
screenCoords.x = mapCoord.x;
screenCoords.y = mapCoord.y;
if (interactionType == VIEWPORT_INTERACTION_ITEM_NONE || tileElement == nullptr)
{
@@ -730,8 +728,8 @@ static void window_footpath_set_provisional_path_at_point(ScreenCoordsXY screenC
else
{
// Check for change
if ((gFootpathProvisionalFlags & PROVISIONAL_PATH_FLAG_1) && gFootpathProvisionalPosition.x == screenCoords.x
&& gFootpathProvisionalPosition.y == screenCoords.y && gFootpathProvisionalPosition.z == tileElement->base_height)
if ((gFootpathProvisionalFlags & PROVISIONAL_PATH_FLAG_1) && gFootpathProvisionalPosition.x == mapCoord.x
&& gFootpathProvisionalPosition.y == mapCoord.y && gFootpathProvisionalPosition.z == tileElement->base_height)
{
return;
}
@@ -739,10 +737,10 @@ static void window_footpath_set_provisional_path_at_point(ScreenCoordsXY screenC
// Set map selection
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
gMapSelectType = MAP_SELECT_TYPE_FULL;
gMapSelectPositionA.x = screenCoords.x;
gMapSelectPositionA.y = screenCoords.y;
gMapSelectPositionB.x = screenCoords.x;
gMapSelectPositionB.y = screenCoords.y;
gMapSelectPositionA.x = mapCoord.x;
gMapSelectPositionA.y = mapCoord.y;
gMapSelectPositionB.x = mapCoord.x;
gMapSelectPositionB.y = mapCoord.y;
footpath_provisional_update();
@@ -781,7 +779,7 @@ static void window_footpath_set_provisional_path_at_point(ScreenCoordsXY screenC
}
int32_t pathType = (gFootpathSelectedType << 7) + (gFootpathSelectedId & 0xFF);
_window_footpath_cost = footpath_provisional_set(pathType, screenCoords.x, screenCoords.y, z, slope);
_window_footpath_cost = footpath_provisional_set(pathType, mapCoord.x, mapCoord.y, z, slope);
window_invalidate_by_class(WC_FOOTPATH);
}
}
@@ -855,8 +853,6 @@ static void window_footpath_place_path_at_point(ScreenCoordsXY screenCoords)
get_map_coordinates_from_pos(
screenCoords.x, screenCoords.y, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x,
&mapCoord.y, &interactionType, &tileElement, nullptr);
screenCoords.x = mapCoord.x;
screenCoords.y = mapCoord.y;
if (interactionType == VIEWPORT_INTERACTION_ITEM_NONE)
{
@@ -888,7 +884,7 @@ static void window_footpath_place_path_at_point(ScreenCoordsXY screenCoords)
// Try and place path
gGameCommandErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
auto footpathPlaceAction = FootpathPlaceAction({ screenCoords.x, screenCoords.y, z * 8 }, currentType, selectedType);
auto footpathPlaceAction = FootpathPlaceAction({ mapCoord.x, mapCoord.y, z * 8 }, currentType, selectedType);
footpathPlaceAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
if (result->Error == GA_ERROR::OK)
{

View File

@@ -1231,8 +1231,7 @@ void window_guest_overview_tool_update(rct_window* w, rct_widgetindex widgetInde
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
int32_t map_x, map_y;
screenCoords.y += 16;
footpath_get_coordinates_from_pos(screenCoords, &map_x, &map_y, nullptr, nullptr);
footpath_get_coordinates_from_pos({ screenCoords.x, screenCoords.y + 16 }, &map_x, &map_y, nullptr, nullptr);
if (map_x != LOCATION_NULL)
{
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
@@ -1283,8 +1282,7 @@ void window_guest_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex,
int32_t dest_x, dest_y;
TileElement* tileElement;
screenCoords.y += 16;
footpath_get_coordinates_from_pos(screenCoords, &dest_x, &dest_y, nullptr, &tileElement);
footpath_get_coordinates_from_pos({ screenCoords.x, screenCoords.y + 16 }, &dest_x, &dest_y, nullptr, &tileElement);
if (dest_x == LOCATION_NULL)
return;

View File

@@ -1147,8 +1147,7 @@ void window_staff_overview_tool_update(rct_window* w, rct_widgetindex widgetInde
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
int32_t map_x, map_y;
screenCoords.y += 16;
footpath_get_coordinates_from_pos(screenCoords, &map_x, &map_y, nullptr, nullptr);
footpath_get_coordinates_from_pos({ screenCoords.x, screenCoords.y + 16 }, &map_x, &map_y, nullptr, nullptr);
if (map_x != LOCATION_NULL)
{
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
@@ -1198,8 +1197,7 @@ void window_staff_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex,
{
int32_t dest_x, dest_y;
TileElement* tileElement;
screenCoords.y += 16;
footpath_get_coordinates_from_pos(screenCoords, &dest_x, &dest_y, nullptr, &tileElement);
footpath_get_coordinates_from_pos({ screenCoords.x, screenCoords.y + 16 }, &dest_x, &dest_y, nullptr, &tileElement);
if (dest_x == LOCATION_NULL)
return;