diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 2cda11bd12..3f06c203e2 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -1090,7 +1090,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf y += 12; // Draw object source - stringId = object_manager_get_source_game_string(listItem->repositoryItem->Sources[0]); + stringId = object_manager_get_source_game_string(listItem->repositoryItem->GetFirstSourceGame()); gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, w->x + w->width - 5, y); y += 12; diff --git a/src/openrct2/object/BannerObject.cpp b/src/openrct2/object/BannerObject.cpp index 5db9948819..a10e1c6a70 100644 --- a/src/openrct2/object/BannerObject.cpp +++ b/src/openrct2/object/BannerObject.cpp @@ -47,7 +47,7 @@ void BannerObject::ReadLegacy(IReadObjectContext* context, IStream* stream) auto item = objectRepository.FindObject(identifier); if (item != nullptr) { - auto sourceGame = item->Sources[0]; + auto sourceGame = item->GetFirstSourceGame(); if (sourceGame == OBJECT_SOURCE_WACKY_WORLDS || sourceGame == OBJECT_SOURCE_TIME_TWISTER || sourceGame == OBJECT_SOURCE_CUSTOM) diff --git a/src/openrct2/object/FootpathItemObject.cpp b/src/openrct2/object/FootpathItemObject.cpp index 8274735fa4..96809bf306 100644 --- a/src/openrct2/object/FootpathItemObject.cpp +++ b/src/openrct2/object/FootpathItemObject.cpp @@ -51,7 +51,7 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext* context, IStream* stream auto item = objectRepository.FindObject(identifier); if (item != nullptr) { - auto sourceGame = item->Sources[0]; + auto sourceGame = item->GetFirstSourceGame(); if (sourceGame == OBJECT_SOURCE_WACKY_WORLDS || sourceGame == OBJECT_SOURCE_TIME_TWISTER || sourceGame == OBJECT_SOURCE_CUSTOM) { diff --git a/src/openrct2/object/ObjectRepository.h b/src/openrct2/object/ObjectRepository.h index 5317c43da6..f358995568 100644 --- a/src/openrct2/object/ObjectRepository.h +++ b/src/openrct2/object/ObjectRepository.h @@ -49,6 +49,14 @@ struct ObjectRepositoryItem { std::vector Entries; } SceneryGroupInfo; + + OBJECT_SOURCE_GAME GetFirstSourceGame() const + { + if (Sources.empty()) + return OBJECT_SOURCE_CUSTOM; + else + return (OBJECT_SOURCE_GAME)Sources[0]; + } }; interface IObjectRepository