/** * rct2: 0x006B6F3E * * Note: When the user has selection by track type enabled, the categories are determined by the track type, not those in the rct_ride_entry. */ static void window_new_ride_populate_list() { uint8 currentCategory = _windowNewRideCurrentTab; ride_list_item *nextListItem = _windowNewRideListItems; // For each ride type in the view order list for (int i = 0; i < countof(RideTypeViewOrder); i++) { uint8 rideType = RideTypeViewOrder[i]; if (rideType == RIDE_TYPE_NULL) continue; if(gConfigInterface.select_by_track_type) { if(gRideCategories[rideType]!=currentCategory) continue; } char preferredVehicleName[9]; safe_strcpy(preferredVehicleName, " ", sizeof(preferredVehicleName)); if (ride_type_is_invented(rideType)) { int dh = 0; uint8 *rideEntryIndexPtr = get_ride_entry_indices_for_ride_type(rideType); // For each ride entry for this ride type while (*rideEntryIndexPtr != 255) { uint8 rideEntryIndex = *rideEntryIndexPtr++; char rideEntryName[9]; memcpy(rideEntryName,object_entry_groups[OBJECT_TYPE_RIDE].entries[rideEntryIndex].name,8); rideEntryName[8]=0; // Skip if vehicle type is not invented yet if (!ride_entry_is_invented(rideEntryIndex)) continue; // Ride entries rct_ride_entry *rideEntry = get_ride_entry(rideEntryIndex); // Check if ride is in this category if (!gConfigInterface.select_by_track_type && (currentCategory != rideEntry->category[0] && currentCategory != rideEntry->category[1])) continue; // Skip if the vehicle isn't the preferred vehicle for this generic track type if (gConfigInterface.select_by_track_type && (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(rideEntry))) { if (strcmp(preferredVehicleName, " \0") == 0) { safe_strcpy(preferredVehicleName, rideEntryName, sizeof(preferredVehicleName)); preferredVehicleName[8] = 0; } else { if (vehicle_preference_compare(rideType, preferredVehicleName, rideEntryName) == 1) { safe_strcpy(preferredVehicleName, rideEntryName, sizeof(preferredVehicleName)); preferredVehicleName[8] = 0; } else { continue; } } } if ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) && !rideTypeShouldLoseSeparateFlag(rideEntry)) { dh &= ~4; nextListItem->type = rideType; nextListItem->entry_index = rideEntryIndex; nextListItem++; } else if (!(dh & 1)) { dh |= 5; nextListItem->type = rideType; nextListItem->entry_index = rideEntryIndex; nextListItem++; } else if (dh & 4) { if (rideType == rideEntry->ride_type[0]) { nextListItem--; nextListItem->type = rideType; nextListItem->entry_index = rideEntryIndex; nextListItem++; } } } } } nextListItem->type = 255; nextListItem->entry_index = 255; _trackSelectionByType = gConfigInterface.select_by_track_type; }
/** * rct2: 0x006B6F3E * * Note: When the user has selection by track type enabled, the categories are determined by the track type, not those in the rct_ride_type. */ static void window_new_ride_populate_list() { int i, quadIndex, bitIndex; uint8 currentCategory = _window_new_ride_current_tab; ride_list_item *nextListItem = (ride_list_item*)0x00F43523; rct_ride_type **rideEntries = (rct_ride_type**)0x009ACFA4; // For each ride type in the view order list for (i = 0; i < countof(RideTypeViewOrder); i++) { uint8 rideType = RideTypeViewOrder[i]; if (rideType == RIDE_TYPE_NULL) continue; if(gConfigInterface.select_by_track_type) { if(gRideCategories[rideType]!=currentCategory) continue; } char preferredVehicleName[9]; strcpy(preferredVehicleName," "); quadIndex = rideType >> 5; bitIndex = rideType & 0x1F; if (RCT2_ADDRESS(0x01357404, uint32)[quadIndex] & (1 << bitIndex)) { int dh = 0; uint8 *rideEntryIndexPtr = get_ride_entry_indices_for_ride_type(rideType); // For each ride entry for this ride type while (*rideEntryIndexPtr != 255) { uint8 rideEntryIndex = *rideEntryIndexPtr++; char rideEntryName[9]; memcpy(rideEntryName,object_entry_groups[OBJECT_TYPE_RIDE].entries[rideEntryIndex].name,8); rideEntryName[8]=0; quadIndex = rideEntryIndex >> 5; bitIndex = rideEntryIndex & 0x1F; // Skip if vehicle type is not invented yet if (!(RCT2_ADDRESS(0x01357424, uint32)[quadIndex] & (1 << bitIndex))) continue; // Ride entries rct_ride_type *rideEntry = rideEntries[rideEntryIndex]; // Check if ride is in this category if (!gConfigInterface.select_by_track_type && (currentCategory != rideEntry->category[0] && currentCategory != rideEntry->category[1])) continue; // Skip if the vehicle isn't the preferred vehicle for this generic track type if(gConfigInterface.select_by_track_type && (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(rideEntry))) { if(strcmp(preferredVehicleName," \0")==0) { strcpy(preferredVehicleName,rideEntryName); preferredVehicleName[8]=0; } else { if(vehicleIsHigherInHierarchy(rideType,preferredVehicleName,rideEntryName)) { strcpy(preferredVehicleName,rideEntryName); preferredVehicleName[8]=0; } else { continue; } } } if ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) && !rideTypeShouldLoseSeparateFlag(rideEntry)) { dh &= ~4; nextListItem->type = rideType; nextListItem->entry_index = rideEntryIndex; nextListItem++; } else if (!(dh & 1)) { dh |= 5; nextListItem->type = rideType; nextListItem->entry_index = rideEntryIndex; nextListItem++; } else if (dh & 4) { if (rideType == rideEntry->ride_type[0]) { nextListItem--; nextListItem->type = rideType; nextListItem->entry_index = rideEntryIndex; nextListItem++; } } } } }