diff --git a/src/openrct2-ui/scripting/ScUi.hpp b/src/openrct2-ui/scripting/ScUi.hpp index ac68c1065f..fd5373841d 100644 --- a/src/openrct2-ui/scripting/ScUi.hpp +++ b/src/openrct2-ui/scripting/ScUi.hpp @@ -406,14 +406,14 @@ namespace OpenRCT2::Scripting auto entry = scenarioRepo->GetByPath(std::string(path).c_str()); if (entry != nullptr) { - obj.Set("id", entry->sc_id); - obj.Set("category", ToDuk(ctx, static_cast(entry->category))); - obj.Set("sourceGame", ToDuk(ctx, entry->source_game)); - obj.Set("internalName", entry->internal_name); - obj.Set("name", entry->name); - obj.Set("details", entry->details); + obj.Set("id", entry->ScenarioId); + obj.Set("category", ToDuk(ctx, static_cast(entry->Category))); + obj.Set("sourceGame", ToDuk(ctx, entry->SourceGame)); + obj.Set("internalName", entry->InternalName); + obj.Set("name", entry->Name); + obj.Set("details", entry->Details); - auto* highscore = entry->highscore; + auto* highscore = entry->Highscore; if (highscore == nullptr) { obj.Set("highscore", nullptr); diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index e1bb23c6f4..c4a336bdb6 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -156,7 +156,7 @@ namespace OpenRCT2::Title if (scenario != nullptr) { GameNotifyMapChange(); - loadSuccess = LoadParkFromFile(scenario->path); + loadSuccess = LoadParkFromFile(scenario->Path); } if (!loadSuccess) @@ -279,9 +279,9 @@ namespace OpenRCT2::Title return _position != entryPosition; } - bool LoadParkFromFile(const utf8* path) + bool LoadParkFromFile(const u8string& path) { - LOG_VERBOSE("TitleSequencePlayer::LoadParkFromFile(%s)", path); + LOG_VERBOSE("TitleSequencePlayer::LoadParkFromFile(%s)", path.c_str()); bool success = false; try { @@ -306,7 +306,7 @@ namespace OpenRCT2::Title } catch (const std::exception&) { - Console::Error::WriteLine("Unable to load park: %s", path); + Console::Error::WriteLine("Unable to load park: %s", path.c_str()); } gLoadKeepWindowsOpen = false; return success; diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 27e8db908a..2f4108a09b 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -56,7 +56,7 @@ struct ScenarioListItem } heading; struct { - const scenario_index_entry * scenario; + const ScenarioIndexEntry * scenario; bool is_locked; } scenario; }; @@ -145,7 +145,7 @@ static WindowEventList window_scenarioselect_events([](auto& events) static void DrawCategoryHeading(WindowBase* w, DrawPixelInfo* dpi, int32_t left, int32_t right, int32_t y, StringId stringId); static void InitialiseListItems(WindowBase* w); -static bool IsScenarioVisible(WindowBase* w, const scenario_index_entry* scenario); +static bool IsScenarioVisible(WindowBase* w, const ScenarioIndexEntry* scenario); static bool IsLockingEnabled(WindowBase* w); static std::function _callback; @@ -206,16 +206,16 @@ static void WindowScenarioselectInitTabs(WindowBase* w) size_t numScenarios = ScenarioRepositoryGetCount(); for (size_t i = 0; i < numScenarios; i++) { - const scenario_index_entry* scenario = ScenarioRepositoryGetByIndex(i); + const ScenarioIndexEntry* scenario = ScenarioRepositoryGetByIndex(i); if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN || _titleEditor) { - if (_titleEditor && scenario->source_game == ScenarioSource::Other) + if (_titleEditor && scenario->SourceGame == ScenarioSource::Other) continue; - showPages |= 1 << static_cast(scenario->source_game); + showPages |= 1 << static_cast(scenario->SourceGame); } else { - int32_t category = scenario->category; + int32_t category = scenario->Category; if (category > SCENARIO_CATEGORY_OTHER) { category = SCENARIO_CATEGORY_OTHER; @@ -341,7 +341,7 @@ static void WindowScenarioselectScrollmousedown(WindowBase* w, int32_t scrollInd { OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, w->windowPos.x + (w->width / 2)); gFirstTimeSaving = true; - _callback(listItem.scenario.scenario->path); + _callback(listItem.scenario.scenario->Path); if (_titleEditor) { WindowClose(*w); @@ -366,7 +366,7 @@ static void WindowScenarioselectScrollmouseover(WindowBase* w, int32_t scrollInd bool originalShowLockedInformation = _showLockedInformation; _showLockedInformation = false; - const scenario_index_entry* selected = nullptr; + const ScenarioIndexEntry* selected = nullptr; auto mutableScreenCoords = screenCoords; for (const auto& listItem : _listItems) { @@ -426,7 +426,7 @@ static void WindowScenarioselectInvalidate(WindowBase* w) static void WindowScenarioselectPaint(WindowBase* w, DrawPixelInfo* dpi) { int32_t format; - const scenario_index_entry* scenario; + const ScenarioIndexEntry* scenario; WindowDrawWidgets(*w, dpi); @@ -485,7 +485,7 @@ static void WindowScenarioselectPaint(WindowBase* w, DrawPixelInfo* dpi) { utf8 path[MAX_PATH]; - ShortenPath(path, sizeof(path), scenario->path, w->width - 6 - TabWidth, FontStyle::Medium); + ShortenPath(path, sizeof(path), scenario->Path, w->width - 6 - TabWidth, FontStyle::Medium); const utf8* pathPtr = path; auto ft = Formatter(); @@ -500,7 +500,7 @@ static void WindowScenarioselectPaint(WindowBase* w, DrawPixelInfo* dpi) window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5 }; auto ft = Formatter(); ft.Add(STR_STRING); - ft.Add(scenario->name); + ft.Add(scenario->Name); DrawTextEllipsised( dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); screenPos.y += 15; @@ -508,16 +508,16 @@ static void WindowScenarioselectPaint(WindowBase* w, DrawPixelInfo* dpi) // Scenario details ft = Formatter(); ft.Add(STR_STRING); - ft.Add(scenario->details); + ft.Add(scenario->Details); screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_BLACK_STRING, ft) + 5; // Scenario objective ft = Formatter(); - ft.Add(ObjectiveNames[scenario->objective_type]); - if (scenario->objective_type == OBJECTIVE_BUILD_THE_BEST) + ft.Add(ObjectiveNames[scenario->ObjectiveType]); + if (scenario->ObjectiveType == OBJECTIVE_BUILD_THE_BEST) { StringId rideTypeString = STR_NONE; - auto rideTypeId = scenario->objective_arg_3; + auto rideTypeId = scenario->ObjectiveArg3; if (rideTypeId != RIDE_TYPE_NULL && rideTypeId < RIDE_TYPE_COUNT) { rideTypeString = GetRideTypeDescriptor(rideTypeId).Naming.Name; @@ -526,28 +526,28 @@ static void WindowScenarioselectPaint(WindowBase* w, DrawPixelInfo* dpi) } else { - ft.Add(scenario->objective_arg_3); - ft.Add(DateGetTotalMonths(MONTH_OCTOBER, scenario->objective_arg_1)); - if (scenario->objective_type == OBJECTIVE_FINISH_5_ROLLERCOASTERS) - ft.Add(scenario->objective_arg_2); + ft.Add(scenario->ObjectiveArg3); + ft.Add(DateGetTotalMonths(MONTH_OCTOBER, scenario->ObjectiveArg1)); + if (scenario->ObjectiveType == OBJECTIVE_FINISH_5_ROLLERCOASTERS) + ft.Add(scenario->ObjectiveArg2); else - ft.Add(scenario->objective_arg_2); + ft.Add(scenario->ObjectiveArg2); } screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_OBJECTIVE, ft) + 5; // Scenario score - if (scenario->highscore != nullptr) + if (scenario->Highscore != nullptr) { // TODO: Should probably be translatable const utf8* completedByName = "???"; - if (!String::IsNullOrEmpty(scenario->highscore->name)) + if (!String::IsNullOrEmpty(scenario->Highscore->name)) { - completedByName = scenario->highscore->name; + completedByName = scenario->Highscore->name; } ft = Formatter(); ft.Add(STR_STRING); ft.Add(completedByName); - ft.Add(scenario->highscore->company_value); + ft.Add(scenario->Highscore->company_value); screenPos.y += DrawTextWrapped(dpi, screenPos, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, ft); } } @@ -589,19 +589,19 @@ static void WindowScenarioselectScrollpaint(WindowBase* w, DrawPixelInfo* dpi, i case ListItemType::Scenario: { // Draw hover highlight - const scenario_index_entry* scenario = listItem.scenario.scenario; + const ScenarioIndexEntry* scenario = listItem.scenario.scenario; bool isHighlighted = w->highlighted_scenario == scenario; if (isHighlighted) { GfxFilterRect(dpi, { 0, y, w->width, y + scenarioItemHeight - 1 }, FilterPaletteID::PaletteDarken1); } - bool isCompleted = scenario->highscore != nullptr; + bool isCompleted = scenario->Highscore != nullptr; bool isDisabled = listItem.scenario.is_locked; // Draw scenario name char buffer[64]; - SafeStrCpy(buffer, scenario->name, sizeof(buffer)); + SafeStrCpy(buffer, scenario->Name, sizeof(buffer)); StringId format = isDisabled ? static_cast(STR_STRINGID) : (isHighlighted ? highlighted_format : unhighlighted_format); auto ft = Formatter(); @@ -624,9 +624,9 @@ static void WindowScenarioselectScrollpaint(WindowBase* w, DrawPixelInfo* dpi, i // Draw completion score const utf8* completedByName = "???"; - if (!String::IsNullOrEmpty(scenario->highscore->name)) + if (!String::IsNullOrEmpty(scenario->Highscore->name)) { - completedByName = scenario->highscore->name; + completedByName = scenario->Highscore->name; } SafeStrCpy(buffer, completedByName, 64); ft = Formatter(); @@ -698,20 +698,20 @@ static void InitialiseListItems(WindowBase* w) uint8_t currentHeading = UINT8_MAX; for (size_t i = 0; i < numScenarios; i++) { - const scenario_index_entry* scenario = ScenarioRepositoryGetByIndex(i); + const ScenarioIndexEntry* scenario = ScenarioRepositoryGetByIndex(i); if (!IsScenarioVisible(w, scenario)) continue; - if (_titleEditor && scenario->source_game == ScenarioSource::Other) + if (_titleEditor && scenario->SourceGame == ScenarioSource::Other) continue; // Category heading StringId headingStringId = STR_NONE; if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN || _titleEditor) { - if (w->selected_tab != static_cast(ScenarioSource::Real) && currentHeading != scenario->category) + if (w->selected_tab != static_cast(ScenarioSource::Real) && currentHeading != scenario->Category) { - currentHeading = scenario->category; + currentHeading = scenario->Category; headingStringId = ScenarioCategoryStringIds[currentHeading]; } } @@ -719,15 +719,15 @@ static void InitialiseListItems(WindowBase* w) { if (w->selected_tab <= SCENARIO_CATEGORY_EXPERT) { - if (currentHeading != static_cast(scenario->source_game)) + if (currentHeading != static_cast(scenario->SourceGame)) { - currentHeading = static_cast(scenario->source_game); + currentHeading = static_cast(scenario->SourceGame); headingStringId = ScenarioOriginStringIds[currentHeading]; } } else if (w->selected_tab == SCENARIO_CATEGORY_OTHER) { - int32_t category = scenario->category; + int32_t category = scenario->Category; if (category <= SCENARIO_CATEGORY_REAL) { category = SCENARIO_CATEGORY_OTHER; @@ -755,21 +755,21 @@ static void InitialiseListItems(WindowBase* w) if (IsLockingEnabled(w)) { scenarioItem.scenario.is_locked = numUnlocks <= 0; - if (scenario->highscore == nullptr) + if (scenario->Highscore == nullptr) { numUnlocks--; } else { // Mark RCT1 scenario as completed - if (scenario->sc_id < SC_MEGA_PARK) + if (scenario->ScenarioId < SC_MEGA_PARK) { - rct1CompletedScenarios |= 1 << scenario->sc_id; + rct1CompletedScenarios |= 1 << scenario->ScenarioId; } } // If scenario is Mega Park, keep a reference to it - if (scenario->sc_id == SC_MEGA_PARK) + if (scenario->ScenarioId == SC_MEGA_PARK) { megaParkListItemIndex = _listItems.size() - 1; } @@ -810,18 +810,18 @@ static void InitialiseListItems(WindowBase* w) } } -static bool IsScenarioVisible(WindowBase* w, const scenario_index_entry* scenario) +static bool IsScenarioVisible(WindowBase* w, const ScenarioIndexEntry* scenario) { if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN || _titleEditor) { - if (static_cast(scenario->source_game) != w->selected_tab) + if (static_cast(scenario->SourceGame) != w->selected_tab) { return false; } } else { - int32_t category = scenario->category; + int32_t category = scenario->Category; if (category > SCENARIO_CATEGORY_OTHER) { category = SCENARIO_CATEGORY_OTHER; diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index d50b86bd65..d36cfa56b0 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -554,8 +554,7 @@ namespace OpenRCT2 _drawingEngine = nullptr; } - bool LoadParkFromFile( - const std::string& path, bool loadTitleScreenOnFail = false, bool asScenario = false) final override + bool LoadParkFromFile(const u8string& path, bool loadTitleScreenOnFail = false, bool asScenario = false) final override { LOG_VERBOSE("Context::LoadParkFromFile(%s)", path.c_str()); diff --git a/src/openrct2/Context.h b/src/openrct2/Context.h index a8cdb4aaa5..3ae83bf2f8 100644 --- a/src/openrct2/Context.h +++ b/src/openrct2/Context.h @@ -151,7 +151,7 @@ namespace OpenRCT2 virtual void InitialiseDrawingEngine() abstract; virtual void DisposeDrawingEngine() abstract; virtual bool LoadParkFromFile( - const std::string& path, bool loadTitleScreenOnFail = false, bool asScenario = false) abstract; + const u8string& path, bool loadTitleScreenOnFail = false, bool asScenario = false) abstract; virtual bool LoadParkFromStream( IStream* stream, const std::string& path, bool loadTitleScreenFirstOnFail = false, bool asScenario = false) abstract; diff --git a/src/openrct2/ParkImporter.h b/src/openrct2/ParkImporter.h index 0eb0e34eee..897565f728 100644 --- a/src/openrct2/ParkImporter.h +++ b/src/openrct2/ParkImporter.h @@ -26,7 +26,7 @@ namespace OpenRCT2 struct IStream; } -struct scenario_index_entry; +struct ScenarioIndexEntry; struct ParkLoadResult final { @@ -50,14 +50,14 @@ struct IParkImporter public: virtual ~IParkImporter() = default; - virtual ParkLoadResult Load(const utf8* path) abstract; - virtual ParkLoadResult LoadSavedGame(const utf8* path, bool skipObjectCheck = false) abstract; - virtual ParkLoadResult LoadScenario(const utf8* path, bool skipObjectCheck = false) abstract; + virtual ParkLoadResult Load(const u8string& path) abstract; + virtual ParkLoadResult LoadSavedGame(const u8string& path, bool skipObjectCheck = false) abstract; + virtual ParkLoadResult LoadScenario(const u8string& path, bool skipObjectCheck = false) abstract; virtual ParkLoadResult LoadFromStream( - OpenRCT2::IStream* stream, bool isScenario, bool skipObjectCheck = false, const utf8* path = String::Empty) abstract; + OpenRCT2::IStream* stream, bool isScenario, bool skipObjectCheck = false, const u8string& path = {}) abstract; virtual void Import() abstract; - virtual bool GetDetails(scenario_index_entry* dst) abstract; + virtual bool GetDetails(ScenarioIndexEntry* dst) abstract; }; namespace ParkImporter diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 824df28ad0..2102c62530 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -30,7 +30,7 @@ struct DrawPixelInfo; struct WindowBase; struct TrackDesignFileRef; struct TextInputSession; -struct scenario_index_entry; +struct ScenarioIndexEntry; struct WindowCloseModifier; enum class VisibilityCache : uint8_t; diff --git a/src/openrct2/interface/Window_internal.h b/src/openrct2/interface/Window_internal.h index e17e1b2019..92d8827a27 100644 --- a/src/openrct2/interface/Window_internal.h +++ b/src/openrct2/interface/Window_internal.h @@ -85,7 +85,7 @@ struct WindowBase union { uint16_t ride_colour; - const scenario_index_entry* highlighted_scenario; + const ScenarioIndexEntry* highlighted_scenario; }; int16_t selected_tab{}; int16_t var_4AE{}; diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 181304caf7..840242ea2d 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -687,18 +687,18 @@ std::unique_ptr ObjectRepositoryLoadObject(const RCTObjectEntry* objectE return object; } -void ScenarioTranslate(scenario_index_entry* scenarioEntry) +void ScenarioTranslate(ScenarioIndexEntry* scenarioEntry) { StringId localisedStringIds[3]; - if (LanguageGetLocalisedScenarioStrings(scenarioEntry->name, localisedStringIds)) + if (LanguageGetLocalisedScenarioStrings(scenarioEntry->Name, localisedStringIds)) { if (localisedStringIds[0] != STR_NONE) { - String::Set(scenarioEntry->name, sizeof(scenarioEntry->name), LanguageGetString(localisedStringIds[0])); + String::Set(scenarioEntry->Name, sizeof(scenarioEntry->Name), LanguageGetString(localisedStringIds[0])); } if (localisedStringIds[2] != STR_NONE) { - String::Set(scenarioEntry->details, sizeof(scenarioEntry->details), LanguageGetString(localisedStringIds[2])); + String::Set(scenarioEntry->Details, sizeof(scenarioEntry->Details), LanguageGetString(localisedStringIds[2])); } } } diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 124126e6c1..5799d3a1fd 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -201,31 +201,31 @@ namespace OpenRCT2 Save(fs); } - scenario_index_entry ReadScenarioChunk() + ScenarioIndexEntry ReadScenarioChunk() { - scenario_index_entry entry{}; + ScenarioIndexEntry entry{}; auto& os = *_os; os.ReadWriteChunk(ParkFileChunkType::SCENARIO, [&entry](OrcaStream::ChunkStream& cs) { - entry.category = cs.Read(); + entry.Category = cs.Read(); std::string name; ReadWriteStringTable(cs, name, "en-GB"); - String::Set(entry.name, sizeof(entry.name), name.c_str()); - String::Set(entry.internal_name, sizeof(entry.internal_name), name.c_str()); + String::Set(entry.Name, sizeof(entry.Name), name.c_str()); + String::Set(entry.InternalName, sizeof(entry.InternalName), name.c_str()); std::string parkName; ReadWriteStringTable(cs, parkName, "en-GB"); std::string scenarioDetails; ReadWriteStringTable(cs, scenarioDetails, "en-GB"); - String::Set(entry.details, sizeof(entry.details), scenarioDetails.c_str()); + String::Set(entry.Details, sizeof(entry.Details), scenarioDetails.c_str()); - entry.objective_type = cs.Read(); - entry.objective_arg_1 = cs.Read(); - entry.objective_arg_3 = cs.Read(); - entry.objective_arg_2 = cs.Read(); + entry.ObjectiveType = cs.Read(); + entry.ObjectiveArg1 = cs.Read(); + entry.ObjectiveArg3 = cs.Read(); + entry.ObjectiveArg2 = cs.Read(); - entry.source_game = ScenarioSource::Other; + entry.SourceGame = ScenarioSource::Other; }); return entry; } @@ -2417,7 +2417,7 @@ public: { } - ParkLoadResult Load(const utf8* path) override + ParkLoadResult Load(const u8string& path) override { _parkFile = std::make_unique(); _parkFile->Load(path); @@ -2427,18 +2427,18 @@ public: return result; } - ParkLoadResult LoadSavedGame(const utf8* path, bool skipObjectCheck = false) override + ParkLoadResult LoadSavedGame(const u8string& path, bool skipObjectCheck = false) override { return Load(path); } - ParkLoadResult LoadScenario(const utf8* path, bool skipObjectCheck = false) override + ParkLoadResult LoadScenario(const u8string& path, bool skipObjectCheck = false) override { return Load(path); } ParkLoadResult LoadFromStream( - OpenRCT2::IStream* stream, bool isScenario, bool skipObjectCheck = false, const utf8* path = String::Empty) override + OpenRCT2::IStream* stream, bool isScenario, bool skipObjectCheck = false, const u8string& path = {}) override { _parkFile = std::make_unique(); _parkFile->Load(*stream); @@ -2455,7 +2455,7 @@ public: GameFixSaveVars(); } - bool GetDetails(scenario_index_entry* dst) override + bool GetDetails(ScenarioIndexEntry* dst) override { *dst = _parkFile->ReadScenarioChunk(); return true; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 78e82ba4af..ce26964202 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -127,7 +127,7 @@ namespace RCT1 IScenarioRepository* _scenarioRepository = GetScenarioRepository(); public: - ParkLoadResult Load(const utf8* path) override + ParkLoadResult Load(const u8string& path) override { const auto extension = Path::GetExtension(path); if (String::Equals(extension, ".sc4", true)) @@ -142,14 +142,14 @@ namespace RCT1 throw std::runtime_error("Invalid RCT1 park extension."); } - ParkLoadResult LoadSavedGame(const utf8* path, bool skipObjectCheck = false) override + ParkLoadResult LoadSavedGame(const u8string& path, bool skipObjectCheck = false) override { auto fs = FileStream(path, FILE_MODE_OPEN); auto result = LoadFromStream(&fs, false, skipObjectCheck, path); return result; } - ParkLoadResult LoadScenario(const utf8* path, bool skipObjectCheck = false) override + ParkLoadResult LoadScenario(const u8string& path, bool skipObjectCheck = false) override { auto fs = FileStream(path, FILE_MODE_OPEN); auto result = LoadFromStream(&fs, true, skipObjectCheck, path); @@ -157,7 +157,7 @@ namespace RCT1 } ParkLoadResult LoadFromStream( - IStream* stream, bool isScenario, [[maybe_unused]] bool skipObjectCheck, const utf8* path) override + IStream* stream, bool isScenario, [[maybe_unused]] bool skipObjectCheck, const u8string& path) override { _s4 = *ReadAndDecodeS4(stream, isScenario); _s4Path = path; @@ -202,7 +202,7 @@ namespace RCT1 RestrictAllMiscScenery(); } - bool GetDetails(scenario_index_entry* dst) override + bool GetDetails(ScenarioIndexEntry* dst) override { *dst = {}; @@ -210,23 +210,23 @@ namespace RCT1 // If no entry is found, this is a custom scenario. bool isOfficial = ScenarioSources::TryGetById(_s4.ScenarioSlotIndex, &desc); - dst->category = desc.category; - dst->source_game = ScenarioSource{ desc.source }; - dst->source_index = desc.index; - dst->sc_id = desc.id; + dst->Category = desc.category; + dst->SourceGame = ScenarioSource{ desc.source }; + dst->SourceIndex = desc.index; + dst->ScenarioId = desc.id; - dst->objective_type = _s4.ScenarioObjectiveType; - dst->objective_arg_1 = _s4.ScenarioObjectiveYears; + dst->ObjectiveType = _s4.ScenarioObjectiveType; + dst->ObjectiveArg1 = _s4.ScenarioObjectiveYears; // RCT1 used another way of calculating park value. if (_s4.ScenarioObjectiveType == OBJECTIVE_PARK_VALUE_BY) - dst->objective_arg_2 = CorrectRCT1ParkValue(_s4.ScenarioObjectiveCurrency); + dst->ObjectiveArg2 = CorrectRCT1ParkValue(_s4.ScenarioObjectiveCurrency); else - dst->objective_arg_2 = _s4.ScenarioObjectiveCurrency; - dst->objective_arg_3 = _s4.ScenarioObjectiveNumGuests; + dst->ObjectiveArg2 = _s4.ScenarioObjectiveCurrency; + dst->ObjectiveArg3 = _s4.ScenarioObjectiveNumGuests; // This does not seem to be saved in the objective arguments, so look up the ID from the available rides instead. if (_s4.ScenarioObjectiveType == OBJECTIVE_BUILD_THE_BEST) { - dst->objective_arg_3 = GetBuildTheBestRideId(); + dst->ObjectiveArg3 = GetBuildTheBestRideId(); } auto name = RCT2StringToUTF8(_s4.ScenarioName, RCT2LanguageId::EnglishUK); @@ -239,7 +239,7 @@ namespace RCT1 desc.title = name.c_str(); } - String::Set(dst->internal_name, sizeof(dst->internal_name), desc.title); + String::Set(dst->InternalName, sizeof(dst->InternalName), desc.title); StringId localisedStringIds[3]; if (LanguageGetLocalisedScenarioStrings(desc.title, localisedStringIds)) @@ -254,8 +254,8 @@ namespace RCT1 } } - String::Set(dst->name, sizeof(dst->name), name.c_str()); - String::Set(dst->details, sizeof(dst->details), details.c_str()); + String::Set(dst->Name, sizeof(dst->Name), name.c_str()); + String::Set(dst->Details, sizeof(dst->Details), details.c_str()); return true; } @@ -333,13 +333,13 @@ namespace RCT1 std::string GetRCT1ScenarioName() { - const scenario_index_entry* scenarioEntry = _scenarioRepository->GetByInternalName(_s4.ScenarioName); + const ScenarioIndexEntry* scenarioEntry = _scenarioRepository->GetByInternalName(_s4.ScenarioName); if (scenarioEntry == nullptr) { return ""; } - return Path::GetFileName(scenarioEntry->path); + return Path::GetFileName(scenarioEntry->Path); } void InitialiseEntryMaps() diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index e55ba8b4a1..945ab8c109 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -89,7 +89,7 @@ namespace RCT2 private: IObjectRepository& _objectRepository; - const utf8* _s6Path = nullptr; + u8string _s6Path; S6Data _s6{}; uint8_t _gameVersion = 0; bool _isSV7 = false; @@ -107,7 +107,7 @@ namespace RCT2 { } - ParkLoadResult Load(const utf8* path) override + ParkLoadResult Load(const u8string& path) override { const auto extension = Path::GetExtension(path); if (String::Equals(extension, ".sc6", true)) @@ -122,7 +122,7 @@ namespace RCT2 throw std::runtime_error("Invalid RCT2 park extension."); } - ParkLoadResult LoadSavedGame(const utf8* path, bool skipObjectCheck = false) override + ParkLoadResult LoadSavedGame(const u8string& path, bool skipObjectCheck = false) override { auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN); auto result = LoadFromStream(&fs, false, skipObjectCheck); @@ -130,7 +130,7 @@ namespace RCT2 return result; } - ParkLoadResult LoadScenario(const utf8* path, bool skipObjectCheck = false) override + ParkLoadResult LoadScenario(const u8string& path, bool skipObjectCheck = false) override { auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN); auto result = LoadFromStream(&fs, true, skipObjectCheck); @@ -140,7 +140,7 @@ namespace RCT2 ParkLoadResult LoadFromStream( OpenRCT2::IStream* stream, bool isScenario, [[maybe_unused]] bool skipObjectCheck = false, - const utf8* path = String::Empty) override + const u8string& path = {}) override { auto chunkReader = SawyerChunkReader(stream); chunkReader.ReadChunk(&_s6.Header, sizeof(_s6.Header)); @@ -169,7 +169,7 @@ namespace RCT2 _objectRepository.ExportPackedObject(stream); } - if (path) + if (!path.empty()) { auto extension = Path::GetExtension(path); _isSV7 = _stricmp(extension.c_str(), ".sv7") == 0; @@ -219,7 +219,7 @@ namespace RCT2 stream.Read(&_s6.EntityListsHead, postEntitiesSize); } - bool GetDetails(scenario_index_entry* dst) override + bool GetDetails(ScenarioIndexEntry* dst) override { *dst = {}; return false; diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index 2b97665144..9c25b568cf 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -55,60 +55,60 @@ static int32_t ScenarioCategoryCompare(int32_t categoryA, int32_t categoryB) return 1; } -static int32_t ScenarioIndexEntryCompareByCategory(const scenario_index_entry& entryA, const scenario_index_entry& entryB) +static int32_t ScenarioIndexEntryCompareByCategory(const ScenarioIndexEntry& entryA, const ScenarioIndexEntry& entryB) { // Order by category - if (entryA.category != entryB.category) + if (entryA.Category != entryB.Category) { - return ScenarioCategoryCompare(entryA.category, entryB.category); + return ScenarioCategoryCompare(entryA.Category, entryB.Category); } // Then by source game / name - switch (entryA.category) + switch (entryA.Category) { default: - if (entryA.source_game != entryB.source_game) + if (entryA.SourceGame != entryB.SourceGame) { - return static_cast(entryA.source_game) - static_cast(entryB.source_game); + return static_cast(entryA.SourceGame) - static_cast(entryB.SourceGame); } - return strcmp(entryA.name, entryB.name); + return strcmp(entryA.Name, entryB.Name); case SCENARIO_CATEGORY_REAL: case SCENARIO_CATEGORY_OTHER: - return strcmp(entryA.name, entryB.name); + return strcmp(entryA.Name, entryB.Name); } } -static int32_t ScenarioIndexEntryCompareByIndex(const scenario_index_entry& entryA, const scenario_index_entry& entryB) +static int32_t ScenarioIndexEntryCompareByIndex(const ScenarioIndexEntry& entryA, const ScenarioIndexEntry& entryB) { // Order by source game - if (entryA.source_game != entryB.source_game) + if (entryA.SourceGame != entryB.SourceGame) { - return static_cast(entryA.source_game) - static_cast(entryB.source_game); + return static_cast(entryA.SourceGame) - static_cast(entryB.SourceGame); } // Then by index / category / name - ScenarioSource sourceGame = ScenarioSource{ entryA.source_game }; + ScenarioSource sourceGame = ScenarioSource{ entryA.SourceGame }; switch (sourceGame) { default: - if (entryA.source_index == -1 && entryB.source_index == -1) + if (entryA.SourceIndex == -1 && entryB.SourceIndex == -1) { - if (entryA.category == entryB.category) + if (entryA.Category == entryB.Category) { return ScenarioIndexEntryCompareByCategory(entryA, entryB); } - return ScenarioCategoryCompare(entryA.category, entryB.category); + return ScenarioCategoryCompare(entryA.Category, entryB.Category); } - if (entryA.source_index == -1) + if (entryA.SourceIndex == -1) { return 1; } - if (entryB.source_index == -1) + if (entryB.SourceIndex == -1) { return -1; } - return entryA.source_index - entryB.source_index; + return entryA.SourceIndex - entryB.SourceIndex; case ScenarioSource::Real: return ScenarioIndexEntryCompareByCategory(entryA, entryB); @@ -122,7 +122,7 @@ static void ScenarioHighscoreFree(ScenarioHighscoreEntry* highscore) SafeDelete(highscore); } -class ScenarioFileIndex final : public FileIndex +class ScenarioFileIndex final : public FileIndex { private: static constexpr uint32_t MAGIC_NUMBER = 0x58444953; // SIDX @@ -142,9 +142,9 @@ public: } protected: - std::optional Create(int32_t, const std::string& path) const override + std::optional Create(int32_t, const std::string& path) const override { - scenario_index_entry entry; + ScenarioIndexEntry entry; auto timestamp = File::GetLastModified(path); if (GetScenarioInfo(path, timestamp, &entry)) { @@ -154,22 +154,22 @@ protected: return std::nullopt; } - void Serialise(DataSerialiser& ds, const scenario_index_entry& item) const override + void Serialise(DataSerialiser& ds, const ScenarioIndexEntry& item) const override { - ds << item.path; - ds << item.timestamp; - ds << item.category; - ds << item.source_game; - ds << item.source_index; - ds << item.sc_id; - ds << item.objective_type; - ds << item.objective_arg_1; - ds << item.objective_arg_2; - ds << item.objective_arg_3; + ds << item.Path; + ds << item.Timestamp; + ds << item.Category; + ds << item.SourceGame; + ds << item.SourceIndex; + ds << item.ScenarioId; + ds << item.ObjectiveType; + ds << item.ObjectiveArg1; + ds << item.ObjectiveArg2; + ds << item.ObjectiveArg3; - ds << item.internal_name; - ds << item.name; - ds << item.details; + ds << item.InternalName; + ds << item.Name; + ds << item.Details; } private: @@ -192,7 +192,7 @@ private: /** * Reads basic information from a scenario file. */ - static bool GetScenarioInfo(const std::string& path, uint64_t timestamp, scenario_index_entry* entry) + static bool GetScenarioInfo(const std::string& path, uint64_t timestamp, ScenarioIndexEntry* entry) { LOG_VERBOSE("GetScenarioInfo(%s, %d, ...)", path.c_str(), timestamp); try @@ -209,8 +209,8 @@ private: importer->LoadScenario(path.c_str(), true); if (importer->GetDetails(entry)) { - String::Set(entry->path, sizeof(entry->path), path.c_str()); - entry->timestamp = timestamp; + String::Set(entry->Path, sizeof(entry->Path), path.c_str()); + entry->Timestamp = timestamp; result = true; } } @@ -230,8 +230,8 @@ private: s4Importer->LoadScenario(path.c_str(), true); if (s4Importer->GetDetails(entry)) { - String::Set(entry->path, sizeof(entry->path), path.c_str()); - entry->timestamp = timestamp; + String::Set(entry->Path, sizeof(entry->Path), path.c_str()); + entry->Timestamp = timestamp; result = true; } } @@ -270,56 +270,56 @@ private: return false; } - static scenario_index_entry CreateNewScenarioEntry(const std::string& path, uint64_t timestamp, RCT2::S6Info* s6Info) + static ScenarioIndexEntry CreateNewScenarioEntry(const std::string& path, uint64_t timestamp, RCT2::S6Info* s6Info) { - scenario_index_entry entry = {}; + ScenarioIndexEntry entry = {}; // Set new entry - String::Set(entry.path, sizeof(entry.path), path.c_str()); - entry.timestamp = timestamp; - entry.category = s6Info->Category; - entry.objective_type = s6Info->ObjectiveType; - entry.objective_arg_1 = s6Info->ObjectiveArg1; - entry.objective_arg_2 = s6Info->ObjectiveArg2; - entry.objective_arg_3 = s6Info->ObjectiveArg3; - entry.highscore = nullptr; + String::Set(entry.Path, sizeof(entry.Path), path.c_str()); + entry.Timestamp = timestamp; + entry.Category = s6Info->Category; + entry.ObjectiveType = s6Info->ObjectiveType; + entry.ObjectiveArg1 = s6Info->ObjectiveArg1; + entry.ObjectiveArg2 = s6Info->ObjectiveArg2; + entry.ObjectiveArg3 = s6Info->ObjectiveArg3; + entry.Highscore = nullptr; if (String::IsNullOrEmpty(s6Info->Name)) { // If the scenario doesn't have a name, set it to the filename - String::Set(entry.name, sizeof(entry.name), Path::GetFileNameWithoutExtension(entry.path).c_str()); + String::Set(entry.Name, sizeof(entry.Name), Path::GetFileNameWithoutExtension(entry.Path).c_str()); } else { - String::Set(entry.name, sizeof(entry.name), s6Info->Name); + String::Set(entry.Name, sizeof(entry.Name), s6Info->Name); // Normalise the name to make the scenario as recognisable as possible. - ScenarioSources::NormaliseName(entry.name, sizeof(entry.name), entry.name); + ScenarioSources::NormaliseName(entry.Name, sizeof(entry.Name), entry.Name); } // entry.name will be translated later so keep the untranslated name here - String::Set(entry.internal_name, sizeof(entry.internal_name), entry.name); + String::Set(entry.InternalName, sizeof(entry.InternalName), entry.Name); - String::Set(entry.details, sizeof(entry.details), s6Info->Details); + String::Set(entry.Details, sizeof(entry.Details), s6Info->Details); // Look up and store information regarding the origins of this scenario. SourceDescriptor desc; - if (ScenarioSources::TryGetByName(entry.name, &desc)) + if (ScenarioSources::TryGetByName(entry.Name, &desc)) { - entry.sc_id = desc.id; - entry.source_index = desc.index; - entry.source_game = ScenarioSource{ desc.source }; - entry.category = desc.category; + entry.ScenarioId = desc.id; + entry.SourceIndex = desc.index; + entry.SourceGame = ScenarioSource{ desc.source }; + entry.Category = desc.category; } else { - entry.sc_id = SC_UNIDENTIFIED; - entry.source_index = -1; - if (entry.category == SCENARIO_CATEGORY_REAL) + entry.ScenarioId = SC_UNIDENTIFIED; + entry.SourceIndex = -1; + if (entry.Category == SCENARIO_CATEGORY_REAL) { - entry.source_game = ScenarioSource::Real; + entry.SourceGame = ScenarioSource::Real; } else { - entry.source_game = ScenarioSource::Other; + entry.SourceGame = ScenarioSource::Other; } } @@ -335,7 +335,7 @@ private: std::shared_ptr const _env; ScenarioFileIndex const _fileIndex; - std::vector _scenarios; + std::vector _scenarios; std::vector _highscores; public: @@ -374,9 +374,9 @@ public: return _scenarios.size(); } - const scenario_index_entry* GetByIndex(size_t index) const override + const ScenarioIndexEntry* GetByIndex(size_t index) const override { - const scenario_index_entry* result = nullptr; + const ScenarioIndexEntry* result = nullptr; if (index < _scenarios.size()) { result = &_scenarios[index]; @@ -384,11 +384,11 @@ public: return result; } - const scenario_index_entry* GetByFilename(u8string_view filename) const override + const ScenarioIndexEntry* GetByFilename(u8string_view filename) const override { for (const auto& scenario : _scenarios) { - const auto scenarioFilename = Path::GetFileName(scenario.path); + const auto scenarioFilename = Path::GetFileName(scenario.Path); // Note: this is always case insensitive search for cross platform consistency if (String::Equals(filename, scenarioFilename, true)) @@ -399,17 +399,17 @@ public: return nullptr; } - const scenario_index_entry* GetByInternalName(const utf8* name) const override + const ScenarioIndexEntry* GetByInternalName(const utf8* name) const override { for (size_t i = 0; i < _scenarios.size(); i++) { - const scenario_index_entry* scenario = &_scenarios[i]; + const ScenarioIndexEntry* scenario = &_scenarios[i]; - if (scenario->source_game == ScenarioSource::Other && scenario->sc_id == SC_UNIDENTIFIED) + if (scenario->SourceGame == ScenarioSource::Other && scenario->ScenarioId == SC_UNIDENTIFIED) continue; // Note: this is always case insensitive search for cross platform consistency - if (String::Equals(name, scenario->internal_name, true)) + if (String::Equals(name, scenario->InternalName, true)) { return &_scenarios[i]; } @@ -417,11 +417,11 @@ public: return nullptr; } - const scenario_index_entry* GetByPath(const utf8* path) const override + const ScenarioIndexEntry* GetByPath(const utf8* path) const override { for (const auto& scenario : _scenarios) { - if (Path::Equals(path, scenario.path)) + if (Path::Equals(path, scenario.Path)) { return &scenario; } @@ -435,7 +435,7 @@ public: // not getting recorded, see #4951. Scan(language); - scenario_index_entry* scenario = GetByFilename(scenarioFileName); + ScenarioIndexEntry* scenario = GetByFilename(scenarioFileName); // Check if this is an RCTC scenario that corresponds to a known RCT1/2 scenario or vice versa, see #12626 if (scenario == nullptr) @@ -458,7 +458,7 @@ public: if (scenario != nullptr) { // Check if record company value has been broken or the highscore is the same but no name is registered - ScenarioHighscoreEntry* highscore = scenario->highscore; + ScenarioHighscoreEntry* highscore = scenario->Highscore; if (highscore == nullptr || companyValue > highscore->company_value || (String::IsNullOrEmpty(highscore->name) && companyValue == highscore->company_value)) { @@ -466,7 +466,7 @@ public: { highscore = InsertHighscore(); highscore->timestamp = Platform::GetDatetimeNowUTC(); - scenario->highscore = highscore; + scenario->Highscore = highscore; } else { @@ -477,7 +477,7 @@ public: SafeFree(highscore->fileName); SafeFree(highscore->name); } - highscore->fileName = String::Duplicate(Path::GetFileName(scenario->path)); + highscore->fileName = String::Duplicate(Path::GetFileName(scenario->Path)); highscore->name = String::Duplicate(name); highscore->company_value = companyValue; SaveHighscores(); @@ -488,16 +488,16 @@ public: } private: - scenario_index_entry* GetByFilename(const utf8* filename) + ScenarioIndexEntry* GetByFilename(const utf8* filename) { const ScenarioRepository* repo = this; - return const_cast(repo->GetByFilename(filename)); + return const_cast(repo->GetByFilename(filename)); } - scenario_index_entry* GetByPath(const utf8* path) + ScenarioIndexEntry* GetByPath(const utf8* path) { const ScenarioRepository* repo = this; - return const_cast(repo->GetByPath(path)); + return const_cast(repo->GetByPath(path)); } /** @@ -540,9 +540,9 @@ private: File::WriteAllBytes(dstPath, mpdat.data(), mpdat.size()); } - void AddScenario(const scenario_index_entry& entry) + void AddScenario(const ScenarioIndexEntry& entry) { - auto filename = Path::GetFileName(entry.path); + auto filename = Path::GetFileName(entry.Path); if (!String::Equals(filename, "")) { @@ -550,10 +550,10 @@ private: if (existingEntry != nullptr) { std::string conflictPath; - if (existingEntry->timestamp > entry.timestamp) + if (existingEntry->Timestamp > entry.Timestamp) { // Existing entry is more recent - conflictPath = String::ToStd(existingEntry->path); + conflictPath = String::ToStd(existingEntry->Path); // Overwrite existing entry with this one *existingEntry = entry; @@ -561,7 +561,7 @@ private: else { // This entry is more recent - conflictPath = entry.path; + conflictPath = entry.Path; } Console::WriteLine("Scenario conflict: '%s' ignored because it is newer.", conflictPath.c_str()); } @@ -581,14 +581,14 @@ private: if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN) { std::sort( - _scenarios.begin(), _scenarios.end(), [](const scenario_index_entry& a, const scenario_index_entry& b) -> bool { + _scenarios.begin(), _scenarios.end(), [](const ScenarioIndexEntry& a, const ScenarioIndexEntry& b) -> bool { return ScenarioIndexEntryCompareByIndex(a, b) < 0; }); } else { std::sort( - _scenarios.begin(), _scenarios.end(), [](const scenario_index_entry& a, const scenario_index_entry& b) -> bool { + _scenarios.begin(), _scenarios.end(), [](const ScenarioIndexEntry& a, const ScenarioIndexEntry& b) -> bool { return ScenarioIndexEntryCompareByCategory(a, b) < 0; }); } @@ -732,10 +732,10 @@ private: { for (auto& highscore : _highscores) { - scenario_index_entry* scenario = GetByFilename(highscore->fileName); + ScenarioIndexEntry* scenario = GetByFilename(highscore->fileName); if (scenario != nullptr) { - scenario->highscore = highscore; + scenario->Highscore = highscore; } } } @@ -786,7 +786,7 @@ size_t ScenarioRepositoryGetCount() return repo->GetCount(); } -const scenario_index_entry* ScenarioRepositoryGetByIndex(size_t index) +const ScenarioIndexEntry* ScenarioRepositoryGetByIndex(size_t index) { IScenarioRepository* repo = GetScenarioRepository(); return repo->GetByIndex(index); diff --git a/src/openrct2/scenario/ScenarioRepository.h b/src/openrct2/scenario/ScenarioRepository.h index de4221ab63..d55c49d643 100644 --- a/src/openrct2/scenario/ScenarioRepository.h +++ b/src/openrct2/scenario/ScenarioRepository.h @@ -1,3 +1,4 @@ + /***************************************************************************** * Copyright (c) 2014-2023 OpenRCT2 developers * @@ -38,27 +39,27 @@ enum class ScenarioSource : uint8_t Other }; -struct scenario_index_entry +struct ScenarioIndexEntry { - utf8 path[MAX_PATH]; - uint64_t timestamp; + utf8 Path[MAX_PATH]; + uint64_t Timestamp; // Category / sequence - uint8_t category; - ScenarioSource source_game; - int16_t source_index = -1; - uint16_t sc_id; + uint8_t Category; + ScenarioSource SourceGame; + int16_t SourceIndex = -1; + uint16_t ScenarioId; // Objective - uint8_t objective_type; - uint8_t objective_arg_1; - int64_t objective_arg_2; - int16_t objective_arg_3; - ScenarioHighscoreEntry* highscore = nullptr; + uint8_t ObjectiveType; + uint8_t ObjectiveArg1; + int64_t ObjectiveArg2; + int16_t ObjectiveArg3; + ScenarioHighscoreEntry* Highscore = nullptr; - utf8 internal_name[64]; // Untranslated name - utf8 name[64]; // Translated name - utf8 details[256]; + utf8 InternalName[64]; // Untranslated name + utf8 Name[64]; // Translated name + utf8 Details[256]; }; namespace OpenRCT2 @@ -76,13 +77,13 @@ struct IScenarioRepository virtual void Scan(int32_t language) abstract; virtual size_t GetCount() const abstract; - virtual const scenario_index_entry* GetByIndex(size_t index) const abstract; - virtual const scenario_index_entry* GetByFilename(u8string_view filename) const abstract; + virtual const ScenarioIndexEntry* GetByIndex(size_t index) const abstract; + virtual const ScenarioIndexEntry* GetByFilename(u8string_view filename) const abstract; /** * Does not return custom scenarios due to the fact that they may have the same name. */ - virtual const scenario_index_entry* GetByInternalName(const utf8* name) const abstract; - virtual const scenario_index_entry* GetByPath(const utf8* path) const abstract; + virtual const ScenarioIndexEntry* GetByInternalName(const utf8* name) const abstract; + virtual const ScenarioIndexEntry* GetByPath(const utf8* path) const abstract; virtual bool TryRecordHighscore( int32_t language, const utf8* scenarioFileName, money64 companyValue, const utf8* name) abstract; @@ -94,6 +95,6 @@ struct IScenarioRepository void ScenarioRepositoryScan(); [[nodiscard]] size_t ScenarioRepositoryGetCount(); -[[nodiscard]] const scenario_index_entry* ScenarioRepositoryGetByIndex(size_t index); +[[nodiscard]] const ScenarioIndexEntry* ScenarioRepositoryGetByIndex(size_t index); [[nodiscard]] bool ScenarioRepositoryTryRecordHighscore(const utf8* scenarioFileName, money64 companyValue, const utf8* name); -void ScenarioTranslate(scenario_index_entry* scenarioEntry); +void ScenarioTranslate(ScenarioIndexEntry* scenarioEntry); diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 5e448d0922..e3fe69a343 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -239,7 +239,7 @@ void TitleScreen::TitleInitialise() for (size_t s = 0; s < scenarioCount; s++) { - const ScenarioSource sourceGame = ScenarioRepositoryGetByIndex(s)->source_game; + const ScenarioSource sourceGame = ScenarioRepositoryGetByIndex(s)->SourceGame; switch (sourceGame) { case ScenarioSource::RCT1: