From 0b3d2dad410b12aa073ac87b3cf26eeb23b847fb Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 17 May 2015 14:26:45 +0200 Subject: [PATCH] Add a cheat option to disable brakes failure --- src/config.c | 1 + src/config.h | 1 + src/ride/ride.c | 9 +++++++-- src/windows/cheats.c | 13 +++++++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/config.c b/src/config.c index a55a50ce28..e9ded85ba5 100644 --- a/src/config.c +++ b/src/config.c @@ -179,6 +179,7 @@ config_property_definition _soundDefinitions[] = { config_property_definition _cheatDefinitions[] = { { offsetof(cheat_configuration, fast_lift_hill), "fast_lift_hill", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, + { offsetof(cheat_configuration, disable_brakes_failure), "disable_brakes_failure", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, }; config_section_definition _sectionDefinitions[] = { diff --git a/src/config.h b/src/config.h index 4a82891924..7eb9919e15 100644 --- a/src/config.h +++ b/src/config.h @@ -148,6 +148,7 @@ typedef struct { typedef struct { uint8 fast_lift_hill; + uint8 disable_brakes_failure; } cheat_configuration; diff --git a/src/ride/ride.c b/src/ride/ride.c index ba190de0af..387bdcecd0 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -21,6 +21,7 @@ #include "../addresses.h" #include "../audio/audio.h" #include "../audio/mixer.h" +#include "../config.h" #include "../game.h" #include "../input.h" #include "../interface/window.h" @@ -1603,13 +1604,17 @@ static int ride_get_new_breakdown_problem(rct_ride *ride) if (breakdownProblem != BREAKDOWN_BRAKES_FAILURE) return breakdownProblem; - // Breaks failure can not happen if block breaks are used (so long as there is more than one vehicle) - // However if this is the case, break failure should be taken out the equation, otherwise block brake + // Brakes failure can not happen if block brakes are used (so long as there is more than one vehicle) + // However if this is the case, brake failure should be taken out the equation, otherwise block brake // rides have a lower probability to break down due to a random implementation reason. if (ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED) if (ride->num_vehicles != 1) return -1; + // If brakes failure is disabled, also take it out of the equation (see above comment why) + if(gConfigCheat.disable_brakes_failure) + return -1; + monthsOld = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint8) - ride->build_date; if (monthsOld < 16 || ride->reliability > (50 << 8) || ride->lifecycle_flags & RIDE_LIFECYCLE_SIX_FLAGS) return -1; diff --git a/src/windows/cheats.c b/src/windows/cheats.c index 758de298f1..5322e83e33 100644 --- a/src/windows/cheats.c +++ b/src/windows/cheats.c @@ -75,7 +75,8 @@ enum WINDOW_CHEATS_WIDGET_IDX { WIDX_REMOVE_SIX_FLAGS, WIDX_MAKE_DESTRUCTIBLE, WIDX_FIX_ALL, - WIDX_FAST_LIFT_HILL + WIDX_FAST_LIFT_HILL, + WIDX_DISABLE_BRAKES_FAILURE }; #pragma region MEASUREMENTS @@ -169,6 +170,7 @@ static rct_widget window_cheats_rides_widgets[] = { { WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(1), HPL(1), 5125, STR_NONE}, // Make destructable { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(1), HPL(1), 5132, STR_NONE }, // Fix all rides { WWT_CHECKBOX, 2, XPL(0), OWPL, YPL(8),OHPL(8), 5137, STR_NONE }, // 410 km/h lift hill + { WWT_CHECKBOX, 2, XPL(0), OWPL, YPL(7),OHPL(7), 5140, STR_NONE }, // Disable brakes failure { WIDGETS_END }, }; @@ -327,7 +329,7 @@ static uint32 window_cheats_page_enabled_widgets[] = { (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HIGH_MONEY) | (1 << WIDX_PARK_ENTRANCE_FEE), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HAPPY_GUESTS) | (1 << WIDX_TRAM_GUESTS), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_FREEZE_CLIMATE) | (1 << WIDX_OPEN_CLOSE_PARK) | (1 << WIDX_DECREASE_GAME_SPEED) | (1 << WIDX_INCREASE_GAME_SPEED) | (1 << WIDX_ZERO_CLEARANCE) | (1 << WIDX_WEATHER_SUN) | (1 << WIDX_WEATHER_THUNDER) | (1 << WIDX_CLEAR_GRASS) | (1 << WIDX_MOWED_GRASS) | (1 << WIDX_WATER_PLANTS) | (1 << WIDX_FIX_VANDALISM) | (1 << WIDX_REMOVE_LITTER) | (1 << WIDX_WIN_SCENARIO), - (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_RENEW_RIDES) | (1 << WIDX_REMOVE_SIX_FLAGS) | (1 << WIDX_MAKE_DESTRUCTIBLE) | (1 << WIDX_FIX_ALL) | (1 << WIDX_FAST_LIFT_HILL) + (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_RENEW_RIDES) | (1 << WIDX_REMOVE_SIX_FLAGS) | (1 << WIDX_MAKE_DESTRUCTIBLE) | (1 << WIDX_FIX_ALL) | (1 << WIDX_FAST_LIFT_HILL) | (1 << WIDX_DISABLE_BRAKES_FAILURE) }; static void window_cheats_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w); @@ -674,6 +676,12 @@ static void window_cheats_rides_mouseup() gConfigCheat.fast_lift_hill ^= 1; config_save_default(); window_invalidate(w); + break; + case WIDX_DISABLE_BRAKES_FAILURE: + gConfigCheat.disable_brakes_failure ^= 1; + config_save_default(); + window_invalidate(w); + break; } } @@ -710,6 +718,7 @@ static void window_cheats_invalidate() case WINDOW_CHEATS_PAGE_RIDES: RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 255; widget_set_checkbox_value(w, WIDX_FAST_LIFT_HILL, gConfigCheat.fast_lift_hill); + widget_set_checkbox_value(w, WIDX_DISABLE_BRAKES_FAILURE, gConfigCheat.disable_brakes_failure); break; }