1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Merge pull request #2863 from thyeggman/ride_options

Ride List Info Type Additional Options
This commit is contained in:
IntelOrca
2016-02-25 18:04:22 +00:00
4 changed files with 191 additions and 15 deletions

View File

@@ -4002,7 +4002,6 @@ STR_5660 :Modify Groups
STR_5661 :Set Player Group STR_5661 :Set Player Group
STR_5662 :N/A STR_5662 :N/A
STR_5663 :Clear Landscape STR_5663 :Clear Landscape
STR_5664 :Cheat
STR_5701 :{WINDOW_COLOUR_2}Last action: {BLACK}{STRINGID} STR_5701 :{WINDOW_COLOUR_2}Last action: {BLACK}{STRINGID}
STR_5702 :{SMALLFONT}{BLACK}Locate player's most recent action STR_5702 :{SMALLFONT}{BLACK}Locate player's most recent action
STR_5703 :Can't kick the host STR_5703 :Can't kick the host
@@ -4070,6 +4069,22 @@ STR_5762 :Chinese Yuan (CN{YEN})
STR_5763 :All files STR_5763 :All files
STR_5764 :Invalid ride type STR_5764 :Invalid ride type
STR_5765 :Cannot edit rides of invalid type STR_5765 :Cannot edit rides of invalid type
STR_5766 :{SMALLFONT}{BLACK}Paint land height
STR_5767 :Income
STR_5768 :Total customers
STR_5769 :Total profit
STR_5770 :Customers per hour
STR_5771 :Running cost
STR_5772 :Age
STR_5773 :Total customers: {COMMA32}
STR_5774 :Total profit: {CURRENCY2DP}
STR_5775 :Customers: {COMMA32} per hour
STR_5776 :Built: This Year
STR_5777 :Built: Last Year
STR_5778 :Built: {COMMA16} Years Ago
STR_5779 :Income: {CURRENCY2DP} per hour
STR_5780 :Running cost: {CURRENCY2DP} per hour
STR_5781 :Running cost: Unknown
############# #############
# Scenarios # # Scenarios #

View File

