Refactor object_entry_get_chunk wrapper

This commit is contained in:
ζeh Matt 2021-09-09 03:26:52 +03:00
parent c416c7ca27
commit 38ec042a52
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 4 additions and 11 deletions

View File

@ -160,20 +160,13 @@ void object_entry_get_name_fixed(utf8* buffer, size_t bufferSize, const rct_obje
void* object_entry_get_chunk(ObjectType objectType, ObjectEntryIndex index)
{
ObjectEntryIndex objectIndex = index;
for (int32_t i = 0; i < EnumValue(objectType); i++)
{
objectIndex += object_entry_group_counts[i];
}
void* result = nullptr;
auto& objectMgr = OpenRCT2::GetContext()->GetObjectManager();
auto obj = objectMgr.GetLoadedObject(objectIndex);
if (obj != nullptr)
auto* object = objectMgr.GetLoadedObject(objectType, index);
if (object != nullptr)
{
result = obj->GetLegacyData();
return object->GetLegacyData();
}
return result;
return nullptr;
}
const Object* object_entry_get_object(ObjectType objectType, ObjectEntryIndex index)