Use CoordsXY for Map::clear functions (#10439)

This commit is contained in:
Tulio Leao 2019-12-27 11:58:40 -03:00 committed by Michael Steenbeek
parent d0744df22f
commit 19b7bed37e
4 changed files with 13 additions and 13 deletions

View File

@ -383,8 +383,8 @@ private:
* rct2: 0x00663CB9
*/
static int32_t map_set_land_height_clear_func(
TileElement * *tile_element, [[maybe_unused]] int32_t x, [[maybe_unused]] int32_t y, [[maybe_unused]] uint8_t flags,
[[maybe_unused]] money32 * price)
TileElement * *tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] uint8_t flags,
[[maybe_unused]] money32* price)
{
if ((*tile_element)->GetType() == TILE_ELEMENT_TYPE_SURFACE)
return 0;

View File

@ -1384,7 +1384,7 @@ bool map_can_construct_with_clear_at(
loc_68BABC:
if (clearFunc != nullptr)
{
if (!clearFunc(&tileElement, x, y, flags, price))
if (!clearFunc(&tileElement, { x, y }, flags, price))
{
continue;
}
@ -1418,7 +1418,7 @@ bool map_can_construct_with_clear_at(
loc_68BAE6:
if (clearFunc != nullptr)
{
if (!clearFunc(&tileElement, x, y, flags, price))
if (!clearFunc(&tileElement, { x, y }, flags, price))
{
goto loc_68B9B7;
}

View File

@ -171,10 +171,10 @@ void map_reorganise_elements();
bool map_check_free_elements_and_reorganise(int32_t num_elements);
TileElement* tile_element_insert(const TileCoordsXYZ& loc, int32_t occupiedQuadrants);
using CLEAR_FUNC = int32_t (*)(TileElement** tile_element, int32_t x, int32_t y, uint8_t flags, money32* price);
using CLEAR_FUNC = int32_t (*)(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price);
int32_t map_place_non_scenery_clear_func(TileElement** tile_element, int32_t x, int32_t y, uint8_t flags, money32* price);
int32_t map_place_scenery_clear_func(TileElement** tile_element, int32_t x, int32_t y, uint8_t flags, money32* price);
int32_t map_place_non_scenery_clear_func(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price);
int32_t map_place_scenery_clear_func(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price);
bool map_can_construct_with_clear_at(
int32_t x, int32_t y, int32_t zLow, int32_t zHigh, CLEAR_FUNC clearFunc, QuarterTile quarterTile, uint8_t flags,
money32* price, uint8_t crossingMode);

View File

@ -25,7 +25,7 @@
#include "Surface.h"
static int32_t map_place_clear_func(
TileElement** tile_element, int32_t x, int32_t y, uint8_t flags, money32* price, bool is_scenery)
TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price, bool is_scenery)
{
if ((*tile_element)->GetType() != TILE_ELEMENT_TYPE_SMALL_SCENERY)
return 1;
@ -50,7 +50,7 @@ static int32_t map_place_clear_func(
if (!(flags & GAME_COMMAND_FLAG_APPLY))
return 0;
map_invalidate_tile(x, y, (*tile_element)->GetBaseZ(), (*tile_element)->GetClearanceZ());
map_invalidate_tile(coords.x, coords.y, (*tile_element)->GetBaseZ(), (*tile_element)->GetClearanceZ());
tile_element_remove(*tile_element);
@ -62,18 +62,18 @@ static int32_t map_place_clear_func(
*
* rct2: 0x006E0D6E, 0x006B8D88
*/
int32_t map_place_scenery_clear_func(TileElement** tile_element, int32_t x, int32_t y, uint8_t flags, money32* price)
int32_t map_place_scenery_clear_func(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price)
{
return map_place_clear_func(tile_element, x, y, flags, price, /*is_scenery=*/true);
return map_place_clear_func(tile_element, coords, flags, price, /*is_scenery=*/true);
}
/**
*
* rct2: 0x006C5A4F, 0x006CDE57, 0x006A6733, 0x0066637E
*/
int32_t map_place_non_scenery_clear_func(TileElement** tile_element, int32_t x, int32_t y, uint8_t flags, money32* price)
int32_t map_place_non_scenery_clear_func(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money32* price)
{
return map_place_clear_func(tile_element, x, y, flags, price, /*is_scenery=*/false);
return map_place_clear_func(tile_element, coords, flags, price, /*is_scenery=*/false);
}
bool scenery_small_entry_has_flag(const rct_scenery_entry* sceneryEntry, uint32_t flags)