1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Define max vehicles per ride entry, use SPRITE_INDEX_NULL more

This commit is contained in:
Gymnasiast
2017-06-20 09:57:41 +02:00
committed by Michael Steenbeek
parent d6488f34a8
commit 0db5bc6bd2
3 changed files with 6 additions and 3 deletions

View File

@@ -51,7 +51,7 @@ static void paint_crooked_house_structure(uint8 direction, uint8 x_offset, uint8
rct_ride_entry *ride_type = get_ride_entry(ride->subtype);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK) {
if (ride->vehicles[0] != (uint16)-1) {
if (ride->vehicles[0] != SPRITE_INDEX_NULL) {
rct_sprite *sprite = get_sprite(ride->vehicles[0]);
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
g_currently_drawn_item = sprite;

View File

@@ -23,6 +23,9 @@
#include "vehicle.h"
#define MAX_RIDE_TYPES_PER_RIDE_ENTRY 3
// The max number of different types of vehicle.
// Examples of vehicles here are the locomotive, tender and carriage of the Miniature Railway.
#define MAX_VEHICLES_PER_RIDE_ENTRY 4
#define RIDE_ENTRY_INDEX_NULL 255
typedef fixed16_2dp ride_rating;
@@ -118,7 +121,7 @@ typedef struct rct_ride_entry {
uint8 rear_vehicle; // 0x017
uint8 third_vehicle; // 0x018
uint8 pad_019; // 0x019
rct_ride_entry_vehicle vehicles[4]; // 0x01A
rct_ride_entry_vehicle vehicles[MAX_VEHICLES_PER_RIDE_ENTRY]; // 0x01A
vehicle_colour_preset_list *vehicle_preset_list; // 0x1AE
sint8 excitement_multipler; // 0x1B2
sint8 intensity_multipler; // 0x1B3

View File

@@ -761,7 +761,7 @@ sint32 sub_6BC2F3(rct_vehicle* vehicle)
rct_vehicle* vehicle_temp = vehicle;
do {
result += vehicle_temp->friction;
} while (vehicle_temp->next_vehicle_on_train != (uint16)-1 && (vehicle_temp = GET_VEHICLE(vehicle_temp->next_vehicle_on_train)) != NULL);
} while (vehicle_temp->next_vehicle_on_train != SPRITE_INDEX_NULL && (vehicle_temp = GET_VEHICLE(vehicle_temp->next_vehicle_on_train)) != NULL);
sint32 v4 = vehicle->velocity;
if (v4 < 0) {
v4 = -v4;