Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Broxzier committed Oct 6, 2016
1 parent 95938a0 commit 33684d1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 48 deletions.
1 change: 0 additions & 1 deletion data/language/en-GB.txt
Expand Up @@ -4230,7 +4230,6 @@ STR_5918 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COM
STR_5919 :{COMMA16}
STR_5920 :Render weather effects
STR_5921 :{SMALLFONT}{BLACK}If enabled, rain and gloomy colours will be rendered during storms.
<<<<<<< HEAD
STR_5922 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{SMALLFONT}{BLACK}Max {STRINGID}
STR_5923 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{SMALLFONT}{BLACK}Max {COMMA16} {STRINGID} per train
STR_5924 :Surface details
Expand Down
4 changes: 2 additions & 2 deletions src/localisation/string_ids.h
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/paint/map_element/fence.c
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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;
}

Expand Down
48 changes: 8 additions & 40 deletions src/windows/tile_inspector.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/world/scenery.h
Expand Up @@ -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
Expand Down

0 comments on commit 33684d1

Please sign in to comment.