1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Merge pull request #1076 from Gymnasiast/disable-brakes-failure

Add a cheat option to disable brakes failure
This commit is contained in:
Ted John
2015-05-17 16:50:52 +01:00
5 changed files with 21 additions and 4 deletions

View File

@@ -3473,3 +3473,4 @@ STR_5136 :Land rights
STR_5137 :Allow lift hill speeds up to {VELOCITY}
STR_5138 :{SMALLFONT}{WINDOW_COLOUR_2}{STRINGID}
STR_5139 :{WHITE}{STRINGID}
STR_5140 :Disable brakes failure

View File

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

View File

@@ -148,6 +148,7 @@ typedef struct {
typedef struct {
uint8 fast_lift_hill;
uint8 disable_brakes_failure;
} cheat_configuration;

View File

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

View File

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