1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Refactor rct_research_item, refactor access to rct_research_item

This takes away a lot of the bitshift and bit mask trickery previously used.
This commit is contained in:
Michael Steenbeek
2018-01-04 16:43:55 +01:00
parent 59439b778b
commit 7d5de63484
12 changed files with 203 additions and 180 deletions

View File

@@ -124,25 +124,28 @@ void object_create_identifier_name(char* string_buffer, size_t size, const rct_o
* bl = entry_index
* ecx = entry_type
*/
sint32 find_object_in_entry_group(const rct_object_entry* entry, uint8* entry_type, uint8* entry_index){
bool find_object_in_entry_group(const rct_object_entry * entry, uint8 * entry_type, uint8 * entry_index)
{
if ((entry->flags & 0xF) >= Util::CountOf(object_entry_groups)) {
return 0;
return false;
}
*entry_type = entry->flags & 0xF;
rct_object_entry_group entry_group = object_entry_groups[*entry_type];
for (*entry_index = 0;
*entry_index < object_entry_group_counts[*entry_type];
++(*entry_index),
entry_group.chunks++,
entry_group.entries++){
*entry_index < object_entry_group_counts[*entry_type];
++(*entry_index), entry_group.chunks++, entry_group.entries++)
{
if (*entry_group.chunks == nullptr)
continue;
if (*entry_group.chunks == nullptr) continue;
if (object_entry_compare((rct_object_entry*)entry_group.entries, entry))break;
if (object_entry_compare((rct_object_entry*)entry_group.entries, entry))
break;
}
if (*entry_index == object_entry_group_counts[*entry_type])return 0;
return 1;
if (*entry_index == object_entry_group_counts[*entry_type])
return false;
return true;
}
void get_type_entry_index(size_t index, uint8 * outObjectType, uint8 * outEntryIndex)