1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 06:23:04 +01:00

Reduce use of rct_object_entry

This commit is contained in:
Ted John
2021-04-14 10:36:21 +01:00
parent 23c709c197
commit 6329e8fdfe
20 changed files with 397 additions and 335 deletions

View File

@@ -174,19 +174,6 @@ void ObjectList::SetObject(ObjectType type, ObjectEntryIndex index, std::string_
SetObject(index, entry);
}
bool object_entry_is_empty(const rct_object_entry* entry)
{
uint64_t a, b;
std::memcpy(&a, reinterpret_cast<const uint8_t*>(entry), 8);
std::memcpy(&b, reinterpret_cast<const uint8_t*>(entry) + 8, 8);
if (a == 0xFFFFFFFFFFFFFFFF && b == 0xFFFFFFFFFFFFFFFF)
return true;
if (a == 0 && b == 0)
return true;
return false;
}
/**
*
* rct2: 0x006AB344
@@ -218,7 +205,7 @@ bool find_object_in_entry_group(const rct_object_entry* entry, ObjectType* entry
if (loadedObj != nullptr)
{
auto thisEntry = object_entry_get_object(objectType, i)->GetObjectEntry();
if (object_entry_compare(thisEntry, entry))
if (thisEntry == *entry)
{
*entry_type = objectType;
*entryIndex = i;
@@ -251,20 +238,6 @@ void get_type_entry_index(size_t index, ObjectType* outObjectType, ObjectEntryIn
*outEntryIndex = static_cast<ObjectEntryIndex>(index);
}
const rct_object_entry* get_loaded_object_entry(size_t index)
{
ObjectType objectType;
ObjectEntryIndex entryIndex;
get_type_entry_index(index, &objectType, &entryIndex);
auto obj = object_entry_get_object(objectType, entryIndex);
if (obj == nullptr)
{
return nullptr;
}
return obj->GetObjectEntry();
}
void* get_loaded_object_chunk(size_t index)
{
ObjectType objectType;