diff --git a/src/openrct2/object/BannerObject.cpp b/src/openrct2/object/BannerObject.cpp index 873b33504e..5118dfa346 100644 --- a/src/openrct2/object/BannerObject.cpp +++ b/src/openrct2/object/BannerObject.cpp @@ -44,18 +44,11 @@ namespace OpenRCT2 // Add banners to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab. // Since this is already done the other way round for original items, avoid adding those to prevent duplicates. - - auto& objectRepository = context->GetObjectRepository(); - auto item = objectRepository.FindObject(GetDescriptor()); - if (item != nullptr) + auto firstSourceGame = GetFirstSourceGame(); + if (firstSourceGame == ObjectSourceGame::Custom) { - auto sourceGame = item->GetFirstSourceGame(); - if (sourceGame == ObjectSourceGame::WackyWorlds || sourceGame == ObjectSourceGame::TimeTwister - || sourceGame == ObjectSourceGame::Custom) - { - auto scgPathX = Object::GetScgPathXHeader(); - SetPrimarySceneryGroup(scgPathX); - } + auto scgPathX = Object::GetScgPathXHeader(); + SetPrimarySceneryGroup(scgPathX); } } diff --git a/src/openrct2/object/Object.cpp b/src/openrct2/object/Object.cpp index 0707764277..b4cac59e9b 100644 --- a/src/openrct2/object/Object.cpp +++ b/src/openrct2/object/Object.cpp @@ -192,6 +192,14 @@ namespace OpenRCT2 return _sourceGames; } + ObjectSourceGame Object::GetFirstSourceGame() const + { + if (_sourceGames.size() == 0) + return ObjectSourceGame::Custom; + + return _sourceGames[0]; + } + void Object::SetSourceGames(const std::vector& sourceGames) { _sourceGames = sourceGames; diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 1143a8f42f..d8f7e5f238 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -304,6 +304,7 @@ namespace OpenRCT2 { } std::vector GetSourceGames(); + ObjectSourceGame GetFirstSourceGame() const; void SetSourceGames(const std::vector& sourceGames); const std::vector& GetAuthors() const; diff --git a/src/openrct2/object/PathAdditionObject.cpp b/src/openrct2/object/PathAdditionObject.cpp index 24f0e6c78d..144d00c1d2 100644 --- a/src/openrct2/object/PathAdditionObject.cpp +++ b/src/openrct2/object/PathAdditionObject.cpp @@ -47,18 +47,11 @@ namespace OpenRCT2 // Add path additions to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab. // Since this is already done the other way round for original items, avoid adding those to prevent duplicates. - - auto& objectRepository = context->GetObjectRepository(); - auto item = objectRepository.FindObject(GetDescriptor()); - if (item != nullptr) + auto firstSourceGame = GetFirstSourceGame(); + if (firstSourceGame == ObjectSourceGame::Custom) { - auto sourceGame = item->GetFirstSourceGame(); - if (sourceGame == ObjectSourceGame::WackyWorlds || sourceGame == ObjectSourceGame::TimeTwister - || sourceGame == ObjectSourceGame::Custom) - { - auto scgPathX = Object::GetScgPathXHeader(); - SetPrimarySceneryGroup(scgPathX); - } + auto scgPathX = Object::GetScgPathXHeader(); + SetPrimarySceneryGroup(scgPathX); } }