mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 14:02:59 +01:00
Pass object repository as a dependency when loading objects
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "../interface/Cursors.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../object/Object.h"
|
||||
#include "../object/ObjectRepository.h"
|
||||
#include "ObjectList.h"
|
||||
#include "FootpathItemObject.h"
|
||||
#include "ObjectJsonHelpers.h"
|
||||
@@ -49,16 +50,20 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext * context, IStream * stre
|
||||
|
||||
// Add path bits 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.
|
||||
const std::string identifier = GetIdentifier();
|
||||
const rct_object_entry * objectEntry = object_list_find_by_name(identifier.c_str());
|
||||
static const rct_object_entry scgPathX = Object::GetScgPathXHeader();
|
||||
auto identifier = GetIdentifier();
|
||||
|
||||
if (objectEntry != nullptr &&
|
||||
(object_entry_get_source_game(objectEntry) == OBJECT_SOURCE_WACKY_WORLDS ||
|
||||
object_entry_get_source_game(objectEntry) == OBJECT_SOURCE_TIME_TWISTER ||
|
||||
object_entry_get_source_game(objectEntry) == OBJECT_SOURCE_CUSTOM))
|
||||
auto& objectRepository = context->GetObjectRepository();
|
||||
auto item = objectRepository.FindObject(identifier);
|
||||
if (item != nullptr)
|
||||
{
|
||||
SetPrimarySceneryGroup(&scgPathX);
|
||||
auto sourceGame = object_entry_get_source_game(&item->ObjectEntry);
|
||||
if (sourceGame == OBJECT_SOURCE_WACKY_WORLDS ||
|
||||
sourceGame == OBJECT_SOURCE_TIME_TWISTER ||
|
||||
sourceGame == OBJECT_SOURCE_CUSTOM)
|
||||
{
|
||||
auto scgPathX = Object::GetScgPathXHeader();
|
||||
SetPrimarySceneryGroup(&scgPathX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user