Ejemplo n.º 1
0
/**
 *
 *  rct2: 0x006CF2D6
 */
static void window_track_list_invalidate(rct_window *w)
{
	rct_ride_entry *entry;
	rct_string_id stringId;

	colour_scheme_update(w);

	entry = get_ride_entry(_window_track_list_item.entry_index);

	stringId = entry->name;
	if (!(entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(entry))
		stringId = _window_track_list_item.type + 2;

	RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = stringId;
	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
		window_track_list_widgets[WIDX_TITLE].image = STR_TRACK_DESIGNS;
		window_track_list_widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_RENAME_OR_DELETE_IT;
	} else {
		window_track_list_widgets[WIDX_TITLE].image = STR_SELECT_DESIGN;
		window_track_list_widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_BUILD_IT_TIP;
	}

	if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) || w->track_list.var_482 != 0) {
		w->pressed_widgets |= 1 << WIDX_TRACK_PREVIEW;
		w->disabled_widgets &= ~(1 << WIDX_TRACK_PREVIEW);
		window_track_list_widgets[WIDX_ROTATE].type = WWT_FLATBTN;
		window_track_list_widgets[WIDX_TOGGLE_SCENERY].type = WWT_FLATBTN;
		if (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) == 0)
			w->pressed_widgets |= (1 << WIDX_TOGGLE_SCENERY);
		else
			w->pressed_widgets &= ~(1 << WIDX_TOGGLE_SCENERY);
	} else {
		w->pressed_widgets &= ~(1 << WIDX_TRACK_PREVIEW);
		w->disabled_widgets |= (1 << WIDX_TRACK_PREVIEW);
		window_track_list_widgets[WIDX_ROTATE].type = WWT_EMPTY;
		window_track_list_widgets[WIDX_TOGGLE_SCENERY].type = WWT_EMPTY;
	}
}
Ejemplo n.º 2
0
/**
 *	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;
}
Ejemplo n.º 3
0
/**
 *	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++;
                    }
                }
            }
        }
    }