forked from rosebudai/OpenRCT2-Web
Fix #18080: Obsolote .DAT objects can be loaded accidentally
This commit is contained in:
1 parent
e5d3633677
commit
2815d1958c
2 files changed
+22
-16
No files matched your search
@@ -111,24 +111,29 @@ public:
|
||||
object = ObjectFactory::CreateObjectFromLegacyFile(_objectRepository, path.c_str(), false);
|
||||
}
|
||||
|
||||
if (object != nullptr)
|
||||
// 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.
|
||||
if (object == nullptr
|
||||
|| (object->GetGeneration() == ObjectGeneration::DAT
|
||||
&& object->GetObjectEntry().GetSourceGame() != ObjectSourceGame::Custom))
|
||||
{
|
||||
ObjectRepositoryItem item = {};
|
||||
item.Type = object->GetObjectType();
|
||||
item.Generation = object->GetGeneration();
|
||||
item.Identifier = object->GetIdentifier();
|
||||
item.ObjectEntry = object->GetObjectEntry();
|
||||
item.Version = object->GetVersion();
|
||||
item.Path = path;
|
||||
item.Name = object->GetName();
|
||||
item.Authors = object->GetAuthors();
|
||||
item.Sources = object->GetSourceGames();
|
||||
if (object->IsCompatibilityObject())
|
||||
item.Flags |= ObjectItemFlags::IsCompatibilityObject;
|
||||
object->SetRepositoryItem(&item);
|
||||
return item;
|
||||
return std::nullopt;
|
||||
}
|
||||
return std::nullopt;
|
||||
|
||||
ObjectRepositoryItem item = {};
|
||||
item.Type = object->GetObjectType();
|
||||
item.Generation = object->GetGeneration();
|
||||
item.Identifier = object->GetIdentifier();
|
||||
item.ObjectEntry = object->GetObjectEntry();
|
||||
item.Version = object->GetVersion();
|
||||
item.Path = path;
|
||||
item.Name = object->GetName();
|
||||
item.Authors = object->GetAuthors();
|
||||
item.Sources = object->GetSourceGames();
|
||||
if (object->IsCompatibilityObject())
|
||||
item.Flags |= ObjectItemFlags::IsCompatibilityObject;
|
||||
object->SetRepositoryItem(&item);
|
||||
return item;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in new issue
Block a user