mirror of https://github.com/OpenRCT2/OpenRCT2.git
Validate access to peep_loading_positions (#4475)
This commit is contained in:
parent
dccc9f88c2
commit
ff9417f4a6
|
@ -126,6 +126,7 @@ void RideObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
||||||
numPeepLoadingPositions = stream->ReadValue<uint16>();
|
numPeepLoadingPositions = stream->ReadValue<uint16>();
|
||||||
}
|
}
|
||||||
_peepLoadingPositions[i] = stream->ReadArray<sint8>(numPeepLoadingPositions);
|
_peepLoadingPositions[i] = stream->ReadArray<sint8>(numPeepLoadingPositions);
|
||||||
|
_peepLoadingPositionsCount[i] = numPeepLoadingPositions;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetImageTable()->Read(context, stream);
|
GetImageTable()->Read(context, stream);
|
||||||
|
@ -354,6 +355,9 @@ void RideObject::Load()
|
||||||
set_vehicle_type_image_max_sizes(vehicleEntry, num_images);
|
set_vehicle_type_image_max_sizes(vehicleEntry, num_images);
|
||||||
}
|
}
|
||||||
vehicleEntry->peep_loading_positions = _peepLoadingPositions[i];
|
vehicleEntry->peep_loading_positions = _peepLoadingPositions[i];
|
||||||
|
#ifdef NO_RCT2
|
||||||
|
vehicleEntry->peep_loading_positions_count = _peepLoadingPositionsCount[i];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ private:
|
||||||
rct_ride_entry _legacyType = { 0 };
|
rct_ride_entry _legacyType = { 0 };
|
||||||
vehicle_colour_preset_list _presetColours = { 0 };
|
vehicle_colour_preset_list _presetColours = { 0 };
|
||||||
sint8 * _peepLoadingPositions[4] = { nullptr };
|
sint8 * _peepLoadingPositions[4] = { nullptr };
|
||||||
|
uint16 _peepLoadingPositionsCount[4] = { 0 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RideObject(const rct_object_entry &entry) : Object(entry) { }
|
explicit RideObject(const rct_object_entry &entry) : Object(entry) { }
|
||||||
|
|
|
@ -2778,6 +2778,9 @@ static void peep_update_ride_sub_state_1(rct_peep* peep){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NO_RCT2
|
||||||
|
assert(peep->current_seat < vehicle_type->peep_loading_positions_count);
|
||||||
|
#endif
|
||||||
sint8 load_position = vehicle_type->peep_loading_positions[peep->current_seat];
|
sint8 load_position = vehicle_type->peep_loading_positions[peep->current_seat];
|
||||||
|
|
||||||
switch (vehicle->sprite_direction / 8){
|
switch (vehicle->sprite_direction / 8){
|
||||||
|
|
|
@ -123,7 +123,7 @@ typedef struct rct_ride_entry {
|
||||||
uint8 shop_item; // 0x1C0
|
uint8 shop_item; // 0x1C0
|
||||||
uint8 shop_item_secondary; // 0x1C1
|
uint8 shop_item_secondary; // 0x1C1
|
||||||
} rct_ride_entry;
|
} rct_ride_entry;
|
||||||
#ifdef PLATFORM_32BIT
|
#if defined(PLATFORM_32BIT) && !defined(NO_RCT2)
|
||||||
assert_struct_size(rct_ride_entry, 0x1c2);
|
assert_struct_size(rct_ride_entry, 0x1c2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,11 @@ typedef struct rct_ride_entry_vehicle {
|
||||||
uint8 draw_order;
|
uint8 draw_order;
|
||||||
uint8 special_frames; // 0x60 , 0x7A
|
uint8 special_frames; // 0x60 , 0x7A
|
||||||
sint8* peep_loading_positions; // 0x61 , 0x7B
|
sint8* peep_loading_positions; // 0x61 , 0x7B
|
||||||
|
#ifdef NO_RCT2
|
||||||
|
uint16 peep_loading_positions_count;
|
||||||
|
#endif
|
||||||
} rct_ride_entry_vehicle;
|
} rct_ride_entry_vehicle;
|
||||||
#ifdef PLATFORM_32BIT
|
#if defined(PLATFORM_32BIT) && !defined(NO_RCT2)
|
||||||
assert_struct_size(rct_ride_entry_vehicle, 0x65);
|
assert_struct_size(rct_ride_entry_vehicle, 0x65);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue