1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

fix scenery group population

This commit is contained in:
Ted John
2016-07-09 02:01:27 +01:00
parent 5785020b07
commit 7c8fbf3588
3 changed files with 57 additions and 20 deletions

View File

@@ -22,6 +22,7 @@
#include "Object.h"
#include "ObjectManager.h"
#include "ObjectRepository.h"
#include "SceneryGroupObject.h"
extern "C"
{
@@ -94,6 +95,7 @@ public:
{
_loadedObjects[slot] = loadedObject;
UpdateLegacyLoadedObjectList();
UpdateSceneryGroupIndexes();
reset_type_to_ride_entry_index_map();
}
}
@@ -130,6 +132,7 @@ public:
{
SetNewLoadedObjectList(loadedObjects);
UpdateLegacyLoadedObjectList();
UpdateSceneryGroupIndexes();
reset_type_to_ride_entry_index_map();
// Console::WriteLine("%u / %u new objects loaded", numNewLoadedObjects, numRequiredObjects);
return true;
@@ -162,6 +165,7 @@ public:
if (numObjectsUnloaded > 0)
{
UpdateLegacyLoadedObjectList();
UpdateSceneryGroupIndexes();
reset_type_to_ride_entry_index_map();
}
}
@@ -177,6 +181,7 @@ public:
}
}
UpdateLegacyLoadedObjectList();
UpdateSceneryGroupIndexes();
reset_type_to_ride_entry_index_map();
}
@@ -329,6 +334,25 @@ private:
}
}
void UpdateSceneryGroupIndexes()
{
if (_loadedObjects != nullptr)
{
for (size_t i = 0; i < OBJECT_ENTRY_COUNT; i++)
{
Object * loadedObject = _loadedObjects[i];
if (loadedObject != nullptr)
{
if (loadedObject->GetObjectType() == OBJECT_TYPE_SCENERY_SETS)
{
auto sgObject = static_cast<SceneryGroupObject *>(loadedObject);
sgObject->UpdateEntryIndexes();
}
}
}
}
}
bool GetRequiredObjects(const rct_object_entry * entries,
const ObjectRepositoryItem * * requiredObjects,
size_t * outNumRequiredObjects)