@@ -386,6 +386,8 @@ enum {
STR_SELECT_VEHICLE_COLOUR_SCHEME_TIP = 1140, STR_SELECT_VEHICLE_COLOUR_SCHEME_TIP = 1140,
STR_SELECT_VEHICLE_TO_MODIFY_TIP = 1141, STR_SELECT_VEHICLE_TO_MODIFY_TIP = 1141,
STR_DROPDOWN_MENU_LABEL = 1142,
STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION = 1144, STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION = 1144,
STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION = 1145, STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION = 1145,
STR_ENTRANCE_NOT_YET_BUILT = 1146, STR_ENTRANCE_NOT_YET_BUILT = 1146,
@@ -1913,6 +1915,9 @@ enum {
STR_CHEAT_RENEW_RIDES = 5123, STR_CHEAT_RENEW_RIDES = 5123,
STR_CHEAT_MAKE_DESTRUCTABLE = 5125, STR_CHEAT_MAKE_DESTRUCTABLE = 5125,
STR_DISABLE_ELEVATION = 5127,
STR_SELECTION_SIZE = 5128,
STR_ENTER_SELECTION_SIZE = 5129,
STR_CHEAT_FIX_ALL_RIDES = 5132, STR_CHEAT_FIX_ALL_RIDES = 5132,
STR_CHEAT_UNLOCK_OPERATING_LIMITS = 5137, STR_CHEAT_UNLOCK_OPERATING_LIMITS = 5137,
STR_CHEAT_DISABLE_BRAKES_FAILURE = 5140, STR_CHEAT_DISABLE_BRAKES_FAILURE = 5140,
@@ -2336,8 +2341,8 @@ enum {
STR_SCALING_QUALITY_LINEAR = 5731, STR_SCALING_QUALITY_LINEAR = 5731,
STR_SCALING_QUALITY_ANISOTROPIC = 5732, STR_SCALING_QUALITY_ANISOTROPIC = 5732,
STR_USE_NN_AT_INTEGER_SCALE = 5733, STR_USE_NN_AT_INTEGER_SCALE = 5733,
STR_OPTIONS_RENDERING_TIP = 5734, STR_OPTIONS_RENDERING_TIP = 5734,
STR_PAINT_LAND_HEIGHT = 5735,
STR_CLOSED_WITH_PERSON = 5737, STR_CLOSED_WITH_PERSON = 5737,
STR_CLOSED_WITH_PEOPLE = 5738, STR_CLOSED_WITH_PEOPLE = 5738,
@@ -2375,6 +2380,22 @@ enum {
STR_INVALID_RIDE_TYPE = 5764, STR_INVALID_RIDE_TYPE = 5764,
STR_CANT_EDIT_INVALID_RIDE_TYPE = 5765, STR_CANT_EDIT_INVALID_RIDE_TYPE = 5765,
STR_RIDE_LIST_INCOME = 5767,
STR_RIDE_LIST_TOTAL_CUSTOMERS = 5768,
STR_RIDE_LIST_TOTAL_PROFIT = 5769,
STR_RIDE_LIST_CUSTOMERS_PER_HOUR = 5770,
STR_RIDE_LIST_RUNNING_COST = 5771,
STR_RIDE_LIST_AGE = 5772,
STR_RIDE_LIST_TOTAL_CUSTOMERS_LABEL = 5773,
STR_RIDE_LIST_TOTAL_PROFIT_LABEL = 5774,
STR_RIDE_LIST_CUSTOMERS_PER_HOUR_LABEL = 5775,
STR_RIDE_LIST_BUILT_THIS_YEAR_LABEL = 5776,
STR_RIDE_LIST_BUILT_LAST_YEAR_LABEL = 5777,
STR_RIDE_LIST_BUILT_X_YEARS_AGO_LABEL = 5778,
STR_RIDE_LIST_INCOME_LABEL = 5779,
STR_RIDE_LIST_RUNNING_COST_LABEL = 5780,
STR_RIDE_LIST_RUNNING_COST_UNKNOWN = 5781,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768 STR_COUNT = 32768
}; };

View File

@@ -44,9 +44,29 @@ enum {
SPR_RESIZE = 5058, SPR_RESIZE = 5058,
SPR_RIDE_CONSTRUCTION_STRAIGHT = 5137,
SPR_RIDE_CONSTRUCTION_LEFT_CURVE = 5138,
SPR_RIDE_CONSTRUCTION_RIGHT_CURVE = 5139,
SPR_RIDE_CONSTRUCTION_LEFT_CURVE_SMALL = 5140,
SPR_RIDE_CONSTRUCTION_RIGHT_CURVE_SMALL = 5141,
SPR_RIDE_CONSTRUCTION_LEFT_CURVE_LARGE = 5142,
SPR_RIDE_CONSTRUCTION_RIGHT_CURVE_LARGE = 5143,
SPR_RIDE_CONSTRUCTION_SLOPE_DOWN_STEEP = 5144,
SPR_RIDE_CONSTRUCTION_SLOPE_DOWN = 5145,
SPR_RIDE_CONSTRUCTION_SLOPE_LEVEL = 5146,
SPR_RIDE_CONSTRUCTION_SLOPE_UP = 5147,
SPR_RIDE_CONSTRUCTION_SLOPE_UP_STEEP = 5148,
SPR_RIDE_CONSTRUCTION_LEFT_BANK = 5153,
SPR_RIDE_CONSTRUCTION_NO_BANK = 5154,
SPR_RIDE_CONSTRUCTION_RIGHT_BANK = 5155,
SPR_RIDE_CONSTRUCTION_U_SHAPED_TRACK = 5156,
SPR_RIDE_CONSTRUCTION_O_SHAPED_TRACK = 5157,
SPR_PREVIOUS = 5160, SPR_PREVIOUS = 5160,
SPR_NEXT = 5161, SPR_NEXT = 5161,
SPR_DEMOLISH_CURRENT_SECTION = 5162,
SPR_CHAIN_LIFT = 5163,
SPR_CONSTRUCTION = 5164, SPR_CONSTRUCTION = 5164,
SPR_DEMOLISH = 5165, SPR_DEMOLISH = 5165,
SPR_HEARING_VIEWPORT = 5166, SPR_HEARING_VIEWPORT = 5166,
@@ -54,6 +74,7 @@ enum {
SPR_RENAME = 5168, SPR_RENAME = 5168,
SPR_ROTATE_ARROW = 5169, SPR_ROTATE_ARROW = 5169,
SPR_PAINTBRUSH = 5173,
SPR_PICKUP_BTN = 5174, SPR_PICKUP_BTN = 5174,
SPR_PATROL_BTN = 5175, SPR_PATROL_BTN = 5175,
SPR_BUY_LAND_RIGHTS = 5176, SPR_BUY_LAND_RIGHTS = 5176,

View File

@@ -29,6 +29,8 @@
#include "../interface/window.h" #include "../interface/window.h"
#include "dropdown.h" #include "dropdown.h"
#include "../interface/themes.h" #include "../interface/themes.h"
#include "../interface/themes.h"
#include "../localisation/date.h"
enum { enum {
PAGE_RIDES, PAGE_RIDES,
@@ -59,7 +61,7 @@ static rct_widget window_ride_list_widgets[] = {
{ WWT_CLOSEBOX, 0, 327, 337, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button { WWT_CLOSEBOX, 0, 327, 337, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
{ WWT_RESIZE, 1, 0, 339, 43, 239, 0x0FFFFFFFF, 65535 }, // tab page background { WWT_RESIZE, 1, 0, 339, 43, 239, 0x0FFFFFFFF, 65535 }, // tab page background
{ WWT_FLATBTN, 1, 315, 338, 60, 83, SPR_TOGGLE_OPEN_CLOSE, STR_OPEN_OR_CLOSE_ALL_RIDES }, // open / close all toggle { WWT_FLATBTN, 1, 315, 338, 60, 83, SPR_TOGGLE_OPEN_CLOSE, STR_OPEN_OR_CLOSE_ALL_RIDES }, // open / close all toggle
{ WWT_DROPDOWN, 1, 164, 273, 46, 57, 0x0FFFFFFFF, 65535 }, // current information type { WWT_DROPDOWN, 1, 150, 273, 46, 57, 0x0FFFFFFFF, 65535 }, // current information type
{ WWT_DROPDOWN_BUTTON, 1, 262, 272, 47, 56, 876, STR_RIDE_LIST_INFORMATION_TYPE_TIP }, // information type dropdown button { WWT_DROPDOWN_BUTTON, 1, 262, 272, 47, 56, 876, STR_RIDE_LIST_INFORMATION_TYPE_TIP }, // information type dropdown button
{ WWT_DROPDOWN_BUTTON, 1, 280, 333, 46, 57, STR_SORT, STR_RIDE_LIST_SORT_TIP }, // sort button { WWT_DROPDOWN_BUTTON, 1, 280, 333, 46, 57, STR_SORT, STR_RIDE_LIST_SORT_TIP }, // sort button
{ WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, STR_LIST_RIDES_TIP }, // tab 1 { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, STR_LIST_RIDES_TIP }, // tab 1
@@ -120,11 +122,36 @@ enum {
INFORMATION_TYPE_POPULARITY, INFORMATION_TYPE_POPULARITY,
INFORMATION_TYPE_SATISFACTION, INFORMATION_TYPE_SATISFACTION,
INFORMATION_TYPE_PROFIT, INFORMATION_TYPE_PROFIT,
INFORMATION_TYPE_TOTAL_CUSTOMERS,
INFORMATION_TYPE_TOTAL_PROFIT,
INFORMATION_TYPE_CUSTOMERS,
INFORMATION_TYPE_AGE,
INFORMATION_TYPE_INCOME,
INFORMATION_TYPE_RUNNING_COST,
INFORMATION_TYPE_QUEUE_LENGTH, INFORMATION_TYPE_QUEUE_LENGTH,
INFORMATION_TYPE_QUEUE_TIME, INFORMATION_TYPE_QUEUE_TIME,
INFORMATION_TYPE_RELIABILITY, INFORMATION_TYPE_RELIABILITY,
INFORMATION_TYPE_DOWN_TIME, INFORMATION_TYPE_DOWN_TIME,
INFORMATION_TYPE_GUESTS_FAVOURITE INFORMATION_TYPE_GUESTS_FAVOURITE,
DROPDOWN_LIST_COUNT
};
uint32 ride_info_type_string_mapping[DROPDOWN_LIST_COUNT] = {
STR_STATUS,
STR_POPULARITY,
STR_SATISFACTION,
STR_PROFIT,
STR_RIDE_LIST_TOTAL_CUSTOMERS,
STR_RIDE_LIST_TOTAL_PROFIT,
STR_RIDE_LIST_CUSTOMERS_PER_HOUR,
STR_RIDE_LIST_AGE,
STR_RIDE_LIST_INCOME,
STR_RIDE_LIST_RUNNING_COST,
STR_QUEUE_LENGTH,
STR_QUEUE_TIME,
STR_RELIABILITY,
STR_DOWN_TIME,
STR_GUESTS_FAVOURITE
}; };
static int _window_ride_list_information_type; static int _window_ride_list_information_type;
@@ -166,7 +193,7 @@ void window_ride_list_open()
window->min_width = 340; window->min_width = 340;
window->min_height = 240; window->min_height = 240;
window->max_width = 400; window->max_width = 400;
window->max_height = 450; window->max_height = 700;
} }
_window_ride_list_information_type = INFORMATION_TYPE_STATUS; _window_ride_list_information_type = INFORMATION_TYPE_STATUS;
window->list_information_type = 0; window->list_information_type = 0;
@@ -195,7 +222,7 @@ static void window_ride_list_mouseup(rct_window *w, int widgetIndex)
w->no_list_items = 0; w->no_list_items = 0;
w->frame_no = 0; w->frame_no = 0;
w->selected_list_item = -1; w->selected_list_item = -1;
if (w->page != PAGE_RIDES && _window_ride_list_information_type > INFORMATION_TYPE_PROFIT) { if (w->page != PAGE_RIDES && _window_ride_list_information_type > INFORMATION_TYPE_RUNNING_COST) {
_window_ride_list_information_type = INFORMATION_TYPE_STATUS; _window_ride_list_information_type = INFORMATION_TYPE_STATUS;
} }
window_invalidate(w); window_invalidate(w);
@@ -246,15 +273,15 @@ static void window_ride_list_mousedown(int widgetIndex, rct_window*w, rct_widget
widget--; widget--;
if (w->page == PAGE_RIDES) if (w->page == PAGE_RIDES)
lastItem = STR_GUESTS_FAVOURITE; lastItem = INFORMATION_TYPE_GUESTS_FAVOURITE;
else else
lastItem = STR_PROFIT; lastItem = INFORMATION_TYPE_RUNNING_COST;
for (count = 0, currentItem = STR_STATUS; currentItem <= lastItem; currentItem++) { for (count = 0, currentItem = INFORMATION_TYPE_STATUS; currentItem <= lastItem; currentItem++) {
if ((RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) && (currentItem == STR_PROFIT)) if ((RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) && (currentItem == INFORMATION_TYPE_RUNNING_COST))
continue; continue;
gDropdownItemsFormat[count] = 1142; gDropdownItemsFormat[count] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[count] = currentItem; gDropdownItemsArgs[count] = ride_info_type_string_mapping[count];
count++; count++;
} }
@@ -286,7 +313,7 @@ static void window_ride_list_dropdown(rct_window *w, int widgetIndex, int dropdo
if (dropdownIndex == -1) if (dropdownIndex == -1)
return; return;
_window_ride_list_information_type = (uint32)gDropdownItemsArgs[dropdownIndex] - STR_STATUS; _window_ride_list_information_type = dropdownIndex;
window_invalidate(w); window_invalidate(w);
} }
} }
@@ -378,7 +405,7 @@ static void window_ride_list_invalidate(rct_window *w)
colour_scheme_update(w); colour_scheme_update(w);
window_ride_list_widgets[WIDX_CURRENT_INFORMATION_TYPE].image = STR_STATUS + _window_ride_list_information_type; window_ride_list_widgets[WIDX_CURRENT_INFORMATION_TYPE].image = ride_info_type_string_mapping[_window_ride_list_information_type];
// Set correct active tab // Set correct active tab
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
@@ -497,6 +524,44 @@ static void window_ride_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi,
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->profit; RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->profit;
} }
break; break;
case INFORMATION_TYPE_TOTAL_CUSTOMERS:
formatSecondary = STR_RIDE_LIST_TOTAL_CUSTOMERS_LABEL;
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->total_customers;
break;
case INFORMATION_TYPE_TOTAL_PROFIT:
formatSecondary = 0;
if (ride->total_profit != MONEY32_UNDEFINED) {
formatSecondary = STR_RIDE_LIST_TOTAL_PROFIT_LABEL;
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->total_profit;
}
break;
case INFORMATION_TYPE_CUSTOMERS:
formatSecondary = STR_RIDE_LIST_CUSTOMERS_PER_HOUR_LABEL;
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride_customers_per_hour(ride);
break;
case INFORMATION_TYPE_AGE:;
sint16 age = date_get_year(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) - ride->build_date);
switch (age) {
case 0: formatSecondary = STR_RIDE_LIST_BUILT_THIS_YEAR_LABEL; break;
case 1: formatSecondary = STR_RIDE_LIST_BUILT_LAST_YEAR_LABEL; break;
default: formatSecondary = STR_RIDE_LIST_BUILT_X_YEARS_AGO_LABEL; break;
}
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint16) = age;
break;
case INFORMATION_TYPE_INCOME:
formatSecondary = 0;
if (ride->income_per_hour != MONEY32_UNDEFINED) {
formatSecondary = STR_RIDE_LIST_INCOME_LABEL;
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->income_per_hour;
}
break;
case INFORMATION_TYPE_RUNNING_COST:
formatSecondary = STR_RIDE_LIST_RUNNING_COST_UNKNOWN;
if (ride->upkeep_cost != (money16)0xFFFF) {
formatSecondary = STR_RIDE_LIST_RUNNING_COST_LABEL;
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->upkeep_cost * 16;
}
break;
case INFORMATION_TYPE_QUEUE_LENGTH: case INFORMATION_TYPE_QUEUE_LENGTH:
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride_get_total_queue_length(ride); RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride_get_total_queue_length(ride);
formatSecondary = STR_QUEUE_EMPTY; formatSecondary = STR_QUEUE_EMPTY;
@@ -648,6 +713,60 @@ static void window_ride_list_refresh_list(rct_window *w)
window_bubble_list_item(w, current_list_position); window_bubble_list_item(w, current_list_position);
} }
break; break;
case INFORMATION_TYPE_TOTAL_CUSTOMERS:
while (--current_list_position >= 0) {
otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->total_customers <= otherRide->total_customers)
break;
window_bubble_list_item(w, current_list_position);
}
break;
case INFORMATION_TYPE_TOTAL_PROFIT:
while (--current_list_position >= 0) {
otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->total_profit <= otherRide->total_profit)
break;
window_bubble_list_item(w, current_list_position);
}
break;
case INFORMATION_TYPE_CUSTOMERS:
while (--current_list_position >= 0) {
otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride_customers_per_hour(ride) <= ride_customers_per_hour(otherRide))
break;
window_bubble_list_item(w, current_list_position);
}
break;
case INFORMATION_TYPE_AGE:
while (--current_list_position >= 0) {
otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->build_date <= otherRide->build_date)
break;
window_bubble_list_item(w, current_list_position);
}
break;
case INFORMATION_TYPE_INCOME:
while (--current_list_position >= 0) {
otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->income_per_hour <= otherRide->income_per_hour)
break;
window_bubble_list_item(w, current_list_position);
}
break;
case INFORMATION_TYPE_RUNNING_COST:
while (--current_list_position >= 0) {
otherRide = get_ride(w->list_item_positions[current_list_position]);
if (ride->upkeep_cost <= otherRide->upkeep_cost)
break;
window_bubble_list_item(w, current_list_position);
}
break;
case INFORMATION_TYPE_QUEUE_LENGTH: case INFORMATION_TYPE_QUEUE_LENGTH:
while (--current_list_position >= 0) { while (--current_list_position >= 0) {
otherRide = get_ride(w->list_item_positions[current_list_position]); otherRide = get_ride(w->list_item_positions[current_list_position]);