From 47a23603ae9cfce9435ee72a6f7ec9ed2f38b2b2 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Thu, 11 Jan 2018 11:27:56 +0100 Subject: [PATCH] Remove unused functions --- src/openrct2/world/Footpath.cpp | 23 ----- src/openrct2/world/MapHelpers.cpp | 149 ------------------------------ src/openrct2/world/Sprite.cpp | 14 --- 3 files changed, 186 deletions(-) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index d0a1633e31..847cc85bc2 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -1256,29 +1256,6 @@ static bool footpath_disconnect_queue_from_path(sint32 x, sint32 y, rct_tile_ele return false; } -static bool footpath_is_queue_connected_to_path(sint32 x, sint32 y, rct_tile_element *tileElement, sint32 direction) -{ - if (!footpath_element_is_queue(tileElement)) - return false; - - if (!(tileElement->properties.path.edges & (1 << direction))) - return false; - - x += TileDirectionDelta[direction].x; - y += TileDirectionDelta[direction].y; - tileElement = map_get_path_element_at(x / 32, y / 32, tileElement->base_height); - if (tileElement == NULL) - return false; - - if (footpath_element_is_queue(tileElement)) - return false; - - if (tileElement->properties.path.edges & ((1 << direction) ^ 2)) - return true; - - return false; -} - /** * * rct2: 0x006A6D7E diff --git a/src/openrct2/world/MapHelpers.cpp b/src/openrct2/world/MapHelpers.cpp index e9d15cbce8..8d73dec59f 100644 --- a/src/openrct2/world/MapHelpers.cpp +++ b/src/openrct2/world/MapHelpers.cpp @@ -180,155 +180,6 @@ sint32 map_smooth(sint32 l, sint32 t, sint32 r, sint32 b) return raisedLand; } -static sint32 map_get_corner_height(sint32 x, sint32 y, sint32 corner) -{ - rct_tile_element *tileElement = map_get_surface_element_at(x, y); - sint32 baseHeight = tileElement->base_height; - sint32 slope = tileElement->properties.surface.slope; - sint32 doubleCorner = slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT; - if (doubleCorner) { - if (!(slope & TILE_ELEMENT_SLOPE_N_CORNER_UP)) doubleCorner = 4; - else if (!(slope & TILE_ELEMENT_SLOPE_E_CORNER_UP)) doubleCorner = 8; - else if (!(slope & TILE_ELEMENT_SLOPE_S_CORNER_UP)) doubleCorner = 1; - else if (!(slope & TILE_ELEMENT_SLOPE_W_CORNER_UP)) doubleCorner = 2; - } - - switch (corner) { - case 0: - return baseHeight + ((slope & TILE_ELEMENT_SLOPE_N_CORNER_UP) ? (doubleCorner == 1 ? 4 : 2) : 0); - case 1: - return baseHeight + ((slope & TILE_ELEMENT_SLOPE_W_CORNER_UP) ? (doubleCorner == 8 ? 4 : 2) : 0); - case 2: - return baseHeight + ((slope & TILE_ELEMENT_SLOPE_E_CORNER_UP) ? (doubleCorner == 2 ? 4 : 2) : 0); - case 3: - return baseHeight + ((slope & TILE_ELEMENT_SLOPE_S_CORNER_UP) ? (doubleCorner == 4 ? 4 : 2) : 0); - default: - return baseHeight; - } -} - -/** - * There are non-smoothed tiles with this version, but diagonal land blocks end up being wavy. - */ -static sint32 map_smooth_wavy(sint32 l, sint32 t, sint32 r, sint32 b) -{ - sint32 i, x, y, count, doubleCorner, raisedLand = 0; - uint8 highest, cornerHeights[4]; - rct_tile_element *tileElement; - for (y = t; y < b; y++) - { - for (x = l; x < r; x++) - { - tileElement = map_get_surface_element_at(x, y); - tileElement->properties.surface.slope &= ~TILE_ELEMENT_SURFACE_SLOPE_MASK; - - // Raise to edge height - 2 - highest = tileElement->base_height; - highest = std::max(highest, map_get_surface_element_at(x - 1, y + 0)->base_height); - highest = std::max(highest, map_get_surface_element_at(x + 1, y + 0)->base_height); - highest = std::max(highest, map_get_surface_element_at(x + 0, y - 1)->base_height); - highest = std::max(highest, map_get_surface_element_at(x + 0, y + 1)->base_height); - if (tileElement->base_height < highest - 2) { - raisedLand = 1; - tileElement->base_height = tileElement->clearance_height = highest - 2; - } - - // Check corners - doubleCorner = -1; - cornerHeights[0] = std::max(map_get_corner_height(x - 1, y - 1, 0), std::max(map_get_corner_height(x + 1, y + 0, 1), map_get_corner_height(x + 0, y + 1, 2))); - cornerHeights[1] = std::max(map_get_corner_height(x + 1, y - 1, 1), std::max(map_get_corner_height(x - 1, y + 0, 0), map_get_corner_height(x + 0, y + 1, 3))); - cornerHeights[2] = std::max(map_get_corner_height(x + 1, y + 1, 3), std::max(map_get_corner_height(x + 1, y + 0, 3), map_get_corner_height(x + 0, y - 1, 0))); - cornerHeights[3] = std::max(map_get_corner_height(x - 1, y + 1, 2), std::max(map_get_corner_height(x - 1, y + 0, 2), map_get_corner_height(x + 0, y - 1, 1))); - highest = tileElement->base_height; - for (i = 0; i < 4; i++) - highest = std::max(highest, cornerHeights[i]); - - if (highest >= tileElement->base_height + 4) { - count = 0; - for (i = 0; i < 4; i++) - if (cornerHeights[i] == highest) - count++; - - if (count == 1) { - if (tileElement->base_height < highest - 4) { - tileElement->base_height = tileElement->clearance_height = highest - 4; - raisedLand = 1; - } - if (cornerHeights[0] == highest && cornerHeights[2] <= cornerHeights[0] - 4) - doubleCorner = 0; - else if (cornerHeights[1] == highest && cornerHeights[3] <= cornerHeights[1] - 4) - doubleCorner = 1; - else if (cornerHeights[2] == highest && cornerHeights[0] <= cornerHeights[2] - 4) - doubleCorner = 2; - else if (cornerHeights[3] == highest && cornerHeights[1] <= cornerHeights[3] - 4) - doubleCorner = 3; - } else { - if (tileElement->base_height < highest - 2) { - tileElement->base_height = tileElement->clearance_height = highest - 2; - raisedLand = 1; - } - } - } - - if (doubleCorner != -1) { - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT; - switch (doubleCorner) { - case 0: - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_N_CORNER_DN; - break; - case 1: - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_W_CORNER_DN; - break; - case 2: - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_S_CORNER_DN; - break; - case 3: - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_E_CORNER_DN; - break; - } - } else { - // Corners - if ( - map_get_corner_height(x + 1, y + 1, 3) > tileElement->base_height || - map_get_corner_height(x + 1, y + 0, 1) > tileElement->base_height || - map_get_corner_height(x + 0, y + 1, 2) > tileElement->base_height - ) - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_N_CORNER_UP; - - if ( - map_get_corner_height(x - 1, y + 1, 2) > tileElement->base_height || - map_get_corner_height(x - 1, y + 0, 0) > tileElement->base_height || - map_get_corner_height(x + 0, y + 1, 3) > tileElement->base_height - ) - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_W_CORNER_UP; - - if ( - map_get_corner_height(x + 1, y - 1, 1) > tileElement->base_height || - map_get_corner_height(x + 1, y + 0, 3) > tileElement->base_height || - map_get_corner_height(x + 0, y - 1, 0) > tileElement->base_height - ) - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_E_CORNER_UP; - - if ( - map_get_corner_height(x - 1, y - 1, 0) > tileElement->base_height || - map_get_corner_height(x - 1, y + 0, 2) > tileElement->base_height || - map_get_corner_height(x + 0, y - 1, 1) > tileElement->base_height - ) - tileElement->properties.surface.slope |= TILE_ELEMENT_SLOPE_S_CORNER_UP; - - // Raise - if (tileElement->properties.surface.slope == TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) - { - tileElement->properties.surface.slope &= ~TILE_ELEMENT_SURFACE_SLOPE_MASK; - tileElement->base_height = tileElement->clearance_height += 2; - } - } - } - } - - return raisedLand; -} - /** * Raises the corners based on the height offset of neighbour tiles. * This does not change the base height, unless all corners have been raised. diff --git a/src/openrct2/world/Sprite.cpp b/src/openrct2/world/Sprite.cpp index 629dafb463..788fffbc7c 100644 --- a/src/openrct2/world/Sprite.cpp +++ b/src/openrct2/world/Sprite.cpp @@ -916,20 +916,6 @@ static bool index_is_in_list(uint16 index, enum SPRITE_LIST sl) return false; } -static bool index_is_in_spatial_list(uint16 index, sint32 quadrant) -{ - uint16 sprite_index = gSpriteSpatialIndex[quadrant]; - while (sprite_index != SPRITE_INDEX_NULL) - { - if (sprite_index == index) - { - return true; - } - sprite_index = get_sprite(sprite_index)->unknown.next_in_quadrant; - } - return false; -} - sint32 check_for_sprite_list_cycles(bool fix) { for (sint32 i = 0; i < NUM_SPRITE_LISTS; i++) {