mirror of https://github.com/OpenRCT2/OpenRCT2.git
use object manager for S4Importer
This commit is contained in:
parent
f59d6b7a00
commit
fa951a29cd
|
@ -29,6 +29,8 @@ extern "C"
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class Object;
|
||||
|
||||
interface IObjectManager
|
||||
{
|
||||
virtual ~IObjectManager() { }
|
||||
|
|
|
@ -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<const char *> entries)
|
||||
{
|
||||
IObjectManager * objectManager = GetObjectManager();
|
||||
|
||||
uint32 entryIndex = 0;
|
||||
for (const char * objectName : entries)
|
||||
{
|
||||
|
@ -747,8 +750,9 @@ void S4Importer::LoadObjects(uint8 objectType, List<const char *> 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.");
|
||||
|
|
Loading…
Reference in New Issue