1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix incorrect objects in S6 import

This commit is contained in:
Ted John
2021-09-13 19:24:42 +01:00
committed by Gymnasiast
parent bdab3219cb
commit 8cdece0252
3 changed files with 13 additions and 4 deletions

View File

@@ -1603,9 +1603,18 @@ public:
AddRequiredObjects<MAX_SCENARIO_TEXT_OBJECTS>(result, _s6.ScenarioTextObjects);
ObjectList objectList;
for (rct_object_entry entry : result)
for (size_t i = 0; i < result.size(); i++)
{
objectList.Add(ObjectEntryDescriptor(entry));
ObjectType objectType;
ObjectEntryIndex entryIndex;
get_type_entry_index(i, &objectType, &entryIndex);
auto desc = ObjectEntryDescriptor(result[i]);
if (desc.HasValue())
{
assert(desc.GetType() == objectType);
objectList.SetObject(entryIndex, desc);
}
}
return objectList;

View File

@@ -46,7 +46,7 @@ static std::unique_ptr<IContext> localStartGame(const std::string& parkPath)
auto importer = ParkImporter::CreateS6(context->GetObjectRepository());
auto loadResult = importer->LoadSavedGame(parkPath.c_str(), false);
context->GetObjectManager().LoadObjects(loadResult.RequiredObjects.data(), loadResult.RequiredObjects.size());
context->GetObjectManager().LoadObjects(loadResult.RequiredObjects);
importer->Import();
reset_sprite_spatial_index();

View File

@@ -78,7 +78,7 @@ static bool ImportSave(MemoryStream& stream, std::unique_ptr<IContext>& context,
auto importer = ParkImporter::CreateS6(context->GetObjectRepository());
auto loadResult = importer->LoadFromStream(&stream, false);
objManager.LoadObjects(loadResult.RequiredObjects.data(), loadResult.RequiredObjects.size());
objManager.LoadObjects(loadResult.RequiredObjects);
importer->Import();
GameInit(retainSpatialIndices);