Merge pull request #10412 from Gymnasiast/refactor/lesslocationxy

Remove MakeXY16
This commit is contained in:
Michael Steenbeek 2019-12-21 15:34:40 +01:00 committed by GitHub
commit ef4e494532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 8 deletions

View File

@ -1639,7 +1639,8 @@ static void map_window_set_pixels(rct_window* w)
int32_t x = 0, y = 0, dx = 0, dy = 0;
int32_t pos = (_currentLine * (MAP_WINDOW_MAP_SIZE - 1)) + MAXIMUM_MAP_SIZE_TECHNICAL - 1;
LocationXY16 destinationPosition = MakeXY16(pos % MAP_WINDOW_MAP_SIZE, pos / MAP_WINDOW_MAP_SIZE);
LocationXY16 destinationPosition = { static_cast<int16_t>(pos % MAP_WINDOW_MAP_SIZE),
static_cast<int16_t>(pos / MAP_WINDOW_MAP_SIZE) };
auto destination = _mapImageData.data() + (destinationPosition.y * MAP_WINDOW_MAP_SIZE) + destinationPosition.x;
switch (get_current_rotation())
{

View File

@ -783,7 +783,7 @@ static void window_mapgen_base_paint(rct_window* w, rct_drawpixelinfo* dpi)
gfx_draw_string_left(dpi, STR_TERRAIN_LABEL, nullptr, textColour, w->x + 4, w->y + w->widgets[WIDX_FLOOR_TEXTURE].top + 1);
// The practical map size is 2 lower than the technical map size
LocationXY16 mapSizeArgs = MakeXY16(_mapSize - 2, _mapSize - 2);
TileCoordsXY mapSizeArgs = { _mapSize - 2, _mapSize - 2 };
gfx_draw_string_left(
dpi, STR_RESOLUTION_X_BY_Y, &mapSizeArgs, w->colours[1], w->x + w->widgets[WIDX_MAP_SIZE].left + 1,
w->y + w->widgets[WIDX_MAP_SIZE].top + 1);
@ -1120,7 +1120,7 @@ static void window_mapgen_simplex_paint(rct_window* w, rct_drawpixelinfo* dpi)
w->y + w->widgets[WIDX_SIMPLEX_PLACE_TREES_CHECKBOX].top + 1);
// The practical map size is 2 lower than the technical map size
LocationXY16 mapSizeArgs = MakeXY16(_mapSize - 2, _mapSize - 2);
TileCoordsXY mapSizeArgs = { _mapSize - 2, _mapSize - 2 };
gfx_draw_string_left(
dpi, STR_RESOLUTION_X_BY_Y, &mapSizeArgs, textColour, w->x + w->widgets[WIDX_SIMPLEX_MAP_SIZE].left + 1,
w->y + w->widgets[WIDX_SIMPLEX_MAP_SIZE].top + 1);

View File

@ -4931,7 +4931,7 @@ static bool ride_initialise_cable_lift_track(Ride* ride, bool isApplying)
location = ride->stations[stationIndex].Start;
if (!location.isNull())
break;
if (stationIndex == 3)
if (stationIndex == (MAX_STATIONS - 1))
{
gGameCommandErrorText = STR_CABLE_LIFT_HILL_MUST_START_IMMEDIATELY_AFTER_STATION;
return false;

View File

@ -15,10 +15,6 @@
#define LOCATION_NULL ((int16_t)(uint16_t)0x8000)
#define RCT_XY8_UNDEFINED 0xFFFF
#define MakeXY16(x, y) \
{ \
(int16_t)(x), (int16_t)(y) \
}
#pragma pack(push, 1)
struct LocationXY8