mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 04:23:20 +01:00
* Feature #11817: Show authors field in object selection - authors field in JSON shows as last line in bottom right on object selection - authors field added to Object class - ObjectFileIndex version bump as authors is serialised * fix sign comparison warning * Start object selection corner text higher to avoid overlap * Use references to reduce unneccessary copies * make GetAuthors const * Clip drawing of authors string so it doesn't cross widgets At max length the leftmost aligns exactly with description left * Add a changelog message * make SetAuthors use an rvalue reference * remove unnecessary nullptr check
This commit is contained in:
@@ -74,7 +74,7 @@ class ObjectFileIndex final : public FileIndex<ObjectRepositoryItem>
|
||||
{
|
||||
private:
|
||||
static constexpr uint32_t MAGIC_NUMBER = 0x5844494F; // OIDX
|
||||
static constexpr uint16_t VERSION = 20;
|
||||
static constexpr uint16_t VERSION = 21;
|
||||
static constexpr auto PATTERN = "*.dat;*.pob;*.json;*.parkobj";
|
||||
|
||||
IObjectRepository& _objectRepository;
|
||||
@@ -114,6 +114,7 @@ public:
|
||||
item.ObjectEntry = *object->GetObjectEntry();
|
||||
item.Path = path;
|
||||
item.Name = object->GetName();
|
||||
item.Authors = object->GetAuthors();
|
||||
item.Sources = object->GetSourceGames();
|
||||
object->SetRepositoryItem(&item);
|
||||
delete object;
|
||||
@@ -128,6 +129,7 @@ protected:
|
||||
stream->WriteValue(item.ObjectEntry);
|
||||
stream->WriteString(item.Path);
|
||||
stream->WriteString(item.Name);
|
||||
|
||||
uint8_t sourceLength = static_cast<uint8_t>(item.Sources.size());
|
||||
stream->WriteValue(sourceLength);
|
||||
for (auto source : item.Sources)
|
||||
@@ -135,6 +137,13 @@ protected:
|
||||
stream->WriteValue(source);
|
||||
}
|
||||
|
||||
uint8_t authorsLength = static_cast<uint8_t>(item.Authors.size());
|
||||
stream->WriteValue(authorsLength);
|
||||
for (const auto& author : item.Authors)
|
||||
{
|
||||
stream->WriteString(author);
|
||||
}
|
||||
|
||||
switch (item.ObjectEntry.GetType())
|
||||
{
|
||||
case OBJECT_TYPE_RIDE:
|
||||
@@ -165,6 +174,7 @@ protected:
|
||||
item.ObjectEntry = stream->ReadValue<rct_object_entry>();
|
||||
item.Path = stream->ReadStdString();
|
||||
item.Name = stream->ReadStdString();
|
||||
|
||||
auto sourceLength = stream->ReadValue<uint8_t>();
|
||||
for (size_t i = 0; i < sourceLength; i++)
|
||||
{
|
||||
@@ -172,6 +182,13 @@ protected:
|
||||
item.Sources.push_back(value);
|
||||
}
|
||||
|
||||
auto authorsLength = stream->ReadValue<uint8_t>();
|
||||
for (size_t i = 0; i < authorsLength; i++)
|
||||
{
|
||||
auto author = stream->ReadStdString();
|
||||
item.Authors.emplace_back(author);
|
||||
}
|
||||
|
||||
switch (item.ObjectEntry.GetType())
|
||||
{
|
||||
case OBJECT_TYPE_RIDE:
|
||||
|
||||
Reference in New Issue
Block a user