diff --git a/src/openrct2/editor.c b/src/openrct2/editor.c index bec96f1bb8..c428c31871 100644 --- a/src/openrct2/editor.c +++ b/src/openrct2/editor.c @@ -488,7 +488,7 @@ bool editor_check_park() } for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++) { - if (gParkEntrance[i].x != MAP_LOCATION_NULL) + if (gParkEntrances[i].x != MAP_LOCATION_NULL) break; if (i == MAX_PARK_ENTRANCES - 1) { @@ -498,13 +498,13 @@ bool editor_check_park() } for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++) { - if (gParkEntrance[i].x == MAP_LOCATION_NULL) + if (gParkEntrances[i].x == MAP_LOCATION_NULL) continue; - sint32 x = gParkEntrance[i].x; - sint32 y = gParkEntrance[i].y; - sint32 z = gParkEntrance[i].z / 8; - sint32 direction = gParkEntrance[i].direction ^ 2; + sint32 x = gParkEntrances[i].x; + sint32 y = gParkEntrances[i].y; + sint32 z = gParkEntrances[i].z / 8; + sint32 direction = gParkEntrances[i].direction ^ 2; switch (footpath_is_connected_to_map_edge(x, y, z, direction, 0)) { case FOOTPATH_SEARCH_NOT_FOUND: diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 39518fc051..164c03733f 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -8056,13 +8056,13 @@ static sint32 peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rc uint8 entranceIndex = 0; for (entranceIndex = 0; entranceIndex < MAX_PARK_ENTRANCES; entranceIndex++) { - if (gParkEntrance[entranceIndex].x == (x & 0xFFE0) && - gParkEntrance[entranceIndex].y == (y & 0xFFE0)) + if (gParkEntrances[entranceIndex].x == (x & 0xFFE0) && + gParkEntrances[entranceIndex].y == (y & 0xFFE0)) break; } - sint16 z = gParkEntrance[entranceIndex].z / 8; - entranceDirection = gParkEntrance[entranceIndex].direction; + sint16 z = gParkEntrances[entranceIndex].z / 8; + entranceDirection = gParkEntrances[entranceIndex].direction; sint16 next_x = (x & 0xFFE0) + TileDirectionDelta[entranceDirection].x; sint16 next_y = (y & 0xFFE0) + TileDirectionDelta[entranceDirection].y; @@ -9783,11 +9783,11 @@ static sint32 guest_path_find_entering_park(rct_peep *peep, rct_map_element *map uint8 chosenEntrance = 0xFF; uint16 nearestDist = 0xFFFF; for (uint8 entranceNum = 0; entranceNum < MAX_PARK_ENTRANCES; ++entranceNum){ - if (gParkEntrance[entranceNum].x == MAP_LOCATION_NULL) + if (gParkEntrances[entranceNum].x == MAP_LOCATION_NULL) continue; - uint16 dist = abs(gParkEntrance[entranceNum].x - peep->next_x) + - abs(gParkEntrance[entranceNum].y - peep->next_y); + uint16 dist = abs(gParkEntrances[entranceNum].x - peep->next_x) + + abs(gParkEntrances[entranceNum].y - peep->next_y); if (dist >= nearestDist) continue; @@ -9799,9 +9799,9 @@ static sint32 guest_path_find_entering_park(rct_peep *peep, rct_map_element *map if (chosenEntrance == 0xFF) return guest_path_find_aimless(peep, edges); - sint16 x = gParkEntrance[chosenEntrance].x; - sint16 y = gParkEntrance[chosenEntrance].y; - sint16 z = gParkEntrance[chosenEntrance].z; + sint16 x = gParkEntrances[chosenEntrance].x; + sint16 y = gParkEntrances[chosenEntrance].y; + sint16 z = gParkEntrances[chosenEntrance].z; gPeepPathFindGoalPosition = (rct_xyz16){ x, y, z >> 3 }; gPeepPathFindIgnoreForeignQueues = true; @@ -9855,7 +9855,7 @@ static sint32 guest_path_find_park_entrance(rct_peep* peep, rct_map_element *map // Resolves already-corrupt guests (e.g. loaded from save) if (peep->peep_flags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN && - (peep->current_ride >= 4 || gParkEntrance[peep->current_ride].x == MAP_LOCATION_NULL) + (peep->current_ride >= 4 || gParkEntrances[peep->current_ride].x == MAP_LOCATION_NULL) ) { peep->peep_flags &= ~(PEEP_FLAGS_PARK_ENTRANCE_CHOSEN); } @@ -9864,11 +9864,11 @@ static sint32 guest_path_find_park_entrance(rct_peep* peep, rct_map_element *map uint8 chosenEntrance = 0xFF; uint16 nearestDist = 0xFFFF; for (entranceNum = 0; entranceNum < MAX_PARK_ENTRANCES; ++entranceNum){ - if (gParkEntrance[entranceNum].x == MAP_LOCATION_NULL) + if (gParkEntrances[entranceNum].x == MAP_LOCATION_NULL) continue; - uint16 dist = abs(gParkEntrance[entranceNum].x - peep->next_x) + - abs(gParkEntrance[entranceNum].y - peep->next_y); + uint16 dist = abs(gParkEntrances[entranceNum].x - peep->next_x) + + abs(gParkEntrances[entranceNum].y - peep->next_y); if (dist >= nearestDist) continue; @@ -9885,9 +9885,9 @@ static sint32 guest_path_find_park_entrance(rct_peep* peep, rct_map_element *map } entranceNum = peep->current_ride; - sint16 x = gParkEntrance[entranceNum].x; - sint16 y = gParkEntrance[entranceNum].y; - sint16 z = gParkEntrance[entranceNum].z; + sint16 x = gParkEntrances[entranceNum].x; + sint16 y = gParkEntrances[entranceNum].y; + sint16 z = gParkEntrances[entranceNum].z; gPeepPathFindGoalPosition = (rct_xyz16) { x, y, z >> 3 }; gPeepPathFindIgnoreForeignQueues = true; @@ -12678,24 +12678,24 @@ void peep_autoposition(rct_peep *newPeep) count = 0; uint8 i; for (i = 0; i < MAX_PARK_ENTRANCES; ++i) { - if (gParkEntrance[i].x != SPRITE_LOCATION_NULL) + if (gParkEntrances[i].x != SPRITE_LOCATION_NULL) ++count; } if (count > 0) { uint32 rand = scenario_rand_max(count); for (i = 0; i < MAX_PARK_ENTRANCES; ++i) { - if (gParkEntrance[i].x != SPRITE_LOCATION_NULL) { + if (gParkEntrances[i].x != SPRITE_LOCATION_NULL) { if (rand == 0) break; --rand; } } - uint8 dir = gParkEntrance[i].direction; - x = gParkEntrance[i].x; - y = gParkEntrance[i].y; - z = gParkEntrance[i].z; + uint8 dir = gParkEntrances[i].direction; + x = gParkEntrances[i].x; + y = gParkEntrances[i].y; + z = gParkEntrances[i].z; x += 16 + ((dir & 1) == 0 ? ((dir & 2) ? 32 : -32) : 0); y += 16 + ((dir & 1) == 1 ? ((dir & 2) ? -32 : 32) : 0); } else { diff --git a/src/openrct2/peep/staff.c b/src/openrct2/peep/staff.c index 0da48a202a..6725f712e4 100644 --- a/src/openrct2/peep/staff.c +++ b/src/openrct2/peep/staff.c @@ -119,24 +119,24 @@ static inline void staff_autoposition_new_staff_member(rct_peep *newPeep) count = 0; uint8 i; for (i = 0; i < MAX_PARK_ENTRANCES; ++i) { - if (gParkEntrance[i].x != SPRITE_LOCATION_NULL) + if (gParkEntrances[i].x != SPRITE_LOCATION_NULL) ++count; } if (count > 0) { uint32 rand = scenario_rand_max(count); for (i = 0; i < MAX_PARK_ENTRANCES; ++i) { - if (gParkEntrance[i].x != SPRITE_LOCATION_NULL) { + if (gParkEntrances[i].x != SPRITE_LOCATION_NULL) { if (rand == 0) break; --rand; } } - uint8 dir = gParkEntrance[i].direction; - x = gParkEntrance[i].x; - y = gParkEntrance[i].y; - z = gParkEntrance[i].z; + uint8 dir = gParkEntrances[i].direction; + x = gParkEntrances[i].x; + y = gParkEntrances[i].y; + z = gParkEntrances[i].z; x += 16 + ((dir & 1) == 0 ? ((dir & 2) ? 32 : -32) : 0); y += 16 + ((dir & 1) == 1 ? ((dir & 2) ? -32 : 32) : 0); } else { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 1df5aeffb4..a0bc2eeb73 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2333,9 +2333,9 @@ private: void FixEntrancePositions() { - for (uint8 i = 0; i < MAX_PARK_ENTRANCES; i++) + for (size_t i = 0; i < Util::CountOf(gParkEntrances); i++) { - gParkEntrance[i].x = MAP_LOCATION_NULL; + gParkEntrances[i].x = MAP_LOCATION_NULL; } uint8 entranceIndex = 0; @@ -2350,10 +2350,10 @@ private: if (element->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE) continue; if ((element->properties.entrance.index & 0x0F) != 0) continue; - gParkEntrance[entranceIndex].x = it.x * 32; - gParkEntrance[entranceIndex].y = it.y * 32; - gParkEntrance[entranceIndex].z = element->base_height * 8; - gParkEntrance[entranceIndex].direction = element->type & 3; + gParkEntrances[entranceIndex].x = it.x * 32; + gParkEntrances[entranceIndex].y = it.y * 32; + gParkEntrances[entranceIndex].z = element->base_height * 8; + gParkEntrances[entranceIndex].direction = element->type & 3; entranceIndex++; } } diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index da0983f1b3..468f60f8a6 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -310,10 +310,10 @@ void S6Exporter::Export() _s6.same_price_throughout_extended = gSamePriceThroughoutParkB; for (uint8 i = 0; i < RCT12_MAX_PARK_ENTRANCES; i++) { - _s6.park_entrance_x[i] = gParkEntrance[i].x; - _s6.park_entrance_y[i] = gParkEntrance[i].y; - _s6.park_entrance_z[i] = gParkEntrance[i].z; - _s6.park_entrance_direction[i] = gParkEntrance[i].direction; + _s6.park_entrance_x[i] = gParkEntrances[i].x; + _s6.park_entrance_y[i] = gParkEntrances[i].y; + _s6.park_entrance_z[i] = gParkEntrances[i].z; + _s6.park_entrance_direction[i] = gParkEntrances[i].direction; } safe_strcpy(_s6.scenario_filename, _scenarioFileName, sizeof(_s6.scenario_filename)); memcpy(_s6.saved_expansion_pack_names, gScenarioExpansionPacks, sizeof(_s6.saved_expansion_pack_names)); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 6cb4936144..ba88862635 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -320,10 +320,10 @@ public: // pad_0135934B gSamePriceThroughoutParkB = _s6.same_price_throughout_extended; for (uint8 i = 0; i < RCT12_MAX_PARK_ENTRANCES; i++) { - gParkEntrance[i].x = _s6.park_entrance_x[i]; - gParkEntrance[i].y = _s6.park_entrance_y[i]; - gParkEntrance[i].z = _s6.park_entrance_z[i]; - gParkEntrance[i].direction = _s6.park_entrance_direction[i]; + gParkEntrances[i].x = _s6.park_entrance_x[i]; + gParkEntrances[i].y = _s6.park_entrance_y[i]; + gParkEntrances[i].z = _s6.park_entrance_z[i]; + gParkEntrances[i].direction = _s6.park_entrance_direction[i]; } scenario_set_filename(_s6.scenario_filename); memcpy(gScenarioExpansionPacks, _s6.saved_expansion_pack_names, sizeof(_s6.saved_expansion_pack_names)); diff --git a/src/openrct2/scenario/scenario.c b/src/openrct2/scenario/scenario.c index 0a8e2aa829..b439ee333d 100644 --- a/src/openrct2/scenario/scenario.c +++ b/src/openrct2/scenario/scenario.c @@ -345,9 +345,9 @@ static void scenario_entrance_fee_too_high_check() money16 max_fee = totalRideValue + (totalRideValue / 2); if ((gParkFlags & PARK_FLAGS_PARK_OPEN) && park_get_entrance_fee() > max_fee) { - for (sint32 i = 0; i < MAX_PARK_ENTRANCES && gParkEntrance[i].x != SPRITE_LOCATION_NULL; i++) { - x = gParkEntrance[i].x + 16; - y = gParkEntrance[i].y + 16; + for (sint32 i = 0; i < MAX_PARK_ENTRANCES && gParkEntrances[i].x != SPRITE_LOCATION_NULL; i++) { + x = gParkEntrances[i].x + 16; + y = gParkEntrances[i].y + 16; } uint32 packed_xy = (y << 16) | x; diff --git a/src/openrct2/windows/park.c b/src/openrct2/windows/park.c index cdeff518c9..74f6f5f12f 100644 --- a/src/openrct2/windows/park.c +++ b/src/openrct2/windows/park.c @@ -1092,10 +1092,10 @@ static void window_park_init_viewport(rct_window *w) return; for (i = 0; i < MAX_PARK_ENTRANCES; i++) { - if (gParkEntrance[i].x != SPRITE_LOCATION_NULL) { - x = gParkEntrance[i].x + 16; - y = gParkEntrance[i].y + 16; - z = gParkEntrance[i].z + 32; + if (gParkEntrances[i].x != SPRITE_LOCATION_NULL) { + x = gParkEntrances[i].x + 16; + y = gParkEntrances[i].y + 16; + z = gParkEntrances[i].z + 32; r = get_current_rotation(); xy = 0x40000000 | (y << 16) | x; diff --git a/src/openrct2/world/map.c b/src/openrct2/world/map.c index 1e2dbd3010..2656b3dece 100644 --- a/src/openrct2/world/map.c +++ b/src/openrct2/world/map.c @@ -5227,7 +5227,7 @@ static money32 place_park_entrance(sint32 flags, sint16 x, sint16 y, sint16 z, u sint8 entranceNum = -1; for (uint8 i = 0; i < MAX_PARK_ENTRANCES; ++i) { - if (gParkEntrance[i].x == MAP_LOCATION_NULL) { + if (gParkEntrances[i].x == MAP_LOCATION_NULL) { entranceNum = i; break; } @@ -5239,10 +5239,10 @@ static money32 place_park_entrance(sint32 flags, sint16 x, sint16 y, sint16 z, u } if (flags & GAME_COMMAND_FLAG_APPLY) { - gParkEntrance[entranceNum].x = x; - gParkEntrance[entranceNum].y = y; - gParkEntrance[entranceNum].z = (z & 0xFF) << 4; - gParkEntrance[entranceNum].direction = direction; + gParkEntrances[entranceNum].x = x; + gParkEntrances[entranceNum].y = y; + gParkEntrances[entranceNum].z = (z & 0xFF) << 4; + gParkEntrances[entranceNum].direction = direction; } sint8 zLow = (z & 0xFF) * 2; diff --git a/src/openrct2/world/park.c b/src/openrct2/world/park.c index 75a3b2605c..567474f66f 100644 --- a/src/openrct2/world/park.c +++ b/src/openrct2/world/park.c @@ -70,7 +70,7 @@ sint32 _suggestedGuestMaximum; */ sint32 _guestGenerationProbability; -rct_xyzd16 gParkEntrance[MAX_PARK_ENTRANCES]; +rct_xyzd16 gParkEntrances[MAX_PARK_ENTRANCES]; bool gParkEntranceGhostExists; rct_xyz16 gParkEntranceGhostPosition; @@ -358,7 +358,7 @@ void reset_park_entrances() { gParkName = 0; for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++) { - gParkEntrance[i].x = MAP_LOCATION_NULL; + gParkEntrances[i].x = MAP_LOCATION_NULL; } for (sint32 i = 0; i < MAX_PEEP_SPAWNS; i++) { gPeepSpawns[i].x = PEEP_SPAWN_UNDEFINED; @@ -721,9 +721,9 @@ sint32 park_get_entrance_index(sint32 x, sint32 y, sint32 z) for (i = 0; i < MAX_PARK_ENTRANCES; i++) { if ( - x == gParkEntrance[i].x && - y == gParkEntrance[i].y && - z == gParkEntrance[i].z + x == gParkEntrances[i].x && + y == gParkEntrances[i].y && + z == gParkEntrances[i].z ) { return i; } @@ -849,8 +849,8 @@ void game_command_remove_park_entrance(sint32 *eax, sint32 *ebx, sint32 *ecx, si return; } - gParkEntrance[entranceIndex].x = MAP_LOCATION_NULL; - direction = (gParkEntrance[entranceIndex].direction - 1) & 3; + gParkEntrances[entranceIndex].x = MAP_LOCATION_NULL; + direction = (gParkEntrances[entranceIndex].direction - 1) & 3; z = (*edx & 0xFF) * 2; // Centre (sign) diff --git a/src/openrct2/world/park.h b/src/openrct2/world/park.h index 9acd39622a..4874ca8c34 100644 --- a/src/openrct2/world/park.h +++ b/src/openrct2/world/park.h @@ -67,7 +67,7 @@ extern uint8 gGuestsInParkHistory[32]; extern sint32 _guestGenerationProbability; extern sint32 _suggestedGuestMaximum; -extern rct_xyzd16 gParkEntrance[MAX_PARK_ENTRANCES]; +extern rct_xyzd16 gParkEntrances[MAX_PARK_ENTRANCES]; extern bool gParkEntranceGhostExists; extern rct_xyz16 gParkEntranceGhostPosition;