From fa951a29cdcf3dfea447e4eab2679a080c56ef1c Mon Sep 17 00:00:00 2001 From: Ted John Date: Wed, 6 Jul 2016 23:01:54 +0100 Subject: [PATCH] use object manager for S4Importer --- src/object/ObjectManager.h | 2 ++ src/rct1/S4Importer.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/object/ObjectManager.h b/src/object/ObjectManager.h index 21c37b260b..452ff979bb 100644 --- a/src/object/ObjectManager.h +++ b/src/object/ObjectManager.h @@ -29,6 +29,8 @@ extern "C" #ifdef __cplusplus +class Object; + interface IObjectManager { virtual ~IObjectManager() { } diff --git a/src/rct1/S4Importer.cpp b/src/rct1/S4Importer.cpp index 00d67f96c4..b4110a24bc 100644 --- a/src/rct1/S4Importer.cpp +++ b/src/rct1/S4Importer.cpp @@ -22,6 +22,7 @@ #include "../core/Path.hpp" #include "../core/String.hpp" #include "../core/Util.hpp" +#include "../object/ObjectManager.h" #include "Tables.h" extern "C" @@ -740,6 +741,8 @@ void S4Importer::LoadObjects() void S4Importer::LoadObjects(uint8 objectType, List entries) { + IObjectManager * objectManager = GetObjectManager(); + uint32 entryIndex = 0; for (const char * objectName : entries) { @@ -747,8 +750,9 @@ void S4Importer::LoadObjects(uint8 objectType, List entries) entry.flags = 0x00008000 + objectType; Memory::Copy(entry.name, objectName, 8); entry.checksum = 0; - - if (!object_load_chunk(entryIndex, &entry, NULL)) + + Object * object = objectManager->LoadObject(&entry); + if (object == nullptr) { log_error("Failed to load %s.", objectName); throw Exception("Failed to load object.");