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
This commit is contained in:
Ian Spence 2015-12-24 00:00:41 -08:00
parent 652031e0fe
commit ba038c10ab
6 changed files with 24 additions and 1 deletions

View File

@ -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 #

View File

@ -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[] = {

View File

@ -171,6 +171,7 @@ typedef struct {
float window_scale;
uint8 show_fps;
uint8 trap_cursor;
uint8 auto_open_shops;
} general_configuration;
typedef struct {

View File

@ -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,

View File

@ -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:

View File

@ -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);