diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 1869e7b9cf..bbdb4e4292 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -913,7 +913,7 @@ static void window_options_mouseup(rct_window* w, rct_widgetindex widgetIndex) window_close_by_class(WC_SCENARIO_SELECT); break; case WIDX_TITLE_SEQUENCE_RANDOM: - gConfigInterface.random_title_sequence ^=1; + gConfigInterface.random_title_sequence ^= 1; config_save_default(); w->Invalidate(); break; @@ -1914,8 +1914,8 @@ static void window_options_invalidate(rct_window* w) widget_set_checkbox_value(w, WIDX_AUTO_OPEN_SHOPS, gConfigGeneral.auto_open_shops); widget_set_checkbox_value(w, WIDX_TITLE_SEQUENCE_RANDOM, gConfigInterface.random_title_sequence); widget_set_checkbox_value(w, WIDX_ALLOW_EARLY_COMPLETION, gConfigGeneral.allow_early_completion); - - //Disable title sequence dropdown if set to random + + // Disable title sequence dropdown if set to random if (gConfigInterface.random_title_sequence) { w->disabled_widgets |= (1 << WIDX_TITLE_SEQUENCE_DROPDOWN); diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index e35d627a5c..7a22c49185 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3893,7 +3893,7 @@ enum STR_CANNOT_BUILD_PATH_ADDITIONS_ON_LEVEL_CROSSINGS = 6347, STR_REMOVE_LEVEL_CROSSING_FIRST = 6348, - + STR_OPTIONS_RANDOM_TITLE_SEQUENCE = 6349, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index dd3f0d896a..acb8f14e2a 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -228,47 +228,59 @@ void TitleScreen::TitleInitialise() } if (gConfigInterface.random_title_sequence) { - bool RCT1Installed = false, RCT1AAInstalled = false, RCT1LLInstalled = false; int RCT1Count = 0; size_t scenarioCount = scenario_repository_get_count(); - for (size_t s = 0; s < scenarioCount; s++ ) { - if (scenario_repository_get_by_index(s)->source_game == SCENARIO_SOURCE_RCT1) { + + for (size_t s = 0; s < scenarioCount; s++) + { + if (scenario_repository_get_by_index(s)->source_game == SCENARIO_SOURCE_RCT1) + { RCT1Count++; } - if (scenario_repository_get_by_index(s)->source_game == SCENARIO_SOURCE_RCT1_AA) { + if (scenario_repository_get_by_index(s)->source_game == SCENARIO_SOURCE_RCT1_AA) + { RCT1AAInstalled = true; } - if (scenario_repository_get_by_index(s)->source_game == SCENARIO_SOURCE_RCT1_LL) { + if (scenario_repository_get_by_index(s)->source_game == SCENARIO_SOURCE_RCT1_LL) + { RCT1LLInstalled = true; } } - //Mega Park can show up in the scenario list even if RCT1 has been uninstalled, so it must be greater than 1 - if (RCT1Count > 1) { + + // Mega Park can show up in the scenario list even if RCT1 has been uninstalled, so it must be greater than 1 + if (RCT1Count > 1) + { RCT1Installed = true; } - + int32_t random = 0; bool safeSequence = false; std::string RCT1String = format_string(STR_TITLE_SEQUENCE_RCT1, gCommonFormatArgs); std::string RCT1AAString = format_string(STR_TITLE_SEQUENCE_RCT1_AA, gCommonFormatArgs); std::string RCT1LLString = format_string(STR_TITLE_SEQUENCE_RCT1_AA_LL, gCommonFormatArgs); - //Ensure the random sequence chosen isn't from RCT1 or expansion if the player doesn't have it installed - while (!safeSequence) { + + // Ensure the random sequence chosen isn't from RCT1 or expansion if the player doesn't have it installed + while (!safeSequence) + { size_t total = TitleSequenceManager::GetCount(); random = util_rand() % (int32_t)total; const utf8* scName = title_sequence_manager_get_name(random); safeSequence = true; - if (scName == RCT1String) { + if (scName == RCT1String) + { safeSequence = RCT1Installed; - } if (scName == RCT1AAString) { + } + if (scName == RCT1AAString) + { safeSequence = RCT1AAInstalled; - } if (scName == RCT1LLString) { + } + if (scName == RCT1LLString) + { safeSequence = RCT1LLInstalled; } } ChangePresetSequence(random); - } size_t seqId = title_get_config_sequence(); if (seqId == SIZE_MAX)