Add -Wshadow to CMakeLists and fix offenders

This commit is contained in:
Michał Janiszewski committed 2017-01-13 10:02:17 +01:00
1 parent 2a435bfdae
commit cf670deb10
12 files changed
+100 -102

No files matched your search

+1 -1
View File
@@ -262,7 +262,7 @@ else ()
endif ()
# set necessary flags to compile code as is
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M} -std=gnu99 ${COMMON_COMPILE_OPTIONS} -Wimplicit")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M} -std=gnu99 ${COMMON_COMPILE_OPTIONS} -Wimplicit -Wshadow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M} -std=gnu++11 ${COMMON_COMPILE_OPTIONS} -Wnon-virtual-dtor")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TARGET_M}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS} ${PIE_FLAG}")
-2
View File
@@ -25,8 +25,6 @@
extern "C"
{
int gSpriteMode = 0;
int cmdline_for_sprite(const char **argv, int argc);
}
static const char * _mode;
+7 -7
View File
@@ -48,8 +48,8 @@ extern "C"
enum class DIRECTORY_CHILD_TYPE
{
DIRECTORY,
FILE,
DC_DIRECTORY,
DC_FILE,
};
struct DirectoryChild
@@ -149,7 +149,7 @@ public:
else
{
const DirectoryChild * child = &state->Listing[state->Index];
if (child->Type == DIRECTORY_CHILD_TYPE::DIRECTORY)
if (child->Type == DIRECTORY_CHILD_TYPE::DC_DIRECTORY)
{
utf8 childPath[MAX_PATH];
String::Set(childPath, sizeof(childPath), state->Path.c_str());
@@ -274,11 +274,11 @@ private:
if (child->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
result.Type = DIRECTORY_CHILD_TYPE::DIRECTORY;
result.Type = DIRECTORY_CHILD_TYPE::DC_DIRECTORY;
}
else
{
result.Type = DIRECTORY_CHILD_TYPE::FILE;
result.Type = DIRECTORY_CHILD_TYPE::DC_FILE;
result.Size = ((uint64)child->nFileSizeHigh << 32ULL) | (uint64)child->nFileSizeLow;
result.LastModified = ((uint64)child->ftLastWriteTime.dwHighDateTime << 32ULL) | (uint64)child->ftLastWriteTime.dwLowDateTime;
}
@@ -332,11 +332,11 @@ private:
result.Name = std::string(node->d_name);
if (node->d_type & DT_DIR)
{
result.Type = DIRECTORY_CHILD_TYPE::DIRECTORY;
result.Type = DIRECTORY_CHILD_TYPE::DC_DIRECTORY;
}
else
{
result.Type = DIRECTORY_CHILD_TYPE::FILE;
result.Type = DIRECTORY_CHILD_TYPE::DC_FILE;
// Get the full path of the file
size_t pathSize = String::SizeOf(directory) + 1 + String::SizeOf(node->d_name) + 1;
+16 -16
View File
@@ -102,49 +102,49 @@ extern "C"
{
#include "stopwatch.h"
void stopwatch_create(stopwatch * stopwatch)
void stopwatch_create(stopwatch * _stopwatch)
{
stopwatch->context = new Stopwatch();
_stopwatch->context = new Stopwatch();
}
void stopwatch_dispose(stopwatch * stopwatch)
void stopwatch_dispose(stopwatch * _stopwatch)
{
delete static_cast<Stopwatch *>(stopwatch->context);
delete static_cast<Stopwatch *>(_stopwatch->context);
}
uint64 stopwatch_GetElapsedTicks(stopwatch * stopwatch)
uint64 stopwatch_GetElapsedTicks(stopwatch * _stopwatch)
{
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
Stopwatch * ctx = static_cast<Stopwatch *>(_stopwatch->context);
return ctx->GetElapsedTicks();
}
uint64 stopwatch_GetElapsedMilliseconds(stopwatch * stopwatch)
uint64 stopwatch_GetElapsedMilliseconds(stopwatch * _stopwatch)
{
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
Stopwatch * ctx = static_cast<Stopwatch *>(_stopwatch->context);
return ctx->GetElapsedMilliseconds();
}
void stopwatch_Reset(stopwatch * stopwatch)
void stopwatch_Reset(stopwatch * _stopwatch)
{
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
Stopwatch * ctx = static_cast<Stopwatch *>(_stopwatch->context);
return ctx->Reset();
}
void stopwatch_Start(stopwatch * stopwatch)
void stopwatch_Start(stopwatch * _stopwatch)
{
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
Stopwatch * ctx = static_cast<Stopwatch *>(_stopwatch->context);
return ctx->Start();
}
void stopwatch_Restart(stopwatch * stopwatch)
void stopwatch_Restart(stopwatch * _stopwatch)
{
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
Stopwatch * ctx = static_cast<Stopwatch *>(_stopwatch->context);
return ctx->Restart();
}
void stopwatch_Stop(stopwatch * stopwatch)
void stopwatch_Stop(stopwatch * _stopwatch)
{
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
Stopwatch * ctx = static_cast<Stopwatch *>(_stopwatch->context);
return ctx->Stop();
}
}
+2 -2
View File
@@ -29,9 +29,9 @@ int NetworkActions::FindCommand(int command)
{
auto it = std::find_if(Actions.begin(), Actions.end(), [&command](NetworkAction const &action)
{
for (auto it = action.Commands.begin(); it != action.Commands.end(); it++)
for (auto it2 = action.Commands.begin(); it2 != action.Commands.end(); it2++)
{
if ((*it) == command)
if ((*it2) == command)
{
return true;
}
+5 -5
View File
@@ -333,18 +333,18 @@ public:
req->Port = port;
SDL_CreateThread([](void * pointer) -> int
{
auto req = static_cast<ConnectRequest *>(pointer);
auto req2 = static_cast<ConnectRequest *>(pointer);
try
{
req->Socket->Connect(req->Address.c_str(), req->Port);
req2->Socket->Connect(req2->Address.c_str(), req2->Port);
}
catch (const Exception & ex)
{
req->Socket->_error = std::string(ex.GetMessage());
req2->Socket->_error = std::string(ex.GetMessage());
}
SDL_UnlockMutex(req->Socket->_connectMutex);
delete req;
SDL_UnlockMutex(req2->Socket->_connectMutex);
delete req2;
return 0;
}, 0, req);
}
+8 -8
View File
@@ -218,20 +218,20 @@ void http_request_async(const http_request_t *request, void (*callback)(http_res
args->callback = callback;
SDL_Thread *thread = SDL_CreateThread([](void *ptr) -> int {
TempThreadArgs *args = (TempThreadArgs*)ptr;
TempThreadArgs *args2 = (TempThreadArgs*)ptr;
http_response_t *response = http_request(&args->request);
args->callback(response);
http_response_t *response = http_request(&args2->request);
args2->callback(response);
free((char*)args->request.url);
free((char*)args2->request.url);
if (args->request.type == HTTP_DATA_JSON) {
json_decref((json_t*) args->request.root);
if (args2->request.type == HTTP_DATA_JSON) {
json_decref((json_t*) args2->request.root);
} else {
free(args->request.body);
free(args2->request.body);
}
free(args);
free(args2);
return 0;
}, NULL, args);
+20 -20
View File
@@ -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 _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_descripto
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_descripto
}
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_descripto
/**
* 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 _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, ui
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, ui
/**
* 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 _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 _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, u
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, u
/**
* 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 _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 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;
@@ -857,7 +857,7 @@ static void viewport_surface_draw_water_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;
}
@@ -931,7 +931,7 @@ static void viewport_surface_draw_water_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);
@@ -943,7 +943,7 @@ static void viewport_surface_draw_water_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];
+6 -6
View File
@@ -1816,15 +1816,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* _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;
}
}
+8 -8
View File
@@ -1250,12 +1250,12 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
}
}
int support_height = baseZ - mapElement->base_height;
if (support_height < 0) {
support_height = 10;
int _support_height = baseZ - mapElement->base_height;
if (_support_height < 0) {
_support_height = 10;
}
cost += ((support_height / 2) * RideTrackCosts[ride->type].support_price) * 5;
cost += ((_support_height / 2) * RideTrackCosts[ride->type].support_price) * 5;
//6c56d3
@@ -1604,12 +1604,12 @@ static money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 o
return MONEY32_UNDEFINED;
}
sint8 support_height = mapElement->base_height - surfaceElement->base_height;
if (support_height < 0){
support_height = 10;
sint8 _support_height = mapElement->base_height - surfaceElement->base_height;
if (_support_height < 0){
_support_height = 10;
}
cost += (support_height / 2) * RideTrackCosts[ride->type].support_price;
cost += (_support_height / 2) * RideTrackCosts[ride->type].support_price;
if (!(flags & GAME_COMMAND_FLAG_APPLY))
continue;
+6 -6
View File
@@ -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 _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 _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 _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, const
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};
+21 -21
View File
@@ -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);