From 33dcb1a506bba3bbd7267a8cb16ddfda0169a6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 13 Jan 2017 10:47:39 +0100 Subject: [PATCH] Rename types to avoid shadowing --- src/openrct2/core/Stopwatch.cpp | 32 +++++++------- src/openrct2/core/stopwatch.h | 20 ++++----- src/openrct2/paint/map_element/map_element.h | 4 +- src/openrct2/paint/map_element/surface.c | 40 +++++++++--------- src/openrct2/peep/peep.c | 18 ++++---- src/openrct2/platform/platform.h | 4 +- src/openrct2/platform/shared.c | 14 +++---- src/openrct2/ride/track_paint.c | 12 +++--- src/openrct2/ride/track_paint.h | 6 +-- .../windows/editor_object_selection.c | 4 +- src/openrct2/windows/options.c | 4 +- src/openrct2/world/map.c | 42 +++++++++---------- 12 files changed, 100 insertions(+), 100 deletions(-) diff --git a/src/openrct2/core/Stopwatch.cpp b/src/openrct2/core/Stopwatch.cpp index 91b0d80ef6..72772d6745 100644 --- a/src/openrct2/core/Stopwatch.cpp +++ b/src/openrct2/core/Stopwatch.cpp @@ -102,49 +102,49 @@ extern "C" { #include "stopwatch.h" - void stopwatch_create(stopwatch * _stopwatch) + void stopwatch_create(stopwatch_t * stopwatch) { - _stopwatch->context = new Stopwatch(); + stopwatch->context = new Stopwatch(); } - void stopwatch_dispose(stopwatch * _stopwatch) + void stopwatch_dispose(stopwatch_t * stopwatch) { - delete static_cast(_stopwatch->context); + delete static_cast(stopwatch->context); } - uint64 stopwatch_GetElapsedTicks(stopwatch * _stopwatch) + uint64 stopwatch_GetElapsedTicks(stopwatch_t * stopwatch) { - Stopwatch * ctx = static_cast(_stopwatch->context); + Stopwatch * ctx = static_cast(stopwatch->context); return ctx->GetElapsedTicks(); } - uint64 stopwatch_GetElapsedMilliseconds(stopwatch * _stopwatch) + uint64 stopwatch_GetElapsedMilliseconds(stopwatch_t * stopwatch) { - Stopwatch * ctx = static_cast(_stopwatch->context); + Stopwatch * ctx = static_cast(stopwatch->context); return ctx->GetElapsedMilliseconds(); } - void stopwatch_Reset(stopwatch * _stopwatch) + void stopwatch_Reset(stopwatch_t * stopwatch) { - Stopwatch * ctx = static_cast(_stopwatch->context); + Stopwatch * ctx = static_cast(stopwatch->context); return ctx->Reset(); } - void stopwatch_Start(stopwatch * _stopwatch) + void stopwatch_Start(stopwatch_t * stopwatch) { - Stopwatch * ctx = static_cast(_stopwatch->context); + Stopwatch * ctx = static_cast(stopwatch->context); return ctx->Start(); } - void stopwatch_Restart(stopwatch * _stopwatch) + void stopwatch_Restart(stopwatch_t * stopwatch) { - Stopwatch * ctx = static_cast(_stopwatch->context); + Stopwatch * ctx = static_cast(stopwatch->context); return ctx->Restart(); } - void stopwatch_Stop(stopwatch * _stopwatch) + void stopwatch_Stop(stopwatch_t * stopwatch) { - Stopwatch * ctx = static_cast(_stopwatch->context); + Stopwatch * ctx = static_cast(stopwatch->context); return ctx->Stop(); } } diff --git a/src/openrct2/core/stopwatch.h b/src/openrct2/core/stopwatch.h index 56aa1a3c52..84d93ffc0d 100644 --- a/src/openrct2/core/stopwatch.h +++ b/src/openrct2/core/stopwatch.h @@ -23,18 +23,18 @@ // C wrapper for Stopwatch // ///////////////////////////// -typedef struct stopwatch { +typedef struct stopwatch_t { void *context; -} stopwatch; +} stopwatch_t; -void stopwatch_create(stopwatch *stopwatch); -void stopwatch_dispose(stopwatch *stopwatch); +void stopwatch_create(stopwatch_t *stopwatch); +void stopwatch_dispose(stopwatch_t *stopwatch); -uint64 stopwatch_GetElapsedTicks(stopwatch *stopwatch); -uint64 stopwatch_GetElapsedMilliseconds(stopwatch *stopwatch); -void stopwatch_Reset(stopwatch *stopwatch); -void stopwatch_Start(stopwatch *stopwatch); -void stopwatch_Restart(stopwatch *stopwatch); -void stopwatch_Stop(stopwatch *stopwatch); +uint64 stopwatch_GetElapsedTicks(stopwatch_t *stopwatch); +uint64 stopwatch_GetElapsedMilliseconds(stopwatch_t *stopwatch); +void stopwatch_Reset(stopwatch_t *stopwatch); +void stopwatch_Start(stopwatch_t *stopwatch); +void stopwatch_Restart(stopwatch_t *stopwatch); +void stopwatch_Stop(stopwatch_t *stopwatch); #endif diff --git a/src/openrct2/paint/map_element/map_element.h b/src/openrct2/paint/map_element/map_element.h index c9ab63c37d..d1420ca8eb 100644 --- a/src/openrct2/paint/map_element/map_element.h +++ b/src/openrct2/paint/map_element/map_element.h @@ -21,7 +21,7 @@ #include "../../common.h" #include "../../world/map.h" -typedef enum edge +typedef enum edge_t { EDGE_NE = (1 << 0), EDGE_SE = (1 << 1), @@ -31,7 +31,7 @@ typedef enum edge EDGE_BOTTOMRIGHT = EDGE_SE, EDGE_TOPLEFT = EDGE_NW, EDGE_TOPRIGHT = EDGE_NE -} edge; +} edge_t; enum { diff --git a/src/openrct2/paint/map_element/surface.c b/src/openrct2/paint/map_element/surface.c index 1e8ad438d8..b4fe674f85 100644 --- a/src/openrct2/paint/map_element/surface.c +++ b/src/openrct2/paint/map_element/surface.c @@ -327,7 +327,7 @@ static uint8 viewport_surface_paint_setup_get_relative_slope(rct_map_element * m /** * rct2: 0x0065E890, 0x0065E946, 0x0065E9FC, 0x0065EAB2 */ -static void viewport_surface_smoothen_edge(enum edge _edge, struct tile_descriptor self, struct tile_descriptor neighbour) +static void viewport_surface_smoothen_edge(enum edge_t edge, struct tile_descriptor self, struct tile_descriptor neighbour) { if (neighbour.map_element == NULL) { @@ -338,7 +338,7 @@ static void viewport_surface_smoothen_edge(enum edge _edge, struct tile_descript uint8 neighbourCorners[2] = { 0 }; uint8 ownCorners[2] = { 0 }; - switch (_edge) { + switch (edge) { case EDGE_BOTTOMLEFT: maskImageBase = SPR_TERRAIN_EDGE_MASK_BOTTOM_LEFT; neighbourCorners[0] = neighbour.corner_heights.top; @@ -375,7 +375,7 @@ static void viewport_surface_smoothen_edge(enum edge _edge, struct tile_descript } uint8 dh = 0, cl = 0; - switch(_edge) { + switch(edge) { case EDGE_BOTTOMLEFT: dh = byte_97B524[byte_97B444[self.slope]]; cl = byte_97B54A[byte_97B444[neighbour.slope]]; @@ -430,13 +430,13 @@ static void viewport_surface_smoothen_edge(enum edge _edge, struct tile_descript /** * rct2: 0x0065F63B, 0x0065F77D */ -static void viewport_surface_draw_land_side_top(enum edge _edge, uint8 height, uint8 terrain, struct tile_descriptor self, struct tile_descriptor neighbour) +static void viewport_surface_draw_land_side_top(enum edge_t edge, uint8 height, uint8 terrain, struct tile_descriptor self, struct tile_descriptor neighbour) { registers regs; rct_xy8 offset = {0, 0}; rct_xy8 bounds = {0, 0}; - switch (_edge) { + switch (edge) { case EDGE_TOPLEFT: regs.al = self.corner_heights.top; regs.cl = self.corner_heights.left; @@ -479,13 +479,13 @@ static void viewport_surface_draw_land_side_top(enum edge _edge, uint8 height, u if (!(gCurrentViewportFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)) { uint8 incline = (regs.cl - regs.al) + 1; - uint32 image_id = stru_97B5C0[terrain][3] + (_edge == EDGE_TOPLEFT ? 3 : 0) + incline; // var_c; + uint32 image_id = stru_97B5C0[terrain][3] + (edge == EDGE_TOPLEFT ? 3 : 0) + incline; // var_c; sint16 y = (regs.dl - regs.al) * 16; paint_attach_to_previous_ps(image_id, 0, y); return; } - uint32 base_image_id = stru_97B5C0[terrain][1] + (_edge == EDGE_TOPLEFT ? 5 : 0); // var_04 + uint32 base_image_id = stru_97B5C0[terrain][1] + (edge == EDGE_TOPLEFT ? 5 : 0); // var_04 const uint8 rotation = get_current_rotation(); uint8 cur_height = min(regs.ch, regs.ah); @@ -526,7 +526,7 @@ static void viewport_surface_draw_land_side_top(enum edge _edge, uint8 height, u /** * rct2: 0x0065EB7D, 0x0065F0D8 */ -static void viewport_surface_draw_land_side_bottom(enum edge _edge, uint8 height, uint8 edgeStyle, struct tile_descriptor self, struct tile_descriptor neighbour) +static void viewport_surface_draw_land_side_bottom(enum edge_t edge, uint8 height, uint8 edgeStyle, struct tile_descriptor self, struct tile_descriptor neighbour) { registers regs; @@ -536,7 +536,7 @@ static void viewport_surface_draw_land_side_bottom(enum edge _edge, uint8 height rct_xy16 tunnelTopBoundBoxOffset = {0, 0}; tunnel_entry * tunnelArray; - switch (_edge) { + switch (edge) { case EDGE_BOTTOMLEFT: regs.al = self.corner_heights.left; regs.cl = self.corner_heights.bottom; @@ -585,7 +585,7 @@ static void viewport_surface_draw_land_side_bottom(enum edge _edge, uint8 height base_image_id = stru_97B5C0[edgeStyle][1]; } - if (_edge == EDGE_BOTTOMRIGHT) { + if (edge == EDGE_BOTTOMRIGHT) { base_image_id += 5; } @@ -661,7 +661,7 @@ static void viewport_surface_draw_land_side_bottom(enum edge _edge, uint8 height } - uint32 image_id = stru_97B640[edgeStyle][tunnelType] + (_edge == EDGE_BOTTOMRIGHT ? 2 : 0); + uint32 image_id = stru_97B640[edgeStyle][tunnelType] + (edge == EDGE_BOTTOMRIGHT ? 2 : 0); sub_98197C(image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1, zOffset, 0, 0, boundBoxOffsetZ, rotation); @@ -673,7 +673,7 @@ static void viewport_surface_draw_land_side_bottom(enum edge _edge, uint8 height boundBoxLength -= 16; } - image_id = stru_97B640[edgeStyle][tunnelType] + (_edge == EDGE_BOTTOMRIGHT ? 2 : 0) + 1; + image_id = stru_97B640[edgeStyle][tunnelType] + (edge == EDGE_BOTTOMRIGHT ? 2 : 0) + 1; sub_98197C(image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1, curHeight * 16, tunnelTopBoundBoxOffset.x, tunnelTopBoundBoxOffset.y, boundBoxOffsetZ, rotation); curHeight += stru_97B570[tunnelType][0]; @@ -686,13 +686,13 @@ static void viewport_surface_draw_land_side_bottom(enum edge _edge, uint8 height /** * rct2: 0x0066039B, 0x006604F1 */ -static void viewport_surface_draw_water_side_top(enum edge _edge, uint8 height, uint8 terrain, struct tile_descriptor self, struct tile_descriptor neighbour) +static void viewport_surface_draw_water_side_top(enum edge_t edge, uint8 height, uint8 terrain, struct tile_descriptor self, struct tile_descriptor neighbour) { registers regs; rct_xy8 offset = {0, 0}; rct_xy8 bounds = {0, 0}; - switch (_edge) { + switch (edge) { case EDGE_TOPLEFT: regs.al = self.corner_heights.top; regs.cl = self.corner_heights.left; @@ -747,7 +747,7 @@ static void viewport_surface_draw_water_side_top(enum edge _edge, uint8 height, base_image_id = stru_97B5C0[terrain][1]; // var_04 } - base_image_id += (_edge == EDGE_TOPLEFT ? 5 : 0); + base_image_id += (edge == EDGE_TOPLEFT ? 5 : 0); const uint8 rotation = get_current_rotation(); uint8 cur_height = min(regs.ch, regs.ah); @@ -788,7 +788,7 @@ static void viewport_surface_draw_water_side_top(enum edge _edge, uint8 height, /** * rct2: 0x0065F8B9, 0x0065FE26 */ -static void viewport_surface_draw_water_side_bottom(enum edge _edge, uint8 height, uint8 edgeStyle, struct tile_descriptor self, struct tile_descriptor neighbour) +static void viewport_surface_draw_water_side_bottom(enum edge_t edge, uint8 height, uint8 edgeStyle, struct tile_descriptor self, struct tile_descriptor neighbour) { registers regs; @@ -798,7 +798,7 @@ static void viewport_surface_draw_water_side_bottom(enum edge _edge, uint8 heigh rct_xy16 tunnelTopBoundBoxOffset = {0, 0}; tunnel_entry * tunnelArray; - switch (_edge) { + switch (edge) { case EDGE_BOTTOMLEFT: regs.al = self.corner_heights.left; regs.cl = self.corner_heights.bottom; @@ -857,7 +857,7 @@ static void viewport_surface_draw_water_side_bottom(enum edge _edge, uint8 heigh base_image_id = stru_97B5C0[edgeStyle][1]; } - if (_edge == EDGE_BOTTOMRIGHT) { + if (edge == EDGE_BOTTOMRIGHT) { base_image_id += 5; } @@ -931,7 +931,7 @@ static void viewport_surface_draw_water_side_bottom(enum edge _edge, uint8 heigh } - uint32 image_id = stru_97B640[edgeStyle][tunnelType] + (_edge == EDGE_BOTTOMRIGHT ? 2 : 0); + uint32 image_id = stru_97B640[edgeStyle][tunnelType] + (edge == EDGE_BOTTOMRIGHT ? 2 : 0); sub_98197C(image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1, zOffset, 0, 0, boundBoxOffsetZ, rotation); @@ -943,7 +943,7 @@ static void viewport_surface_draw_water_side_bottom(enum edge _edge, uint8 heigh boundBoxLength -= 16; } - image_id = stru_97B640[edgeStyle][tunnelType] + (_edge == EDGE_BOTTOMRIGHT ? 2 : 0) + 1; + image_id = stru_97B640[edgeStyle][tunnelType] + (edge == EDGE_BOTTOMRIGHT ? 2 : 0) + 1; sub_98197C(image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1, curHeight * 16, tunnelTopBoundBoxOffset.x, tunnelTopBoundBoxOffset.y, boundBoxOffsetZ, rotation); curHeight += stru_97B570[tunnelType][0]; diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 9b13d6f062..2fbb5df646 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -1722,13 +1722,13 @@ static void set_sprite_type(rct_peep* peep, uint8 type){ } } -typedef struct item_pref { +typedef struct item_pref_t { uint8 type; // 0 for standard, 1 for extra uint32 item; // And this with the relevant flags uint8 sprite_type; -} item_pref; +} item_pref_t; -item_pref item_order_preference[] = { +item_pref_t item_order_preference[] = { { 0, PEEP_ITEM_ICE_CREAM, 15 }, { 0, PEEP_ITEM_FRIES, 16}, { 0, PEEP_ITEM_PIZZA, 22 }, @@ -1815,15 +1815,15 @@ void peep_update_sprite_type(rct_peep* peep) } } - for (item_pref* _item_pref = item_order_preference; _item_pref->type != 0xFF; _item_pref++) { - if (_item_pref->type == 0){ - if (peep->item_standard_flags & _item_pref->item) { - set_sprite_type(peep, _item_pref->sprite_type); + for (item_pref_t* item_pref = item_order_preference; item_pref->type != 0xFF; item_pref++) { + if (item_pref->type == 0){ + if (peep->item_standard_flags & item_pref->item) { + set_sprite_type(peep, item_pref->sprite_type); return; } } else { - if (peep->item_extra_flags & _item_pref->item) { - set_sprite_type(peep, _item_pref->sprite_type); + if (peep->item_extra_flags & item_pref->item) { + set_sprite_type(peep, item_pref->sprite_type); return; } } diff --git a/src/openrct2/platform/platform.h b/src/openrct2/platform/platform.h index 32652a44fb..ad5001abb0 100644 --- a/src/openrct2/platform/platform.h +++ b/src/openrct2/platform/platform.h @@ -65,7 +65,7 @@ typedef struct resolution { int width, height; -} resolution; +} resolution_t; typedef struct file_info { const char *path; @@ -129,7 +129,7 @@ extern int gTextInputCompositionLength; extern int gResolutionsAllowAnyAspectRatio; extern int gNumResolutions; -extern resolution *gResolutions; +extern resolution_t *gResolutions; extern SDL_Window *gWindow; extern SDL_Color gPalette[256]; diff --git a/src/openrct2/platform/shared.c b/src/openrct2/platform/shared.c index 71d0515b61..24ab2c8a87 100644 --- a/src/openrct2/platform/shared.c +++ b/src/openrct2/platform/shared.c @@ -49,7 +49,7 @@ int gTextInputCompositionStart; int gTextInputCompositionLength; int gNumResolutions = 0; -resolution *gResolutions = NULL; +resolution_t *gResolutions = NULL; int gResolutionsAllowAnyAspectRatio = 0; SDL_Window *gWindow = NULL; @@ -69,8 +69,8 @@ static void platform_create_window(); static int resolution_sort_func(const void *pa, const void *pb) { - const resolution *a = (resolution*)pa; - const resolution *b = (resolution*)pb; + const resolution_t *a = (resolution_t*)pa; + const resolution_t *b = (resolution_t*)pb; int areaA = a->width * a->height; int areaB = b->width * b->height; @@ -95,7 +95,7 @@ void platform_update_fullscreen_resolutions() // Get resolutions gNumResolutions = numDisplayModes; - gResolutions = malloc(gNumResolutions * sizeof(resolution)); + gResolutions = malloc(gNumResolutions * sizeof(resolution_t)); gNumResolutions = 0; float desktopAspectRatio = (float)mode.w / mode.h; @@ -111,12 +111,12 @@ void platform_update_fullscreen_resolutions() } // Sort by area - qsort(gResolutions, gNumResolutions, sizeof(resolution), resolution_sort_func); + qsort(gResolutions, gNumResolutions, sizeof(resolution_t), resolution_sort_func); // Remove duplicates - resolution *resPlace = &gResolutions[0]; + resolution_t *resPlace = &gResolutions[0]; for (int i = 1; i < gNumResolutions; i++) { - resolution *resLook = &gResolutions[i]; + resolution_t *resLook = &gResolutions[i]; if (resLook->width != resPlace->width || resLook->height != resPlace->height) *++resPlace = *resLook; } diff --git a/src/openrct2/ride/track_paint.c b/src/openrct2/ride/track_paint.c index e42f5c7d81..3e478f81b0 100644 --- a/src/openrct2/ride/track_paint.c +++ b/src/openrct2/ride/track_paint.c @@ -207,10 +207,10 @@ uint32 gTrackColours[4]; bool gUseOriginalRidePaint = false; -bool track_paint_util_has_fence(enum edge _edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation) +bool track_paint_util_has_fence(enum edge_t edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation) { rct_xy16 offset = { 0, 0 }; - switch (_edge) { + switch (edge) { case EDGE_NE: offset = loc_7667AC[rotation]; break; @@ -570,12 +570,12 @@ void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence } } -bool track_paint_util_draw_station_covers(enum edge _edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height) +bool track_paint_util_draw_station_covers(enum edge_t edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height) { - return track_paint_util_draw_station_covers_2(_edge, hasFence, entranceStyle, direction, height, STATION_VARIANT_BASIC); + return track_paint_util_draw_station_covers_2(edge, hasFence, entranceStyle, direction, height, STATION_VARIANT_BASIC); } -bool track_paint_util_draw_station_covers_2(enum edge _edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, uint8 stationVariant) +bool track_paint_util_draw_station_covers_2(enum edge_t edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, uint8 stationVariant) { if (!(g141E9DB & (G141E9DB_FLAG_1 | G141E9DB_FLAG_2))) { return false; @@ -593,7 +593,7 @@ bool track_paint_util_draw_station_covers_2(enum edge _edge, bool hasFence, cons rct_xyz16 offset, bounds = { 0, 0, 0 }, boundsOffset = { 0, 0, 0 }; offset = (rct_xyz16) {0, 0, height}; - switch (_edge) { + switch (edge) { case EDGE_NE: bounds = (rct_xyz16) {1, 30, heights[stationVariant][0]}; boundsOffset = (rct_xyz16) {0, 1, height + 1}; diff --git a/src/openrct2/ride/track_paint.h b/src/openrct2/ride/track_paint.h index 63754c87d0..b9607d77cb 100644 --- a/src/openrct2/ride/track_paint.h +++ b/src/openrct2/ride/track_paint.h @@ -267,11 +267,11 @@ extern const uint8 mapLeftEighthTurnToOrthogonal[5]; extern bool gUseOriginalRidePaint; -bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation); +bool track_paint_util_has_fence(enum edge_t edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation); void track_paint_util_paint_floor(uint8 edges, uint32 colourFlags, uint16 height, const uint32 floorSprites[4], uint8 rotation); void track_paint_util_paint_fences(uint8 edges, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint32 colourFlags, uint16 height, const uint32 fenceSprites[4], uint8 rotation); -bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height); -bool track_paint_util_draw_station_covers_2(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, uint8 stationVariant); +bool track_paint_util_draw_station_covers(enum edge_t edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height); +bool track_paint_util_draw_station_covers_2(enum edge_t edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, uint8 stationVariant); void track_paint_util_draw_station_platform(rct_ride *ride, uint8 direction, int height, int zOffset, rct_map_element * mapElement); void track_paint_util_draw_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element * mapElement); void track_paint_util_draw_station_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element * mapElement, int fenceOffsetA, int fenceOffsetB); diff --git a/src/openrct2/windows/editor_object_selection.c b/src/openrct2/windows/editor_object_selection.c index ee84a0d182..61d1e42bc7 100644 --- a/src/openrct2/windows/editor_object_selection.c +++ b/src/openrct2/windows/editor_object_selection.c @@ -317,7 +317,7 @@ typedef struct list_item { static rct_string_id get_ride_type_string_id(const ObjectRepositoryItem * item); -typedef int (*sortFunc)(const void *, const void *); +typedef int (*sortFunc_t)(const void *, const void *); static int _numListItems = 0; static list_item *_listItems = NULL; @@ -402,7 +402,7 @@ static void visible_list_refresh(rct_window *w) _numListItems = 0; log_error("Unable to reallocate list items"); } else { - sortFunc sortFunc = NULL; + sortFunc_t sortFunc = NULL; switch (_listSortType) { case RIDE_SORT_TYPE: sortFunc = visible_list_sort_ride_type; diff --git a/src/openrct2/windows/options.c b/src/openrct2/windows/options.c index f4849ca28a..926eb3ff14 100644 --- a/src/openrct2/windows/options.c +++ b/src/openrct2/windows/options.c @@ -868,7 +868,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget* int selectedResolution = -1; for (int i = 0; i < gNumResolutions; i++) { - resolution *resolution = &gResolutions[i]; + resolution_t *resolution = &gResolutions[i]; gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL; @@ -1190,7 +1190,7 @@ static void window_options_dropdown(rct_window *w, int widgetIndex, int dropdown switch (widgetIndex) { case WIDX_RESOLUTION_DROPDOWN: { - resolution *resolution = &gResolutions[dropdownIndex]; + resolution_t *resolution = &gResolutions[dropdownIndex]; if (resolution->width != gConfigGeneral.fullscreen_width || resolution->height != gConfigGeneral.fullscreen_height) { gConfigGeneral.fullscreen_width = resolution->width; gConfigGeneral.fullscreen_height = resolution->height; diff --git a/src/openrct2/world/map.c b/src/openrct2/world/map.c index 8a12c45fe9..87a9d2488e 100644 --- a/src/openrct2/world/map.c +++ b/src/openrct2/world/map.c @@ -2821,7 +2821,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, int x = (uint16)*eax; int y = (uint16)*ecx; uint8 base_height = *edx; - uint8 _edge = *edx >> 8; + uint8 edge = *edx >> 8; uint8 colour = *edi; uint8 type = *ebx >> 8; gCommandPosition.x = x + 16; @@ -2856,7 +2856,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, if (map_element->base_height != dl && map_element->base_height != ch) continue; - if (!(map_element->properties.path.edges & (1 << _edge))) + if (!(map_element->properties.path.edges & (1 << edge))) continue; pathFound = true; @@ -2884,7 +2884,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, if (map_element->base_height != dl) continue; - if ((map_element->properties.banner.position & 0x3) != _edge) + if ((map_element->properties.banner.position & 0x3) != edge) continue; gGameCommandErrorText = STR_BANNER_SIGN_IN_THE_WAY; @@ -2915,7 +2915,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, gBanners[banner_index].y = y / 32; new_map_element->type = MAP_ELEMENT_TYPE_BANNER; new_map_element->clearance_height = new_map_element->base_height + 2; - new_map_element->properties.banner.position = _edge; + new_map_element->properties.banner.position = edge; new_map_element->properties.banner.flags = 0xFF; new_map_element->properties.banner.unused = 0; new_map_element->properties.banner.index = banner_index; @@ -3239,14 +3239,14 @@ static bool map_is_location_at_edge(int x, int y) * * rct2: 0x006E5CBA */ -static bool map_place_fence_check_obstruction_with_track(rct_scenery_entry *wall, int x, int y, int z0, int z1, int _edge, rct_map_element *trackElement) +static bool map_place_fence_check_obstruction_with_track(rct_scenery_entry *wall, int x, int y, int z0, int z1, int edge, rct_map_element *trackElement) { const rct_preview_track *trackBlock; int z, direction; int trackType = trackElement->properties.track.type; int sequence = trackElement->properties.track.sequence & 0x0F; - direction = (_edge - trackElement->type) & 3; + direction = (edge - trackElement->type) & 3; rct_ride *ride = get_ride(trackElement->properties.track.ride_index); if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) { @@ -3289,7 +3289,7 @@ static bool map_place_fence_check_obstruction_with_track(rct_scenery_entry *wall if (TrackDefinitions[trackType].bank_start == 0) { if (!(TrackCoordinates[trackType].rotation_begin & 4)) { direction = (trackElement->type & 3) ^ 2; - if (direction == _edge) { + if (direction == edge) { trackBlock = &TrackBlocks[trackType][sequence]; z = TrackCoordinates[trackType].z_begin; z = trackElement->base_height + ((z - trackBlock->z) * 8); @@ -3316,7 +3316,7 @@ static bool map_place_fence_check_obstruction_with_track(rct_scenery_entry *wall } direction = (trackElement->type + direction) & 3; - if (direction != _edge) { + if (direction != edge) { return false; } @@ -3334,7 +3334,7 @@ static bool map_place_fence_check_obstruction_with_track(rct_scenery_entry *wall * * rct2: 0x006E5C1A */ -static bool map_place_fence_check_obstruction(rct_scenery_entry *wall, int x, int y, int z0, int z1, int _edge) +static bool map_place_fence_check_obstruction(rct_scenery_entry *wall, int x, int y, int z0, int z1, int edge) { int entryType, sequence; rct_scenery_entry *entry; @@ -3355,7 +3355,7 @@ static bool map_place_fence_check_obstruction(rct_scenery_entry *wall, int x, in if (z1 <= mapElement->base_height) continue; if (elementType == MAP_ELEMENT_TYPE_FENCE) { int direction = mapElement->type & 3; - if (_edge == direction) { + if (edge == direction) { map_obstruction_set_error_text(mapElement); return false; } @@ -3368,7 +3368,7 @@ static bool map_place_fence_check_obstruction(rct_scenery_entry *wall, int x, in map_obstruction_set_error_text(mapElement); return false; case MAP_ELEMENT_TYPE_PATH: - if (mapElement->properties.path.edges & (1 << _edge)) { + if (mapElement->properties.path.edges & (1 << edge)) { map_obstruction_set_error_text(mapElement); return false; } @@ -3379,7 +3379,7 @@ static bool map_place_fence_check_obstruction(rct_scenery_entry *wall, int x, in entry = get_large_scenery_entry(entryType); tile = &entry->large_scenery.tiles[sequence]; - int direction = ((_edge - mapElement->type) & 3) + 8; + int direction = ((edge - mapElement->type) & 3) + 8; if (!(tile->var_7 & (1 << direction))) { map_obstruction_set_error_text(mapElement); return false; @@ -3394,7 +3394,7 @@ static bool map_place_fence_check_obstruction(rct_scenery_entry *wall, int x, in } break; case MAP_ELEMENT_TYPE_TRACK: - if (!map_place_fence_check_obstruction_with_track(wall, x, y, z0, z1, _edge, mapElement)) { + if (!map_place_fence_check_obstruction_with_track(wall, x, y, z0, z1, edge, mapElement)) { return false; } break; @@ -3466,7 +3466,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, uint8 primary_colour = (*edx >> 8) & 0xFF; uint8 secondary_colour = *ebp & 0xFF; uint8 tertiary_colour = (*ebp >> 8) & 0xFF; - uint8 _edge = *edx & 0xFF; + uint8 edge = *edx & 0xFF; gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING; gCommandPosition.x = position.x + 16; @@ -3508,7 +3508,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, position.z = map_element->base_height * 8; uint8 slope = map_element->properties.surface.slope & MAP_ELEMENT_SLOPE_MASK; - bp = EdgeSlopes[slope][_edge & 3]; + bp = EdgeSlopes[slope][edge & 3]; if (bp & EDGE_SLOPE_ELEVATED) { position.z += 16; bp &= ~(1 << 0); @@ -3539,7 +3539,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, } if (!(bp & 0xC0)){ - uint8 new_edge = (_edge + 2) & 3; + uint8 new_edge = (edge + 2) & 3; uint8 new_base_height = map_element->base_height; new_base_height += 2; if (map_element->properties.surface.slope & (1 << new_edge)){ @@ -3567,7 +3567,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, } } - new_edge = (_edge + 3) & 3; + new_edge = (edge + 3) & 3; if (map_element->properties.surface.slope & (1 << new_edge)){ if (position.z / 8 < new_base_height){ gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; @@ -3635,7 +3635,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, clearanceHeight += fence->wall.height; if (!(flags & GAME_COMMAND_FLAG_7) && !gCheatsDisableClearanceChecks){ - if (!map_place_fence_check_obstruction(fence, position.x, position.y, position.z / 8, clearanceHeight, _edge)) { + if (!map_place_fence_check_obstruction(fence, position.x, position.y, position.z / 8, clearanceHeight, edge)) { *ebx = MONEY32_UNDEFINED; return; } @@ -3662,7 +3662,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, map_element->clearance_height = clearanceHeight; - map_element->type = bp | _edge | MAP_ELEMENT_TYPE_FENCE; + map_element->type = bp | edge | MAP_ELEMENT_TYPE_FENCE; map_element->properties.fence.item[1] = primary_colour; map_element->properties.fence.item[1] |= (secondary_colour & 7) << 5; @@ -3698,14 +3698,14 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, } money32 map_place_fence( - int type, int x, int y, int z, int _edge, int primaryColour, int secondaryColour, int tertiaryColour, int flags + int type, int x, int y, int z, int edge, int primaryColour, int secondaryColour, int tertiaryColour, int flags ) { int eax, ebx, ecx, edx, esi, edi, ebp; eax = x; ebx = flags | (type << 8); ecx = y; - edx = _edge | (primaryColour << 8); + edx = edge | (primaryColour << 8); edi = z; ebp = secondaryColour | (tertiaryColour << 8); game_command_place_fence(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);