1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Better consistensy with already existing helper functions

This commit is contained in:
Hielke Morsink
2015-12-03 23:49:26 +01:00
parent 370c08f796
commit b82504c5e4
3 changed files with 25 additions and 20 deletions

View File

@@ -332,23 +332,23 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *
break;
case MAP_ELEMENT_TYPE_PATH:
{
rct_map_element_path_properties *pathProperties = &element->properties.path;
uint8 pathType = footpath_element_get_type(pathProperties);
uint8 pathAdditionType = footpath_element_get_addition_type(pathProperties);
const uint8 pathType = footpath_element_get_type(element);
const uint8 pathHasScenery = footpath_element_has_path_scenery(element);
const uint8 pathAdditionType = footpath_element_get_path_scenery_index(element);
if (footpath_element_is_queue(element)) {
sprintf(
buffer, "Queue (%s)%s%s for (%d)",
language_get_string(g_pathSceneryEntries[pathType]->name), // Path name
pathAdditionType ? " with " : "", // Adds " with " when there is something on the path
pathAdditionType ? language_get_string(g_pathBitSceneryEntries[pathAdditionType - 1]->name) : "", // Path addition name
pathProperties->ride_index // Ride index for queue
pathHasScenery ? " with " : "", // Adds " with " when there is something on the path
pathHasScenery ? language_get_string(g_pathBitSceneryEntries[pathAdditionType]->name) : "", // Path addition name
element->properties.path.ride_index // Ride index for queue
);
} else {
sprintf(
buffer, "Path (%s)%s%s",
language_get_string(g_pathSceneryEntries[pathType]->name), // Path name
pathAdditionType ? " with " : "", // Adds " with " when there is something on the path
pathAdditionType ? language_get_string(g_pathBitSceneryEntries[pathAdditionType - 1]->name) : "" // Path addition name
pathHasScenery ? " with " : "", // Adds " with " when there is something on the path
pathHasScenery ? language_get_string(g_pathBitSceneryEntries[pathAdditionType]->name) : "" // Path addition name
);
}
}

View File

@@ -1582,7 +1582,7 @@ bool footpath_element_is_sloped(rct_map_element *mapElement)
return mapElement->properties.path.type & 4;
}
int footpath_element_get_slope_direction(rct_map_element *mapElement)
uint8 footpath_element_get_slope_direction(rct_map_element *mapElement)
{
return mapElement->properties.path.type & 3;
}
@@ -1597,19 +1597,24 @@ bool footpath_element_is_wide(rct_map_element *mapElement)
return mapElement->type & 2;
}
uint8 footpath_element_get_type(rct_map_element_path_properties *pathProperties)
bool footpath_element_has_path_scenery(rct_map_element *mapElement)
{
return pathProperties->type >> 4;
return (mapElement->properties.path.additions & 0xF) > 0;
}
uint8 footpath_element_get_direction(rct_map_element_path_properties *pathProperties)
uint8 footpath_element_get_path_scenery(rct_map_element *mapElement)
{
return pathProperties->type & 3;
return mapElement->properties.path.additions & 0xF;
}
uint8 footpath_element_get_addition_type(rct_map_element_path_properties *pathProperties)
uint8 footpath_element_get_path_scenery_index(rct_map_element *mapElement)
{
return pathProperties->additions & 0xF;
return footpath_element_get_path_scenery(mapElement) - 1;
}
uint8 footpath_element_get_type(rct_map_element *mapElement)
{
return mapElement->properties.path.type >> 4;
}
/**

View File

@@ -70,13 +70,13 @@ void footpath_bridge_get_info_from_pos(int screenX, int screenY, int *x, int *y,
int footpath_is_connected_to_map_edge(int x, int y, int z, int direction, int flags);
bool footpath_element_is_sloped(rct_map_element *mapElement);
int footpath_element_get_slope_direction(rct_map_element *mapElement);
uint8 footpath_element_get_slope_direction(rct_map_element *mapElement);
bool footpath_element_is_queue(rct_map_element *mapElement);
bool footpath_element_is_wide(rct_map_element *mapElement);
uint8 footpath_element_get_type(rct_map_element_path_properties *pathProperties);
uint8 footpath_element_get_direction(rct_map_element_path_properties *pathProperties);
uint8 footpath_element_get_addition_type(rct_map_element_path_properties *pathProperties);
uint8 footpath_element_get_addition_type(rct_map_element_path_properties *pathProperties);
uint8 footpath_element_get_type(rct_map_element *mapElement);
bool footpath_element_has_path_scenery(rct_map_element *mapElement);
uint8 footpath_element_get_path_scenery(rct_map_element *mapElement);
uint8 footpath_element_get_path_scenery_index(rct_map_element *mapElement);
void footpath_remove_edges_at(int x, int y, rct_map_element *mapElement);
#endif