From ba038c10ab7d78cb2316c82bef092e544df71403 Mon Sep 17 00:00:00 2001 From: Ian Spence Date: Thu, 24 Dec 2015 00:00:41 -0800 Subject: [PATCH] Automatically open shops & stalls - Added a new option under misc to automatically open shops and stalls - Option is disabled by default - When enabled, shops & stalls are automatically opened right after being placed on the map --- data/language/english_uk.txt | 2 ++ src/config.c | 1 + src/config.h | 1 + src/localisation/string_ids.h | 3 +++ src/windows/options.c | 12 +++++++++++- src/windows/ride_construction.c | 6 ++++++ 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 83ed7fc69b..024aa3a7a3 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3924,6 +3924,8 @@ STR_5582 :Trap mouse cursor in window STR_5583 :{COMMA1DP16}ms{POWERNEGATIVEONE} STR_5584 :SI STR_5585 :{SMALLFONT}{BLACK}Unlocks ride operation limits, allowing for things like {VELOCITY} lift hills +STR_5586 :Automatically open shops and stalls +STR_5587 :{SMALLFONT}{BLACK}When enabled, shops and stalls will be automatically opened after placing then in the map ##################### # Rides/attractions # diff --git a/src/config.c b/src/config.c index d25137180a..708154cb43 100644 --- a/src/config.c +++ b/src/config.c @@ -202,6 +202,7 @@ config_property_definition _generalDefinitions[] = { { offsetof(general_configuration, window_scale), "window_scale", CONFIG_VALUE_TYPE_FLOAT, { .value_float = 1.0f }, NULL }, { offsetof(general_configuration, show_fps), "show_fps", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(general_configuration, trap_cursor), "trap_cursor", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, + { offsetof(general_configuration, auto_open_shops), "auto_open_shops", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, }; config_property_definition _interfaceDefinitions[] = { diff --git a/src/config.h b/src/config.h index d0b9dfa72d..49d3ef42ad 100644 --- a/src/config.h +++ b/src/config.h @@ -171,6 +171,7 @@ typedef struct { float window_scale; uint8 show_fps; uint8 trap_cursor; + uint8 auto_open_shops; } general_configuration; typedef struct { diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 3ed880519a..b8956b8499 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -2155,6 +2155,9 @@ enum { STR_KICK_PLAYER = 5556, STR_STAY_CONNECTED_AFTER_DESYNC = 5557, + STR_AUTO_OPEN_SHOPS = 5586, + STR_AUTO_OPEN_SHOPS_TIP = 5587, + STR_RESTART_REQUIRED = 5558, STR_LANGUAGE_LOAD_FAILED = 5561, diff --git a/src/windows/options.c b/src/windows/options.c index 692d581ddd..aaf5e14b74 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -150,6 +150,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX { WIDX_TITLE_SEQUENCE_BUTTON, WIDX_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM, WIDX_STAY_CONNECTED_AFTER_DESYNC, + WIDX_AUTO_OPEN_SHOPS, // Twitch WIDX_CHANNEL_BUTTON = WIDX_PAGE_START, @@ -270,6 +271,7 @@ static rct_widget window_options_misc_widgets[] = { { WWT_DROPDOWN_BUTTON, 1, 26, 185, 189, 200, STR_EDIT_TITLE_SEQUENCES_BUTTON, STR_NONE }, // Title sequences button { WWT_CHECKBOX, 2, 10, 299, 204, 215, STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM, STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM_TIP }, // Allow loading with incorrect checksum { WWT_CHECKBOX, 2, 10, 299, 219, 230, STR_STAY_CONNECTED_AFTER_DESYNC, STR_NONE }, // Do not disconnect after the client desynchronises with the server + { WWT_CHECKBOX, 2, 10, 299, 234, 245, STR_AUTO_OPEN_SHOPS, STR_AUTO_OPEN_SHOPS_TIP }, // Automatically open shops & stalls { WIDGETS_END }, }; @@ -431,7 +433,8 @@ static uint32 window_options_page_enabled_widgets[] = { (1 << WIDX_TITLE_SEQUENCE_DROPDOWN) | (1 << WIDX_TITLE_SEQUENCE_BUTTON) | (1 << WIDX_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM) | - (1 << WIDX_STAY_CONNECTED_AFTER_DESYNC), + (1 << WIDX_STAY_CONNECTED_AFTER_DESYNC) | + (1 << WIDX_AUTO_OPEN_SHOPS), MAIN_OPTIONS_ENABLED_WIDGETS | (1 << WIDX_CHANNEL_BUTTON) | @@ -687,6 +690,11 @@ static void window_options_mouseup(rct_window *w, int widgetIndex) gConfigNetwork.stay_connected = !gConfigNetwork.stay_connected; config_save_default(); window_invalidate(w); + break; + case WIDX_AUTO_OPEN_SHOPS: + gConfigGeneral.auto_open_shops = !gConfigGeneral.auto_open_shops; + config_save_default(); + window_invalidate(w); } break; @@ -1345,6 +1353,7 @@ static void window_options_invalidate(rct_window *w) widget_set_checkbox_value(w, WIDX_DEBUGGING_TOOLS, gConfigGeneral.debugging_tools); widget_set_checkbox_value(w, WIDX_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM, gConfigGeneral.allow_loading_with_incorrect_checksum); widget_set_checkbox_value(w, WIDX_STAY_CONNECTED_AFTER_DESYNC, gConfigNetwork.stay_connected); + widget_set_checkbox_value(w, WIDX_AUTO_OPEN_SHOPS, gConfigGeneral.auto_open_shops); window_options_misc_widgets[WIDX_REAL_NAME_CHECKBOX].type = WWT_CHECKBOX; window_options_misc_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX; @@ -1359,6 +1368,7 @@ static void window_options_invalidate(rct_window *w) window_options_misc_widgets[WIDX_TITLE_SEQUENCE_BUTTON].type = WWT_DROPDOWN_BUTTON; window_options_misc_widgets[WIDX_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM].type = WWT_CHECKBOX; window_options_misc_widgets[WIDX_STAY_CONNECTED_AFTER_DESYNC].type = WWT_CHECKBOX; + window_options_misc_widgets[WIDX_AUTO_OPEN_SHOPS].type = WWT_CHECKBOX; break; case WINDOW_OPTIONS_PAGE_TWITCH: diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 19ce6f9bd1..68c71a752d 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -585,6 +585,12 @@ static void window_ride_construction_close(rct_window *w) uint8 rideIndex = _currentRideIndex; if (sub_6CAF80(rideIndex, &mapElement) || network_get_mode() == NETWORK_MODE_CLIENT) { + + rct_ride *ride = GET_RIDE(rideIndex); + if (ride->mode == RIDE_MODE_SHOP_STALL && gConfigGeneral.auto_open_shops) { + ride->status = 1; + } + window_ride_main_open(rideIndex); } else { int eax = RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8);