Create define for max ride types per ride entry, closes #5524

This commit is contained in:
Michael Steenbeek authored and GitHub committed 2017-06-01 22:00:11 +02:00
1 parent 6dd3650426
commit 7d9acca1e0
9 files changed
+61 -48

No files matched your search

+1 -1
View File
@@ -1126,7 +1126,7 @@ static sint32 cc_load_object(const utf8 **argv, sint32 argc) {
rideEntry = get_ride_entry(groupIndex);
for (sint32 j = 0; j < 3; j++) {
for (sint32 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
rideType = rideEntry->ride_type[j];
if (rideType != 255)
research_insert(true, 0x10000 | (rideType << 8) | groupIndex, rideEntry->category[0]);
+8 -8
View File
@@ -199,11 +199,11 @@ void research_finish_item(sint32 entryIndex)
if ((rideEntry2->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE))
continue;
if (rideEntry2->ride_type[0] == base_ride_type ||
rideEntry2->ride_type[1] == base_ride_type ||
rideEntry2->ride_type[2] == base_ride_type
) {
ride_entry_set_invented(i);
for (uint8 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
if (rideEntry2->ride_type[j] == base_ride_type) {
ride_entry_set_invented(i);
break;
}
}
}
}
@@ -493,7 +493,7 @@ void research_populate_list_random()
continue;
sint32 researched = (scenario_rand() & 0xFF) > 128;
for (sint32 j = 0; j < 3; j++) {
for (sint32 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
sint32 rideType = rideEntry->ride_type[j];
if (rideType != 255)
research_insert(researched, 0x10000 | (rideType << 8) | i, rideEntry->category[0]);
@@ -519,7 +519,7 @@ void research_populate_list_researched()
if (rideEntry == (rct_ride_entry*)-1)
continue;
for (sint32 j = 0; j < 3; j++) {
for (sint32 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
sint32 rideType = rideEntry->ride_type[j];
if (rideType != 255)
research_insert(true, 0x10000 | (rideType << 8) | i, rideEntry->category[0]);
@@ -581,7 +581,7 @@ void research_insert_ride_entry(uint8 entryIndex, bool researched)
{
rct_ride_entry *rideEntry = get_ride_entry(entryIndex);
uint8 category = rideEntry->category[0];
for (sint32 i = 0; i < 3; i++) {
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++) {
uint8 rideType = rideEntry->ride_type[i];
if (rideType != 255) {
research_insert(researched, 0x10000 | (rideType << 8) | entryIndex, category);
+2 -2
View File
@@ -42,7 +42,7 @@ void RideObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
{
stream->Seek(8, STREAM_SEEK_CURRENT);
_legacyType.flags = stream->ReadValue<uint32>();
for (sint32 i = 0; i < 3; i++)
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
{
_legacyType.ride_type[i] = stream->ReadValue<uint8>();
}
@@ -395,7 +395,7 @@ const utf8 * RideObject::GetCapacity() const
void RideObject::SetRepositoryItem(ObjectRepositoryItem * item) const
{
for (sint32 i = 0; i < 3; i++)
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
{
item->RideType[i] = _legacyType.ride_type[i];
}
+1 -1
View File
@@ -28,7 +28,7 @@ bool rideTypeShouldLoseSeparateFlag(const rct_ride_entry *rideEntry)
}
bool remove_flag = true;
for (sint32 j = 0; j < 3; j++) {
for (sint32 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
if (rideEntry->ride_type[j] == RIDE_TYPE_NULL) {
continue;
}
+1 -1
View File
@@ -285,7 +285,7 @@ void reset_type_to_ride_entry_index_map()
if (rideEntry == (rct_ride_entry *)-1) {
continue;
}
for (uint8 j = 0; j < 3; j++) {
for (uint8 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
uint8 rideType = rideEntry->ride_type[j];
if (rideType < RIDE_TYPE_COUNT) {
uint8 * entryArray = &entryTypeTable[rideType * stride];
+22 -21
View File
@@ -22,6 +22,7 @@
#include "../world/map.h"
#include "vehicle.h"
#define MAX_RIDE_TYPES_PER_RIDE_ENTRY 3
typedef fixed16_2dp ride_rating;
// Convenience function for writing ride ratings. The result is a 16 bit signed
@@ -84,33 +85,33 @@ assert_struct_size(vehicle_colour_preset_list, (1 + 256 * 3));
* size: unknown
*/
typedef struct rct_ride_entry {
rct_string_id name; // 0x000
rct_string_id description; // 0x002
uint32 images_offset; // 0x004
uint32 flags; // 0x008
uint8 ride_type[3]; // 0x00C
uint8 min_cars_in_train; // 0x00F
uint8 max_cars_in_train; // 0x010
uint8 cars_per_flat_ride; // 0x011
rct_string_id name; // 0x000
rct_string_id description; // 0x002
uint32 images_offset; // 0x004
uint32 flags; // 0x008
uint8 ride_type[MAX_RIDE_TYPES_PER_RIDE_ENTRY]; // 0x00C
uint8 min_cars_in_train; // 0x00F
uint8 max_cars_in_train; // 0x010
uint8 cars_per_flat_ride; // 0x011
// Number of cars that can't hold passengers
uint8 zero_cars; // 0x012
uint8 zero_cars; // 0x012
// The index to the vehicle type displayed in
// the vehicle tab.
uint8 tab_vehicle; // 0x013
uint8 default_vehicle; // 0x014
uint8 tab_vehicle; // 0x013
uint8 default_vehicle; // 0x014
// Convert from first - fourth vehicle to
// vehicle structure
uint8 front_vehicle; // 0x015
uint8 second_vehicle; // 0x016
uint8 rear_vehicle; // 0x017
uint8 third_vehicle; // 0x018
uint8 pad_019;
rct_ride_entry_vehicle vehicles[4]; // 0x1A
uint8 front_vehicle; // 0x015
uint8 second_vehicle; // 0x016
uint8 rear_vehicle; // 0x017
uint8 third_vehicle; // 0x018
uint8 pad_019; // 0x019
rct_ride_entry_vehicle vehicles[4]; // 0x01A
vehicle_colour_preset_list *vehicle_preset_list; // 0x1AE
sint8 excitement_multipler; // 0x1B2
sint8 intensity_multipler; // 0x1B3
sint8 nausea_multipler; // 0x1B4
uint8 max_height; // 0x1B5
sint8 excitement_multipler; // 0x1B2
sint8 intensity_multipler; // 0x1B3
sint8 nausea_multipler; // 0x1B4
uint8 max_height; // 0x1B5
union {
uint64 enabledTrackPieces; // 0x1B6
struct {
+20 -9
View File
@@ -205,7 +205,7 @@ static void research_rides_setup(){
uint8 object_index = research->entryIndex & 0xFF;
rct_ride_entry* ride_entry = get_ride_entry(object_index);
uint8 master_found = 0;
bool master_found = false;
if (!(ride_entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)){
for (uint8 rideType = 0; rideType < object_entry_group_counts[OBJECT_TYPE_RIDE]; rideType++){
@@ -220,10 +220,14 @@ static void research_rides_setup(){
if (!(gEditorSelectedObjects[OBJECT_TYPE_RIDE][rideType] & (1 << 0)))
continue;
if (ride_base_type == master_ride->ride_type[0] ||
ride_base_type == master_ride->ride_type[1] ||
ride_base_type == master_ride->ride_type[2]){
master_found = 1;
for (uint8 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
if (master_ride->ride_type[j] == ride_base_type) {
master_found = true;
break;
}
}
if (master_found) {
break;
}
}
@@ -231,11 +235,18 @@ static void research_rides_setup(){
if (!master_found){
// If not in use
if (!(gEditorSelectedObjects[OBJECT_TYPE_RIDE][object_index] & (1 << 0)))
if (!(gEditorSelectedObjects[OBJECT_TYPE_RIDE][object_index] & (1 << 0))) {
continue;
if (ride_base_type != ride_entry->ride_type[0] &&
ride_base_type != ride_entry->ride_type[1] &&
ride_base_type != ride_entry->ride_type[2]){
}
bool foundBaseType = false;
for (uint8 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
if (ride_entry->ride_type[j] == ride_base_type) {
foundBaseType = true;
}
}
if (!foundBaseType) {
continue;
}
}
@@ -715,9 +715,10 @@ static void remove_selected_objects_from_research(const rct_object_entry* instal
if (entry_type == OBJECT_TYPE_RIDE){
rct_ride_entry* rideEntry = (rct_ride_entry*)object_entry_groups[entry_type].chunks[entry_index];
research_remove(entry_index | rideEntry->ride_type[0] << 8 | 0x10000);
research_remove(entry_index | rideEntry->ride_type[1] << 8 | 0x10000);
research_remove(entry_index | rideEntry->ride_type[2] << 8 | 0x10000);
for (uint8 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
research_remove(entry_index | rideEntry->ride_type[j] << 8 | 0x10000);
}
}
else if (entry_type == OBJECT_TYPE_SCENERY_SETS){
research_remove(entry_index);
+2 -2
View File
@@ -3701,7 +3701,7 @@ static void window_ride_maintenance_mousedown(rct_widgetindex widgetIndex, rct_w
case WIDX_FORCE_BREAKDOWN:
num_items = 1;
for (j = 0; j < 3; j++) {
for (j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
if (ride_type->ride_type[j] != 0xFF)
break;
}
@@ -3822,7 +3822,7 @@ static void window_ride_maintenance_dropdown(rct_window *w, rct_widgetindex widg
}
else {
sint32 j;
for (j = 0; j < 3; j++) {
for (j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
if (ride_type->ride_type[j] != 0xFF)
break;
}