From 476f1fad2b321a36a19d32bafcdae8553c82dda4 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Tue, 24 Jan 2017 19:06:47 +0100 Subject: [PATCH] Use constants for null sprite location and maximum vehicles --- src/openrct2/rct1.h | 1 + src/openrct2/rct1/S4Importer.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openrct2/rct1.h b/src/openrct2/rct1.h index 9d924377f2..b3852e0526 100644 --- a/src/openrct2/rct1.h +++ b/src/openrct2/rct1.h @@ -1166,6 +1166,7 @@ enum { }; #define RCT1_MAX_STATIONS 4 +#define RCT1_MAX_TRAINS_PER_RIDE 12 extern const uint8 gRideCategories[0x60]; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index c0b249b432..280bb1160d 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -776,7 +776,7 @@ private: } else { - for (int i = 0; i < 12; i++) + for (int i = 0; i < RCT1_MAX_TRAINS_PER_RIDE; i++) { // RCT1 had no third colour RCT1::RCT1VehicleColourSchemeCopyDescriptor colourSchemeCopyDescriptor = RCT1::GetColourSchemeCopyDescriptor(src->vehicle_type); @@ -892,7 +892,7 @@ private: if (_s4.sprites[i].unknown.sprite_identifier == SPRITE_IDENTIFIER_VEHICLE) { rct1_vehicle * srcVehicle = &_s4.sprites[i].vehicle; - if (srcVehicle->x != (sint16)0x8000) + if (srcVehicle->x != SPRITE_LOCATION_NULL) { rct_vehicle * vehicle = (rct_vehicle *)create_sprite(SPRITE_IDENTIFIER_VEHICLE); spriteIndexMap[i] = vehicle->sprite_index;