diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 3798ae41e6..711b3da99a 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -3247,8 +3247,6 @@ enum { STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE = 5563, STR_INSERT_CORRUPT = 5564, // Unused STR_INSERT_CORRUPT_TIP = 5565, - STR_MOVE_SELECTED_ELEMENT_UP_TIP = 5617, - STR_MOVE_SELECTED_ELEMENT_DOWN_TIP = 5618, STR_PASSWORD = 5566, STR_ADVERTISE = 5567, STR_PASSWORD_REQUIRED = 5568, @@ -3300,6 +3298,8 @@ enum { STR_TILE_INSPECTOR_FLAG_BROKEN = 5614, STR_TILE_INSPECTOR_FLAG_LAST_SHORT = 5615, STR_TILE_INSPECTOR_FLAG_LAST = 5616, + STR_MOVE_SELECTED_ELEMENT_UP_TIP = 5617, + STR_MOVE_SELECTED_ELEMENT_DOWN_TIP = 5618, STR_SCENARIO_CATEGORY_RCT1 = 5619, STR_SCENARIO_CATEGORY_RCT1_AA = 5620, STR_SCENARIO_CATEGORY_RCT1_LL = 5621, diff --git a/src/paint/map_element/fence.c b/src/paint/map_element/fence.c index 9270c63f64..38f27e8827 100644 --- a/src/paint/map_element/fence.c +++ b/src/paint/map_element/fence.c @@ -62,7 +62,7 @@ static void fence_paint_door(uint32 imageId, imageId = (imageId & 0x7FFFF) | dword_141F710; } - if (sceneryEntry->wall.flags & WALL_SCENERY_BANNER) { + if (sceneryEntry->wall.flags & WALL_SCENERY_IS_BANNER) { paint_struct * ps; ps = sub_98197C(imageId, (sint8) offset.x, (sint8) offset.y, boundsR1.x, boundsR1.y, (sint8) boundsR1.z, offset.z, boundsR1_.x, boundsR1_.y, boundsR1_.z, get_current_rotation()); @@ -279,11 +279,11 @@ void fence_paint(uint8 direction, int height, rct_map_element * map_element) } if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG2) { - if (sceneryEntry->wall.flags & WALL_SCENERY_BANNER) { + if (sceneryEntry->wall.flags & WALL_SCENERY_IS_BANNER) { imageOffset += 12; } } else { - if (sceneryEntry->wall.flags & WALL_SCENERY_BANNER) { + if (sceneryEntry->wall.flags & WALL_SCENERY_IS_BANNER) { imageOffset += 6; } } @@ -302,7 +302,7 @@ void fence_paint(uint8 direction, int height, rct_map_element * map_element) imageOffset = 1; } - if (sceneryEntry->wall.flags & WALL_SCENERY_BANNER) { + if (sceneryEntry->wall.flags & WALL_SCENERY_IS_BANNER) { imageOffset += 6; } diff --git a/src/windows/tile_inspector.c b/src/windows/tile_inspector.c index f68c04181d..51dfe08f41 100644 --- a/src/windows/tile_inspector.c +++ b/src/windows/tile_inspector.c @@ -661,25 +661,19 @@ static void window_tile_inspector_rotate_element(int index) { // Swap element with its parent static void window_tile_inspector_swap_elements(sint16 first, sint16 second) { - rct_map_element *mapElement; - rct_map_element *firstElement = NULL; - rct_map_element *secondElement = NULL; - mapElement = map_get_first_element_at(windowTileInspectorTileX, windowTileInspectorTileY); + rct_map_element *mapElement = map_get_first_element_at(windowTileInspectorTileX, windowTileInspectorTileY); + rct_map_element *const firstElement = mapElement + first; + rct_map_element *const secondElement = mapElement + second; // swap_elements shouldn't be called when there is only one element on the tile assert(!map_element_is_last_for_tile(mapElement)); - // Search for the elements - sint16 i = 0; + // Make sure both elements are actually on the current tile + sint16 elementCount = 0; do { - if (i == first) firstElement = mapElement; - if (i == second) secondElement = mapElement; - i++; - - // Check if both elements have been found - if (firstElement != NULL && secondElement != NULL) - break; + elementCount++; } while (!map_element_is_last_for_tile(mapElement++)); + assert(elementCount > max(first, second)); // Swap their memory rct_map_element temp = *firstElement; @@ -722,17 +716,7 @@ static void window_tile_inspector_track_block_height_offset(rct_map_element *map sint16 originY = windowTileInspectorTileY << 5; sint16 originZ = mapElement->base_height * 8; uint8 rotation = map_element_get_direction(mapElement); - sint16 trackpieceZ = originZ; - - switch (type) { - case TRACK_ELEM_BEGIN_STATION: - case TRACK_ELEM_MIDDLE_STATION: - type = TRACK_ELEM_END_STATION; - break; - } - uint8 rideIndex = mapElement->properties.track.ride_index; - type = mapElement->properties.track.type; rct_ride* ride = get_ride(rideIndex); const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type); @@ -787,8 +771,6 @@ static void window_tile_inspector_track_block_height_offset(rct_map_element *map map_invalidate_tile_full(x, y); - trackpieceZ = z; - bool found = false; mapElement = map_get_first_element_at(x >> 5, y >> 5); do { @@ -831,23 +813,11 @@ static void window_tile_inspector_track_block_height_offset(rct_map_element *map // Basically a copy of the above function, with just two different lines... should probably be combined somehow static void window_tile_inspector_track_block_set_lift(rct_map_element *mapElement, bool chain) { uint8 type = mapElement->properties.track.type; - uint8 sequence = mapElement->properties.track.sequence; sint16 originX = windowTileInspectorTileX << 5; sint16 originY = windowTileInspectorTileY << 5; sint16 originZ = mapElement->base_height * 8; uint8 rotation = map_element_get_direction(mapElement); - sint16 trackpieceZ = originZ; - - switch (type) { - case TRACK_ELEM_BEGIN_STATION: - case TRACK_ELEM_MIDDLE_STATION: - type = TRACK_ELEM_END_STATION; - break; - } - uint8 rideIndex = mapElement->properties.track.ride_index; - type = mapElement->properties.track.type; - rct_ride* ride = get_ride(rideIndex); const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type); trackBlock += mapElement->properties.track.sequence & 0x0F; @@ -901,8 +871,6 @@ static void window_tile_inspector_track_block_set_lift(rct_map_element *mapEleme map_invalidate_tile_full(x, y); - trackpieceZ = z; - bool found = false; mapElement = map_get_first_element_at(x >> 5, y >> 5); do { @@ -1934,7 +1902,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) { // Banner info rct_wall_scenery_entry fenceEntry = get_wall_entry(fenceType)->wall; - if (fenceEntry.flags & WALL_SCENERY_BANNER) { + if (fenceEntry.flags & WALL_SCENERY_IS_BANNER) { gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, &gBanners[mapElement->properties.fence.item[0]].string_idx, 12, x, y + 11); } else { diff --git a/src/world/scenery.h b/src/world/scenery.h index d6ba8e44b9..668c38654e 100644 --- a/src/world/scenery.h +++ b/src/world/scenery.h @@ -125,7 +125,7 @@ typedef enum { WALL_SCENERY_FLAG1 = (1 << 0), // 0x1 WALL_SCENERY_FLAG2 = (1 << 1), // 0x2 WALL_SCENERY_CANT_BUILD_ON_SLOPE = (1 << 2), // 0x4 - WALL_SCENERY_BANNER = (1 << 3), // 0x8 // Probably indicates translucency + WALL_SCENERY_IS_BANNER = (1 << 3), // 0x8 // Probably indicates translucency WALL_SCENERY_IS_DOOR = (1 << 4), // 0x10 WALL_SCENERY_FLAG6 = (1 << 5), // 0x20 WALL_SCENERY_HAS_SECONDARY_COLOUR = (1 << 6), // 0x40