diff --git a/src/map.c b/src/map.c index 20d85834b6..d7fcfb3003 100644 --- a/src/map.c +++ b/src/map.c @@ -335,16 +335,16 @@ void sub_68B089() * Checks if the tile at coordinate at height counts as connected. * @return 1 if connected, 0 otherwisei */ -int map_coord_is_connected(uint16 coordinate, uint8 height, uint8 face_direction) +int map_coord_is_connected(uint16 tile_idx, uint8 height, uint8 face_direction) { - rct_map_element* tile = RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[coordinate]; + rct_map_element* tile = RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[tile_idx]; do { rct_map_element_path_properties props = tile->properties.path; uint8 path_type = props.type >> 2, path_dir = props.type & 3; uint8 element_type = tile->type & MAP_ELEMENT_TYPE_MASK; - if (!(element_type & PATH_ROAD)) + if (element_type != PATH_ROAD) continue; if (path_type & 1) { diff --git a/src/ride.c b/src/ride.c index 32f500d1ea..005b776d47 100644 --- a/src/ride.c +++ b/src/ride.c @@ -275,10 +275,10 @@ void ride_is_shop_reachable(rct_ride* ride, int ride_idx) uint8 track_type = tile->properties.track.type; ride = GET_RIDE(tile->properties.track.ride_index); - if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000) { // buggy but why - magic = RCT2_ADDRESS(0x0099BA64, uint8)[track_type * 16]; - } else { + if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000) { magic = RCT2_ADDRESS(0x0099CA64, uint8)[track_type * 16]; + } else { + magic = RCT2_ADDRESS(0x0099BA64, uint8)[track_type * 16]; } magic = magic << (tile->type & 3); @@ -286,18 +286,19 @@ void ride_is_shop_reachable(rct_ride* ride, int ride_idx) if (magic == 0) return; - for (int count = 0; magic != 0; ++count) { + for (int count = 0; magic != 0; ++count) { if (!(magic & 1)) { - magic >>= 1; + magic >>= 1; continue; } + magic >>= 1; uint8 face_direction = count ^ 2; y -= RCT2_ADDRESS(0x00993CCC, sint16)[face_direction * 2]; x -= RCT2_ADDRESS(0x00993CCE, sint16)[face_direction * 2]; tile_idx = ((x << 8) | y) >> 5; - if (map_coord_is_connected(tile, tile->base_height, face_direction)) + if (map_coord_is_connected(tile_idx, tile->base_height, face_direction)) return; } @@ -328,7 +329,6 @@ void ride_check_all_reachable() if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x20000) { //blue ride_is_shop_reachable(ride, i); - return; } else { //pink