1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Do not read from repository when loading objects

This commit is contained in:
Gymnasiast
2025-09-21 01:32:16 +02:00
parent 3e11a8efdf
commit f768d2873e
4 changed files with 17 additions and 22 deletions

View File

@@ -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);
}
}

View File

@@ -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<ObjectSourceGame>& sourceGames)
{
_sourceGames = sourceGames;

View File

@@ -304,6 +304,7 @@ namespace OpenRCT2
{
}
std::vector<ObjectSourceGame> GetSourceGames();
ObjectSourceGame GetFirstSourceGame() const;
void SetSourceGames(const std::vector<ObjectSourceGame>& sourceGames);
const std::vector<std::string>& GetAuthors() const;

View File

@@ -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);
}
}