diff --git a/src/openrct2/peep/staff.c b/src/openrct2/peep/staff.c index 7e37dadac5..414b08d446 100644 --- a/src/openrct2/peep/staff.c +++ b/src/openrct2/peep/staff.c @@ -62,10 +62,10 @@ colour_t gStaffSecurityColour; */ void staff_reset_modes() { - for (sint32 i = 0; i < 200; i++) + for (sint32 i = 0; i < STAFF_MAX_COUNT; i++) gStaffModes[i] = STAFF_MODE_NONE; - for (sint32 i = 200; i < 204; i++) + for (sint32 i = STAFF_MAX_COUNT; i < (STAFF_MAX_COUNT + STAFF_TYPE_COUNT); i++) gStaffModes[i] = STAFF_MODE_WALK; staff_update_greyed_patrol_areas(); diff --git a/src/openrct2/peep/staff.h b/src/openrct2/peep/staff.h index e39aec1174..6bee4a3d2c 100644 --- a/src/openrct2/peep/staff.h +++ b/src/openrct2/peep/staff.h @@ -21,7 +21,6 @@ #include "peep.h" #define STAFF_MAX_COUNT 200 -#define STAFF_TYPE_COUNT 4 // The number of elements in the gStaffPatrolAreas array per staff member. Every bit in the array represents a 4x4 square. // Right now, it's a 32-bit array like in RCT2. 32 * 128 = 4096 bits, which is also the number of 4x4 squares on a 256x256 map. #define STAFF_PATROL_AREA_SIZE 128 @@ -36,7 +35,9 @@ enum STAFF_TYPE { STAFF_TYPE_HANDYMAN, STAFF_TYPE_MECHANIC, STAFF_TYPE_SECURITY, - STAFF_TYPE_ENTERTAINER + STAFF_TYPE_ENTERTAINER, + + STAFF_TYPE_COUNT }; enum STAFF_ORDERS{ diff --git a/src/openrct2/rct2.h b/src/openrct2/rct2.h index 72739bb354..50e60e63dd 100644 --- a/src/openrct2/rct2.h +++ b/src/openrct2/rct2.h @@ -32,6 +32,8 @@ #define RCT2_MAX_VEHICLES_PER_RIDE_ENTRY 4 #define RCT2_DOWNTIME_HISTORY_SIZE 8 #define RCT2_CUSTOMER_HISTORY_SIZE 10 +#define RCT2_MAX_SPRITES 10000 + typedef struct rct2_install_info { uint32 installLevel; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index f968e44718..7a83c16949 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -193,7 +193,7 @@ void S6Exporter::Export() // compression ratios. Especially useful for multiplayer servers that // use zlib on the sent stream. sprite_clear_all_unused(); - for (sint32 i = 0; i < MAX_SPRITES; i++) + for (sint32 i = 0; i < RCT2_MAX_SPRITES; i++) { memcpy(&_s6.sprites[i], get_sprite(i), sizeof(rct_sprite)); } diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 056c9859af..3289b421a5 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -200,7 +200,7 @@ public: memcpy(gMapElements, _s6.map_elements, sizeof(_s6.map_elements)); gNextFreeMapElementPointerIndex = _s6.next_free_map_element_pointer_index; - for (sint32 i = 0; i < MAX_SPRITES; i++) + for (sint32 i = 0; i < RCT2_MAX_SPRITES; i++) { memcpy(get_sprite(i), &_s6.sprites[i], sizeof(rct_sprite)); } diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index e383c80e0e..5cb2f3bcdf 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -7538,8 +7538,8 @@ static void ride_update_vehicle_colours(sint32 rideIndex) coloursExtended = ride->vehicle_colours_extended[i]; break; case RIDE_COLOUR_SCHEME_DIFFERENT_PER_CAR: - colours = ride->vehicle_colours[min(carIndex, RCT2_MAX_CARS_PER_TRAIN - 1)]; - coloursExtended = ride->vehicle_colours_extended[min(carIndex, RCT2_MAX_CARS_PER_TRAIN - 1)]; + colours = ride->vehicle_colours[min(carIndex, MAX_CARS_PER_TRAIN - 1)]; + coloursExtended = ride->vehicle_colours_extended[min(carIndex, MAX_CARS_PER_TRAIN - 1)]; break; } diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index 689eae3aa6..cada5ac6de 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -35,11 +35,12 @@ #define MAX_CATEGORIES_PER_RIDE 2 #define DOWNTIME_HISTORY_SIZE 8 #define CUSTOMER_HISTORY_SIZE 10 -#define MAX_RIDES_IN_PARK 255 -#define MAX_STAFF 200 -#define MAX_BANNERS_IN_PARK 250 #define MAX_CARS_PER_TRAIN 32 #define MAX_STATIONS 4 +#define RIDE_MEASUREMENT_MAX_ITEMS 4800 +#define MAX_RIDES 255 +#define RIDE_ID_NULL 255 + #pragma pack(push, 1) @@ -352,8 +353,6 @@ typedef struct Ride { } Ride; assert_struct_size(Ride, 0x260); -#define RIDE_MEASUREMENT_MAX_ITEMS 4800 - /** * Ride measurement structure. * size: 0x04B0C @@ -678,7 +677,9 @@ enum { BREAKDOWN_DOORS_STUCK_OPEN, BREAKDOWN_VEHICLE_MALFUNCTION, BREAKDOWN_BRAKES_FAILURE, - BREAKDOWN_CONTROL_FAILURE + BREAKDOWN_CONTROL_FAILURE, + + BREAKDOWN_COUNT }; enum { @@ -925,9 +926,6 @@ typedef struct rct_ride_properties { extern const rct_ride_properties RideProperties[RIDE_TYPE_COUNT]; -#define MAX_RIDES 255 -#define RIDE_ID_NULL 255 - #define RIDE_MODE_COUNT 37 #define MAX_RIDE_MEASUREMENTS 8 @@ -962,10 +960,10 @@ extern money16 gTotalRideValue; extern uint32 gSamePriceThroughoutParkA; extern uint32 gSamePriceThroughoutParkB; -extern const uint8 gRideClassifications[255]; +extern const uint8 gRideClassifications[MAX_RIDES]; #ifdef NO_RCT2 -extern Ride gRideList[255]; +extern Ride gRideList[MAX_RIDES]; #else extern Ride *gRideList; #endif diff --git a/src/openrct2/windows/Ride.cpp b/src/openrct2/windows/Ride.cpp index 7031640436..40affdbf8a 100644 --- a/src/openrct2/windows/Ride.cpp +++ b/src/openrct2/windows/Ride.cpp @@ -3878,12 +3878,12 @@ static void window_ride_maintenance_dropdown(rct_window *w, rct_widgetindex widg else { sint32 j; for (j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) { - if (ride_type->ride_type[j] != 0xFF) + if (ride_type->ride_type[j] != RIDE_TYPE_NULL) break; } sint32 i; sint32 num_items = 1; - for (i = 0; i < 8; i++) { + for (i = 0; i < BREAKDOWN_COUNT; i++) { assert(j < (sint32)Util::CountOf(ride_type->ride_type)); if (RideAvailableBreakdowns[ride_type->ride_type[j]] & (uint8)(1 << i)) { if (i == BREAKDOWN_BRAKES_FAILURE && (ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED)) { @@ -4043,11 +4043,11 @@ static void window_ride_maintenance_paint(rct_window *w, rct_drawpixelinfo *dpi) stringId = STR_MEHCANIC_IS_FIXING_THE_RIDE; break; default: - stringId = 0; + stringId = STR_EMPTY; break; } - if (stringId != 0) { + if (stringId != STR_EMPTY) { if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE) { gfx_draw_string_left_wrapped(dpi, nullptr, x + 4, y, 280, stringId, COLOUR_BLACK); } else {