forked from rosebudai/OpenRCT2-Web
Remove repository from IReadObjectContext, ObjectFileIndex and helper functions
This commit is contained in:
7 files changed
+28
-55
No files matched your search
@@ -81,8 +81,6 @@ namespace OpenRCT2
|
||||
static constexpr uint16_t kVersion = 31;
|
||||
static constexpr auto kPattern = "*.dat;*.pob;*.json;*.parkobj";
|
||||
|
||||
IObjectRepository& _objectRepository;
|
||||
|
||||
public:
|
||||
explicit ObjectFileIndex(IObjectRepository& objectRepository, const IPlatformEnvironment& env)
|
||||
: FileIndex(
|
||||
@@ -91,14 +89,13 @@ namespace OpenRCT2
|
||||
env.GetDirectoryPath(DirBase::openrct2, DirId::objects),
|
||||
env.GetDirectoryPath(DirBase::user, DirId::objects),
|
||||
})
|
||||
, _objectRepository(objectRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
std::optional<ObjectRepositoryItem> Create([[maybe_unused]] int32_t language, const std::string& path) const override
|
||||
{
|
||||
std::unique_ptr<Object> object = ObjectFactory::CreateObjectFromFile(_objectRepository, path, false);
|
||||
std::unique_ptr<Object> object = ObjectFactory::CreateObjectFromFile(path, false);
|
||||
|
||||
// All official DAT files have a JSON object counterpart. Avoid loading the obsolete .DAT versions,
|
||||
// which can happen if the user copies the official DAT objects to their custom content folder.
|
||||
@@ -258,7 +255,8 @@ namespace OpenRCT2
|
||||
std::unique_ptr<Object> LoadObject(const ObjectRepositoryItem* ori) override
|
||||
{
|
||||
Guard::ArgumentNotNull(ori, GUARD_LINE);
|
||||
return ObjectFactory::CreateObjectFromFile(*this, ori->Path, !gOpenRCT2NoGraphics);
|
||||
|
||||
return ObjectFactory::CreateObjectFromFile(ori->Path, !gOpenRCT2NoGraphics);
|
||||
}
|
||||
|
||||
void RegisterLoadedObject(const ObjectRepositoryItem* ori, std::unique_ptr<Object>&& object) override
|
||||
@@ -284,7 +282,7 @@ namespace OpenRCT2
|
||||
ObjectEntryGetNameFixed(objectName, sizeof(objectName), objectEntry);
|
||||
|
||||
// Check that the object is loadable before writing it
|
||||
auto object = ObjectFactory::CreateObjectFromLegacyData(*this, objectEntry, data, dataSize);
|
||||
auto object = ObjectFactory::CreateObjectFromLegacyData(objectEntry, data, dataSize);
|
||||
if (object == nullptr)
|
||||
{
|
||||
Console::Error::WriteLine("[%s] Unable to export object.", objectName);
|
||||
|
||||
Reference in new issue
Block a user