1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Refactor legacy GetSourceGame() to method

This commit is contained in:
Gymnasiast
2020-10-17 13:27:02 -07:00
parent 8a4df108ba
commit 13fb0b43da
5 changed files with 8 additions and 10 deletions

View File

@@ -580,8 +580,7 @@ static void window_object_load_error_scrollpaint(rct_window* w, rct_drawpixelinf
gfx_draw_string(dpi, strndup(_invalid_entries[i].name, 8), COLOUR_DARK_GREEN, screenCoords);
// ... source game ...
rct_string_id sourceStringId = object_manager_get_source_game_string(
object_entry_get_source_game_legacy(&_invalid_entries[i]));
rct_string_id sourceStringId = object_manager_get_source_game_string(_invalid_entries[i].GetSourceGame());
gfx_draw_string_left(dpi, sourceStringId, nullptr, COLOUR_DARK_GREEN, { SOURCE_COL_LEFT - 3, screenCoords.y });
// ... and type

View File

@@ -106,6 +106,11 @@ struct rct_object_entry
}
std::optional<uint8_t> GetSceneryType() const;
ObjectSourceGame GetSourceGame() const
{
return static_cast<ObjectSourceGame>((flags & 0xF0) >> 4);
}
};
assert_struct_size(rct_object_entry, 0x10);

View File

@@ -230,7 +230,7 @@ namespace ObjectFactory
{
throw std::runtime_error("Object has errors");
}
result->SetSourceGames({ object_entry_get_source_game_legacy(&entry) });
result->SetSourceGames({ entry.GetSourceGame() });
}
}
catch (const std::exception& e)
@@ -262,7 +262,7 @@ namespace ObjectFactory
}
else
{
result->SetSourceGames({ object_entry_get_source_game_legacy(entry) });
result->SetSourceGames({ entry->GetSourceGame() });
}
}
return result;

View File

@@ -69,11 +69,6 @@ bool object_entry_is_empty(const rct_object_entry* entry)
return false;
}
ObjectSourceGame object_entry_get_source_game_legacy(const rct_object_entry* objectEntry)
{
return static_cast<ObjectSourceGame>((objectEntry->flags & 0xF0) >> 4);
}
/**
*
* rct2: 0x006AB344

View File

@@ -21,4 +21,3 @@ void get_type_entry_index(size_t index, uint8_t* outObjectType, ObjectEntryIndex
const rct_object_entry* get_loaded_object_entry(size_t index);
void* get_loaded_object_chunk(size_t index);
uint8_t object_entry_get_type(const rct_object_entry* objectEntry);
ObjectSourceGame object_entry_get_source_game_legacy(const rct_object_entry* objectEntry);