mirror of https://github.com/OpenRCT2/OpenRCT2.git
Make ObjectRepositoryItem C++
This commit is contained in:
parent
f8271e93b0
commit
6f00e6aafe
|
@ -277,8 +277,8 @@ static void visible_list_dispose()
|
||||||
|
|
||||||
static bool visible_list_sort_ride_name(const list_item &a, const list_item &b)
|
static bool visible_list_sort_ride_name(const list_item &a, const list_item &b)
|
||||||
{
|
{
|
||||||
auto nameA = a.repositoryItem->Name;
|
auto nameA = a.repositoryItem->Name.c_str();
|
||||||
auto nameB = b.repositoryItem->Name;
|
auto nameB = b.repositoryItem->Name.c_str();
|
||||||
return strcmp(nameA, nameB) < 0;
|
return strcmp(nameA, nameB) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ static void window_editor_object_selection_init_widgets()
|
||||||
if (!_window_editor_object_selection_widgets_initialised)
|
if (!_window_editor_object_selection_widgets_initialised)
|
||||||
{
|
{
|
||||||
_window_editor_object_selection_widgets_initialised = true;
|
_window_editor_object_selection_widgets_initialised = true;
|
||||||
const auto &tabWidget = widgets[widgets.size() - 2];
|
auto tabWidget = widgets[widgets.size() - 2];
|
||||||
for (sint32 i = 1; i < OBJECT_TYPE_COUNT; i++)
|
for (sint32 i = 1; i < OBJECT_TYPE_COUNT; i++)
|
||||||
{
|
{
|
||||||
widgets.insert(widgets.end() - 1, tabWidget);
|
widgets.insert(widgets.end() - 1, tabWidget);
|
||||||
|
@ -1035,7 +1035,7 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf
|
||||||
y = w->y + widget->bottom + 3;
|
y = w->y + widget->bottom + 3;
|
||||||
width = w->width - w->widgets[WIDX_LIST].right - 6;
|
width = w->width - w->widgets[WIDX_LIST].right - 6;
|
||||||
set_format_arg(0, rct_string_id, STR_STRING);
|
set_format_arg(0, rct_string_id, STR_STRING);
|
||||||
set_format_arg(2, const char *, listItem->repositoryItem->Name);
|
set_format_arg(2, const char *, listItem->repositoryItem->Name.c_str());
|
||||||
gfx_draw_string_centred_clipped(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, x, y, width);
|
gfx_draw_string_centred_clipped(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, x, y, width);
|
||||||
|
|
||||||
// Draw description of object
|
// Draw description of object
|
||||||
|
@ -1067,7 +1067,7 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf
|
||||||
// gfx_draw_string_right(dpi, stringId, nullptr, 2, w->x + w->width - 5, w->y + w->height - 3 - 12 - 14);
|
// gfx_draw_string_right(dpi, stringId, nullptr, 2, w->x + w->width - 5, w->y + w->height - 3 - 12 - 14);
|
||||||
|
|
||||||
// Draw object dat name
|
// Draw object dat name
|
||||||
const char *path = path_get_filename(listItem->repositoryItem->Path);
|
const char *path = path_get_filename(listItem->repositoryItem->Path.c_str());
|
||||||
set_format_arg(0, rct_string_id, STR_STRING);
|
set_format_arg(0, rct_string_id, STR_STRING);
|
||||||
set_format_arg(2, const char *, path);
|
set_format_arg(2, const char *, path);
|
||||||
gfx_draw_string_right(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, w->x + w->width - 5, w->y + w->height - 3 - 12);
|
gfx_draw_string_right(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, w->x + w->width - 5, w->y + w->height - 3 - 12);
|
||||||
|
@ -1134,7 +1134,7 @@ static void window_editor_object_selection_scrollpaint(rct_window *w, rct_drawpi
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw text
|
// Draw text
|
||||||
safe_strcpy(buffer, listItem.repositoryItem->Name, 256 - (buffer - bufferWithColour));
|
safe_strcpy(buffer, listItem.repositoryItem->Name.c_str(), 256 - (buffer - bufferWithColour));
|
||||||
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) {
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) {
|
||||||
while (*buffer != 0 && *buffer != 9)
|
while (*buffer != 0 && *buffer != 9)
|
||||||
buffer++;
|
buffer++;
|
||||||
|
@ -1317,8 +1317,7 @@ static bool filter_string(const ObjectRepositoryItem * item)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Object doesn't have a name
|
// Object doesn't have a name
|
||||||
utf8 *name = item->Name;
|
if (item->Name.empty())
|
||||||
if (name == nullptr || name[0] == '\0')
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Get ride type
|
// Get ride type
|
||||||
|
@ -1329,9 +1328,9 @@ static bool filter_string(const ObjectRepositoryItem * item)
|
||||||
char type_lower[MAX_PATH];
|
char type_lower[MAX_PATH];
|
||||||
char object_path[MAX_PATH];
|
char object_path[MAX_PATH];
|
||||||
char filter_lower[sizeof(_filter_string)];
|
char filter_lower[sizeof(_filter_string)];
|
||||||
safe_strcpy(name_lower, name, MAX_PATH);
|
safe_strcpy(name_lower, item->Name.c_str(), MAX_PATH);
|
||||||
safe_strcpy(type_lower, rideTypeName, MAX_PATH);
|
safe_strcpy(type_lower, rideTypeName, MAX_PATH);
|
||||||
safe_strcpy(object_path, item->Path, MAX_PATH);
|
safe_strcpy(object_path, item->Path.c_str(), MAX_PATH);
|
||||||
safe_strcpy(filter_lower, _filter_string, sizeof(_filter_string));
|
safe_strcpy(filter_lower, _filter_string, sizeof(_filter_string));
|
||||||
|
|
||||||
// Make use of lowercase characters only
|
// Make use of lowercase characters only
|
||||||
|
@ -1383,9 +1382,9 @@ static bool filter_chunks(const ObjectRepositoryItem * item)
|
||||||
uint8 rideType = 0;
|
uint8 rideType = 0;
|
||||||
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||||
{
|
{
|
||||||
if (item->RideType[i] != RIDE_TYPE_NULL)
|
if (item->RideInfo.RideType[i] != RIDE_TYPE_NULL)
|
||||||
{
|
{
|
||||||
rideType = item->RideType[i];
|
rideType = item->RideInfo.RideType[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1426,12 +1425,12 @@ static rct_string_id get_ride_type_string_id(const ObjectRepositoryItem * item)
|
||||||
rct_string_id result = STR_NONE;
|
rct_string_id result = STR_NONE;
|
||||||
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||||
{
|
{
|
||||||
uint8 rideType = item->RideType[i];
|
uint8 rideType = item->RideInfo.RideType[i];
|
||||||
if (rideType != RIDE_TYPE_NULL)
|
if (rideType != RIDE_TYPE_NULL)
|
||||||
{
|
{
|
||||||
if (RideGroupManager::RideTypeHasRideGroups(rideType))
|
if (RideGroupManager::RideTypeHasRideGroups(rideType))
|
||||||
{
|
{
|
||||||
const RideGroup * rideGroup = RideGroupManager::RideGroupFind(rideType, item->RideGroupIndex);
|
const RideGroup * rideGroup = RideGroupManager::RideGroupFind(rideType, item->RideInfo.RideGroupIndex);
|
||||||
result = rideGroup->Naming.name;
|
result = rideGroup->Naming.name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void setup_track_manager_objects()
|
||||||
{
|
{
|
||||||
*selectionFlags |= OBJECT_SELECTION_FLAG_6;
|
*selectionFlags |= OBJECT_SELECTION_FLAG_6;
|
||||||
|
|
||||||
for (auto rideType : item->RideType)
|
for (auto rideType : item->RideInfo.RideType)
|
||||||
{
|
{
|
||||||
if (rideType != RIDE_TYPE_NULL && ride_type_has_flag(rideType, RIDE_TYPE_FLAG_HAS_TRACK))
|
if (rideType != RIDE_TYPE_NULL && ride_type_has_flag(rideType, RIDE_TYPE_FLAG_HAS_TRACK))
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ static void setup_track_designer_objects()
|
||||||
{
|
{
|
||||||
*selectionFlags |= OBJECT_SELECTION_FLAG_6;
|
*selectionFlags |= OBJECT_SELECTION_FLAG_6;
|
||||||
|
|
||||||
for (uint8 rideType : item->RideType)
|
for (uint8 rideType : item->RideInfo.RideType)
|
||||||
{
|
{
|
||||||
if (rideType != RIDE_TYPE_NULL)
|
if (rideType != RIDE_TYPE_NULL)
|
||||||
{
|
{
|
||||||
|
@ -420,8 +420,9 @@ sint32 window_editor_object_selection_select_object(uint8 bh, sint32 flags, cons
|
||||||
|
|
||||||
uint8 objectType = object_entry_get_type(&item->ObjectEntry);
|
uint8 objectType = object_entry_get_type(&item->ObjectEntry);
|
||||||
if (objectType == OBJECT_TYPE_SCENERY_GROUP && (flags & (1 << 2))) {
|
if (objectType == OBJECT_TYPE_SCENERY_GROUP && (flags & (1 << 2))) {
|
||||||
for (sint32 j = 0; j < item->NumThemeObjects; j++) {
|
for (const auto& sgEntry : item->SceneryGroupInfo.Entries)
|
||||||
window_editor_object_selection_select_object(++bh, flags, &item->ThemeObjects[j]);
|
{
|
||||||
|
window_editor_object_selection_select_object(++bh, flags, &sgEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,8 +451,10 @@ sint32 window_editor_object_selection_select_object(uint8 bh, sint32 flags, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectType == OBJECT_TYPE_SCENERY_GROUP && (flags & (1 << 2))) {
|
if (objectType == OBJECT_TYPE_SCENERY_GROUP && (flags & (1 << 2))) {
|
||||||
for (uint16 j = 0; j < item->NumThemeObjects; j++) {
|
for (const auto& sgEntry : item->SceneryGroupInfo.Entries)
|
||||||
if (!window_editor_object_selection_select_object(++bh, flags, &item->ThemeObjects[j])) {
|
{
|
||||||
|
if (!window_editor_object_selection_select_object(++bh, flags, &sgEntry))
|
||||||
|
{
|
||||||
_maxObjectsWasHit = true;
|
_maxObjectsWasHit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,8 +121,8 @@ public:
|
||||||
{
|
{
|
||||||
ObjectRepositoryItem item = { 0 };
|
ObjectRepositoryItem item = { 0 };
|
||||||
item.ObjectEntry = *object->GetObjectEntry();
|
item.ObjectEntry = *object->GetObjectEntry();
|
||||||
item.Path = String::Duplicate(path);
|
item.Path = path;
|
||||||
item.Name = String::Duplicate(object->GetName());
|
item.Name = object->GetName();
|
||||||
object->SetRepositoryItem(&item);
|
object->SetRepositoryItem(&item);
|
||||||
delete object;
|
delete object;
|
||||||
return std::make_tuple(true, item);
|
return std::make_tuple(true, item);
|
||||||
|
@ -139,22 +139,22 @@ protected:
|
||||||
|
|
||||||
switch (object_entry_get_type(&item.ObjectEntry)) {
|
switch (object_entry_get_type(&item.ObjectEntry)) {
|
||||||
case OBJECT_TYPE_RIDE:
|
case OBJECT_TYPE_RIDE:
|
||||||
stream->WriteValue<uint8>(item.RideFlags);
|
stream->WriteValue<uint8>(item.RideInfo.RideFlags);
|
||||||
for (sint32 i = 0; i < MAX_CATEGORIES_PER_RIDE; i++)
|
for (sint32 i = 0; i < MAX_CATEGORIES_PER_RIDE; i++)
|
||||||
{
|
{
|
||||||
stream->WriteValue<uint8>(item.RideCategory[i]);
|
stream->WriteValue<uint8>(item.RideInfo.RideCategory[i]);
|
||||||
}
|
}
|
||||||
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||||
{
|
{
|
||||||
stream->WriteValue<uint8>(item.RideType[i]);
|
stream->WriteValue<uint8>(item.RideInfo.RideType[i]);
|
||||||
}
|
}
|
||||||
stream->WriteValue<uint8>(item.RideGroupIndex);
|
stream->WriteValue<uint8>(item.RideInfo.RideGroupIndex);
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE_SCENERY_GROUP:
|
case OBJECT_TYPE_SCENERY_GROUP:
|
||||||
stream->WriteValue<uint16>(item.NumThemeObjects);
|
stream->WriteValue<uint16>((uint16)item.SceneryGroupInfo.Entries.size());
|
||||||
for (uint16 i = 0; i < item.NumThemeObjects; i++)
|
for (const auto& entry : item.SceneryGroupInfo.Entries)
|
||||||
{
|
{
|
||||||
stream->WriteValue<rct_object_entry>(item.ThemeObjects[i]);
|
stream->WriteValue<rct_object_entry>(entry);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ protected:
|
||||||
|
|
||||||
ObjectRepositoryItem Deserialise(IStream * stream) const override
|
ObjectRepositoryItem Deserialise(IStream * stream) const override
|
||||||
{
|
{
|
||||||
ObjectRepositoryItem item = { 0 };
|
ObjectRepositoryItem item;
|
||||||
|
|
||||||
item.ObjectEntry = stream->ReadValue<rct_object_entry>();
|
item.ObjectEntry = stream->ReadValue<rct_object_entry>();
|
||||||
item.Path = stream->ReadString();
|
item.Path = stream->ReadString();
|
||||||
|
@ -170,25 +170,27 @@ protected:
|
||||||
|
|
||||||
switch (object_entry_get_type(&item.ObjectEntry)) {
|
switch (object_entry_get_type(&item.ObjectEntry)) {
|
||||||
case OBJECT_TYPE_RIDE:
|
case OBJECT_TYPE_RIDE:
|
||||||
item.RideFlags = stream->ReadValue<uint8>();
|
item.RideInfo.RideFlags = stream->ReadValue<uint8>();
|
||||||
for (sint32 i = 0; i < 2; i++)
|
for (sint32 i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
item.RideCategory[i] = stream->ReadValue<uint8>();
|
item.RideInfo.RideCategory[i] = stream->ReadValue<uint8>();
|
||||||
}
|
}
|
||||||
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
for (sint32 i = 0; i < MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||||
{
|
{
|
||||||
item.RideType[i] = stream->ReadValue<uint8>();
|
item.RideInfo.RideType[i] = stream->ReadValue<uint8>();
|
||||||
}
|
}
|
||||||
item.RideGroupIndex = stream->ReadValue<uint8>();
|
item.RideInfo.RideGroupIndex = stream->ReadValue<uint8>();
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE_SCENERY_GROUP:
|
case OBJECT_TYPE_SCENERY_GROUP:
|
||||||
item.NumThemeObjects = stream->ReadValue<uint16>();
|
|
||||||
item.ThemeObjects = Memory::AllocateArray<rct_object_entry>(item.NumThemeObjects);
|
|
||||||
for (uint16 i = 0; i < item.NumThemeObjects; i++)
|
|
||||||
{
|
{
|
||||||
item.ThemeObjects[i] = stream->ReadValue<rct_object_entry>();
|
auto numEntries = stream->ReadValue<uint16>();
|
||||||
|
item.SceneryGroupInfo.Entries = std::vector<rct_object_entry>(numEntries);
|
||||||
|
for (size_t i = 0; i < numEntries; i++)
|
||||||
|
{
|
||||||
|
item.SceneryGroupInfo.Entries[i] = stream->ReadValue<rct_object_entry>();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +288,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ObjectFactory::CreateObjectFromLegacyFile(*this, ori->Path);
|
return ObjectFactory::CreateObjectFromLegacyFile(*this, ori->Path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,10 +378,6 @@ public:
|
||||||
private:
|
private:
|
||||||
void ClearItems()
|
void ClearItems()
|
||||||
{
|
{
|
||||||
for (auto &item : _items)
|
|
||||||
{
|
|
||||||
FreeItem(&item);
|
|
||||||
}
|
|
||||||
_items.clear();
|
_items.clear();
|
||||||
_itemMap.clear();
|
_itemMap.clear();
|
||||||
}
|
}
|
||||||
|
@ -437,8 +435,8 @@ private:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console::Error::WriteLine("Object conflict: '%s'", conflict->Path);
|
Console::Error::WriteLine("Object conflict: '%s'", conflict->Path.c_str());
|
||||||
Console::Error::WriteLine(" : '%s'", item.Path);
|
Console::Error::WriteLine(" : '%s'", item.Path.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,22 +452,6 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FreeItem(ObjectRepositoryItem * item)
|
|
||||||
{
|
|
||||||
Memory::Free(item->Path);
|
|
||||||
Memory::Free(item->Name);
|
|
||||||
item->Path = nullptr;
|
|
||||||
item->Name = nullptr;
|
|
||||||
|
|
||||||
uint8 objectType = object_entry_get_type(&item->ObjectEntry);
|
|
||||||
switch (objectType) {
|
|
||||||
case OBJECT_TYPE_SCENERY_GROUP:
|
|
||||||
Memory::Free(item->ThemeObjects);
|
|
||||||
item->ThemeObjects = nullptr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SaveObject(const utf8 * path,
|
static void SaveObject(const utf8 * path,
|
||||||
const rct_object_entry * entry,
|
const rct_object_entry * entry,
|
||||||
const void * data, size_t dataSize,
|
const void * data, size_t dataSize,
|
||||||
|
|
|
@ -40,24 +40,20 @@ struct ObjectRepositoryItem
|
||||||
{
|
{
|
||||||
size_t Id;
|
size_t Id;
|
||||||
rct_object_entry ObjectEntry;
|
rct_object_entry ObjectEntry;
|
||||||
utf8 * Path;
|
std::string Path;
|
||||||
utf8 * Name;
|
std::string Name;
|
||||||
Object * LoadedObject;
|
Object * LoadedObject{};
|
||||||
union
|
struct
|
||||||
{
|
{
|
||||||
struct
|
uint8 RideFlags;
|
||||||
{
|
uint8 RideCategory[2];
|
||||||
uint8 RideFlags;
|
uint8 RideType[MAX_RIDE_TYPES_PER_RIDE_ENTRY];
|
||||||
uint8 RideCategory[2];
|
uint8 RideGroupIndex;
|
||||||
uint8 RideType[MAX_RIDE_TYPES_PER_RIDE_ENTRY];
|
} RideInfo;
|
||||||
uint8 RideGroupIndex;
|
struct
|
||||||
};
|
{
|
||||||
struct
|
std::vector<rct_object_entry> Entries;
|
||||||
{
|
} SceneryGroupInfo;
|
||||||
uint16 NumThemeObjects;
|
|
||||||
rct_object_entry * ThemeObjects;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IObjectRepository
|
interface IObjectRepository
|
||||||
|
|
|
@ -372,15 +372,15 @@ void RideObject::SetRepositoryItem(ObjectRepositoryItem * item) const
|
||||||
{
|
{
|
||||||
for (sint32 i = 0; i < RCT2_MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
for (sint32 i = 0; i < RCT2_MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++)
|
||||||
{
|
{
|
||||||
item->RideType[i] = _legacyType.ride_type[i];
|
item->RideInfo.RideType[i] = _legacyType.ride_type[i];
|
||||||
}
|
}
|
||||||
for (sint32 i = 0; i < RCT2_MAX_CATEGORIES_PER_RIDE; i++)
|
for (sint32 i = 0; i < RCT2_MAX_CATEGORIES_PER_RIDE; i++)
|
||||||
{
|
{
|
||||||
item->RideCategory[i] = _legacyType.category[i];
|
item->RideInfo.RideCategory[i] = _legacyType.category[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 flags = 0;
|
uint8 flags = 0;
|
||||||
item->RideFlags = flags;
|
item->RideInfo.RideFlags = flags;
|
||||||
|
|
||||||
// Find the first non-null ride type, to be used when checking the ride group
|
// Find the first non-null ride type, to be used when checking the ride group
|
||||||
uint8 rideTypeIdx = ride_entry_get_first_non_null_ride_type(&_legacyType);
|
uint8 rideTypeIdx = ride_entry_get_first_non_null_ride_type(&_legacyType);
|
||||||
|
@ -408,7 +408,7 @@ void RideObject::SetRepositoryItem(ObjectRepositoryItem * item) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item->RideGroupIndex = rideGroupIndex;
|
item->RideInfo.RideGroupIndex = rideGroupIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RideObject::ReadLegacyVehicle(IReadObjectContext * context, IStream * stream, rct_ride_entry_vehicle * vehicle)
|
void RideObject::ReadLegacyVehicle(IReadObjectContext * context, IStream * stream, rct_ride_entry_vehicle * vehicle)
|
||||||
|
|
|
@ -107,14 +107,7 @@ void SceneryGroupObject::UpdateEntryIndexes()
|
||||||
|
|
||||||
void SceneryGroupObject::SetRepositoryItem(ObjectRepositoryItem * item) const
|
void SceneryGroupObject::SetRepositoryItem(ObjectRepositoryItem * item) const
|
||||||
{
|
{
|
||||||
Memory::Free(item->ThemeObjects);
|
item->SceneryGroupInfo.Entries = _items;
|
||||||
|
|
||||||
item->NumThemeObjects = (uint16)_items.size();
|
|
||||||
item->ThemeObjects = Memory::AllocateArray<rct_object_entry>(_items.size());
|
|
||||||
for (size_t i = 0; i < _items.size(); i++)
|
|
||||||
{
|
|
||||||
item->ThemeObjects[i] = _items[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<rct_object_entry> SceneryGroupObject::ReadItems(IStream * stream)
|
std::vector<rct_object_entry> SceneryGroupObject::ReadItems(IStream * stream)
|
||||||
|
|
|
@ -1900,7 +1900,7 @@ static money32 place_track_design(sint16 x, sint16 y, sint16 z, uint8 flags, uin
|
||||||
const ObjectRepositoryItem * ori = object_repository_find_object_by_name(rideEntryObject->name);
|
const ObjectRepositoryItem * ori = object_repository_find_object_by_name(rideEntryObject->name);
|
||||||
if (ori != nullptr)
|
if (ori != nullptr)
|
||||||
{
|
{
|
||||||
uint8 rideGroupIndex = ori->RideGroupIndex;
|
uint8 rideGroupIndex = ori->RideInfo.RideGroupIndex;
|
||||||
const RideGroup * td6RideGroup = RideGroupManager::RideGroupFind(td6->type, rideGroupIndex);
|
const RideGroup * td6RideGroup = RideGroupManager::RideGroupFind(td6->type, rideGroupIndex);
|
||||||
|
|
||||||
uint8 * availableRideEntries = get_ride_entry_indices_for_ride_type(td6->type);
|
uint8 * availableRideEntries = get_ride_entry_indices_for_ride_type(td6->type);
|
||||||
|
|
|
@ -205,7 +205,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const ObjectRepositoryItem * ori = repo->FindObject(item.ObjectEntry.c_str());
|
const ObjectRepositoryItem * ori = repo->FindObject(item.ObjectEntry.c_str());
|
||||||
uint8 rideGroupIndex = (ori != nullptr) ? ori->RideGroupIndex : 0;
|
uint8 rideGroupIndex = (ori != nullptr) ? ori->RideInfo.RideGroupIndex : 0;
|
||||||
const RideGroup * itemRideGroup = RideGroupManager::RideGroupFind(rideType, rideGroupIndex);
|
const RideGroup * itemRideGroup = RideGroupManager::RideGroupFind(rideType, rideGroupIndex);
|
||||||
|
|
||||||
if (itemRideGroup != nullptr && itemRideGroup->Equals(rideGroup))
|
if (itemRideGroup != nullptr && itemRideGroup->Equals(rideGroup))
|
||||||
|
@ -270,7 +270,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const ObjectRepositoryItem * ori = repo->FindObject(item.ObjectEntry.c_str());
|
const ObjectRepositoryItem * ori = repo->FindObject(item.ObjectEntry.c_str());
|
||||||
uint8 rideGroupIndex = (ori != nullptr) ? ori->RideGroupIndex : 0;
|
uint8 rideGroupIndex = (ori != nullptr) ? ori->RideInfo.RideGroupIndex : 0;
|
||||||
const RideGroup * itemRideGroup = RideGroupManager::RideGroupFind(rideType, rideGroupIndex);
|
const RideGroup * itemRideGroup = RideGroupManager::RideGroupFind(rideType, rideGroupIndex);
|
||||||
|
|
||||||
if (itemRideGroup != nullptr && itemRideGroup->Equals(rideGroup))
|
if (itemRideGroup != nullptr && itemRideGroup->Equals(rideGroup))
|
||||||
|
|
Loading…
Reference in New Issue