From 8f53c6dbd3e395ca2984f9d08eaac6f985eeb2f5 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Mon, 22 May 2023 08:46:15 +0100 Subject: [PATCH] Remove bad identifier users Note this doesn't actually do anything under the hood it will do the same thing for now --- src/openrct2/object/BannerObject.cpp | 3 +-- src/openrct2/object/Object.h | 2 +- src/openrct2/object/PathAdditionObject.cpp | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/openrct2/object/BannerObject.cpp b/src/openrct2/object/BannerObject.cpp index 2f591f6146..a375091f91 100644 --- a/src/openrct2/object/BannerObject.cpp +++ b/src/openrct2/object/BannerObject.cpp @@ -41,10 +41,9 @@ void BannerObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStream* st // 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 identifier = GetLegacyIdentifier(); auto& objectRepository = context->GetObjectRepository(); - auto item = objectRepository.FindObjectLegacy(identifier); + auto item = objectRepository.FindObject(GetDescriptor()); if (item != nullptr) { auto sourceGame = item->GetFirstSourceGame(); diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 71bda63dc3..c01bd6a75c 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -265,7 +265,7 @@ public: return _usesFallbackImages; } - // Legacy data structures + // DONOT USE THIS CAN LEAD TO OBJECT COLLISIONS std::string_view GetLegacyIdentifier() const { return _descriptor.GetName(); diff --git a/src/openrct2/object/PathAdditionObject.cpp b/src/openrct2/object/PathAdditionObject.cpp index 8230d01863..c3f5b2eb68 100644 --- a/src/openrct2/object/PathAdditionObject.cpp +++ b/src/openrct2/object/PathAdditionObject.cpp @@ -45,10 +45,9 @@ void PathAdditionObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStre // 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 identifier = GetLegacyIdentifier(); auto& objectRepository = context->GetObjectRepository(); - auto item = objectRepository.FindObjectLegacy(identifier); + auto item = objectRepository.FindObject(GetDescriptor()); if (item != nullptr) { auto sourceGame = item->GetFirstSourceGame();