mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix remaining merge conflicts
This commit is contained in:
parent
7f6b2525a7
commit
80e0f990ab
|
@ -1838,7 +1838,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
// Details
|
||||
auto pathEl = tileElement->AsPath();
|
||||
auto footpathObj = pathEl->GetPathEntry();
|
||||
auto footpathObj = pathEl->GetLegacyPathEntry();
|
||||
if (footpathObj == nullptr)
|
||||
{
|
||||
// Surface name
|
||||
|
@ -1851,7 +1851,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
}
|
||||
|
||||
// Railings name
|
||||
auto railingsObj = pathEl->GetRailingEntry();
|
||||
auto railingsObj = pathEl->GetRailingsEntry();
|
||||
if (railingsObj != nullptr)
|
||||
{
|
||||
auto ft = Formatter();
|
||||
|
@ -1864,7 +1864,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
else
|
||||
{
|
||||
// Legacy path name
|
||||
auto footpathEntry = reinterpret_cast<rct_footpath_entry*>(footpathObj->GetLegacyData());
|
||||
auto footpathEntry = reinterpret_cast<const rct_footpath_entry*>(footpathObj->GetLegacyData());
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(footpathEntry->string_idx);
|
||||
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, ft, { COLOUR_WHITE });
|
||||
|
|
|
@ -253,7 +253,7 @@ void setup_in_use_selection_flags()
|
|||
if (item->LoadedObject != nullptr)
|
||||
{
|
||||
auto objectType = item->LoadedObject->GetObjectType();
|
||||
auto entryIndex = objectMgr.GetLoadedObjectEntryIndex(item->LoadedObject);
|
||||
auto entryIndex = objectMgr.GetLoadedObjectEntryIndex(item->LoadedObject.get());
|
||||
auto flags = Editor::GetSelectedObjectFlags(objectType, entryIndex);
|
||||
if (flags & OBJECT_SELECTION_FLAG_SELECTED)
|
||||
{
|
||||
|
|
|
@ -895,7 +895,7 @@ namespace OpenRCT2
|
|||
auto* pathElement = it.element->AsPath();
|
||||
if (pathElement->HasLegacyPathEntry())
|
||||
{
|
||||
auto pathEntryIndex = pathElement->GetPathEntryIndex();
|
||||
auto pathEntryIndex = pathElement->GetLegacyPathEntryIndex();
|
||||
if (pathToRailingsMap[pathEntryIndex] != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
if (pathElement->IsQueue())
|
||||
|
@ -903,7 +903,7 @@ namespace OpenRCT2
|
|||
else
|
||||
pathElement->SetSurfaceEntryIndex(pathToSurfaceMap[pathEntryIndex]);
|
||||
|
||||
pathElement->SetRailingEntryIndex(pathToRailingsMap[pathEntryIndex]);
|
||||
pathElement->SetRailingsEntryIndex(pathToRailingsMap[pathEntryIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1300,7 +1300,7 @@ namespace OpenRCT2
|
|||
{
|
||||
if (srcArray[i / 8] & (1 << (i % 8)))
|
||||
{
|
||||
ridesBeenOn.push_back(i);
|
||||
ridesBeenOn.push_back(static_cast<ride_id_t>(i));
|
||||
}
|
||||
}
|
||||
return ridesBeenOn;
|
||||
|
|
|
@ -26,6 +26,11 @@ public:
|
|||
return &_legacyType;
|
||||
}
|
||||
|
||||
const void* GetLegacyData() const
|
||||
{
|
||||
return &_legacyType;
|
||||
}
|
||||
|
||||
const PathSurfaceDescriptor& GetPathSurfaceDescriptor() const
|
||||
{
|
||||
return _pathSurfaceDescriptor;
|
||||
|
|
|
@ -237,68 +237,6 @@ std::optional<uint8_t> rct_object_entry::GetSceneryType() const
|
|||
}
|
||||
|
||||
bool rct_object_entry::IsEmpty() const
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
uint64_t a, b;
|
||||
std::memcpy(&a, reinterpret_cast<const uint8_t*>(this), 8);
|
||||
std::memcpy(&b, reinterpret_cast<const uint8_t*>(this) + 8, 8);
|
||||
|
||||
if (a == 0xFFFFFFFFFFFFFFFF && b == 0xFFFFFFFFFFFFFFFF)
|
||||
return true;
|
||||
if (a == 0 && b == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool rct_object_entry::operator==(const rct_object_entry& rhs) const
|
||||
{
|
||||
const auto a = this;
|
||||
const auto b = &rhs;
|
||||
|
||||
// If an official object don't bother checking checksum
|
||||
if ((a->flags & 0xF0) || (b->flags & 0xF0))
|
||||
{
|
||||
if (a->GetType() != b->GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int32_t match = memcmp(a->name, b->name, 8);
|
||||
if (match)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a->flags != b->flags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int32_t match = memcmp(a->name, b->name, 8);
|
||||
if (match)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (a->checksum != b->checksum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rct_object_entry::operator!=(const rct_object_entry& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Couples a zip archive and a zip item stream to ensure the lifetime of the zip archive is maintained
|
||||
* for the lifetime of the stream.
|
||||
*/
|
||||
class ZipStreamWrapper final : public IStream
|
||||
=======
|
||||
>>>>>>> upstream/develop
|
||||
{
|
||||
uint64_t a, b;
|
||||
std::memcpy(&a, reinterpret_cast<const uint8_t*>(this), 8);
|
||||
|
|
|
@ -89,8 +89,6 @@ void ObjectList::const_iterator::MoveToNextEntry()
|
|||
break;
|
||||
}
|
||||
} while (!_parent->_subLists[_subList][_index].HasValue());
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
}
|
||||
|
||||
ObjectList::const_iterator& ObjectList::const_iterator::operator++()
|
||||
|
@ -190,116 +188,6 @@ ObjectEntryIndex ObjectList::Find(ObjectType type, std::string_view identifier)
|
|||
}
|
||||
}
|
||||
return OBJECT_ENTRY_INDEX_NULL;
|
||||
>>>>>>> upstream/develop
|
||||
}
|
||||
|
||||
ObjectList::const_iterator& ObjectList::const_iterator::operator++()
|
||||
{
|
||||
MoveToNextEntry();
|
||||
return *this;
|
||||
}
|
||||
|
||||
ObjectList::const_iterator ObjectList::const_iterator::operator++(int)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
const ObjectEntryDescriptor& ObjectList::const_iterator::operator*()
|
||||
{
|
||||
return _parent->_subLists[_subList][_index];
|
||||
}
|
||||
|
||||
bool ObjectList::const_iterator::operator==(const_iterator& rhs)
|
||||
{
|
||||
return _parent == rhs._parent && _subList == rhs._subList && _index == rhs._index;
|
||||
}
|
||||
|
||||
bool ObjectList::const_iterator::operator!=(const_iterator& rhs)
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
ObjectList::const_iterator ObjectList::begin() const
|
||||
{
|
||||
return const_iterator(this, false);
|
||||
}
|
||||
|
||||
ObjectList::const_iterator ObjectList::end() const
|
||||
{
|
||||
return const_iterator(this, true);
|
||||
}
|
||||
|
||||
std::vector<ObjectEntryDescriptor>& ObjectList::GetList(ObjectType type)
|
||||
{
|
||||
auto index = static_cast<size_t>(type);
|
||||
while (_subLists.size() <= index)
|
||||
{
|
||||
_subLists.resize(static_cast<size_t>(index) + 1);
|
||||
}
|
||||
return _subLists[index];
|
||||
}
|
||||
|
||||
std::vector<ObjectEntryDescriptor>& ObjectList::GetList(ObjectType type) const
|
||||
{
|
||||
return const_cast<ObjectList*>(this)->GetList(type);
|
||||
}
|
||||
|
||||
const ObjectEntryDescriptor& ObjectList::GetObject(ObjectType type, ObjectEntryIndex index) const
|
||||
{
|
||||
const auto& subList = GetList(type);
|
||||
if (subList.size() > index)
|
||||
{
|
||||
return subList[index];
|
||||
}
|
||||
|
||||
static ObjectEntryDescriptor placeholder;
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
void ObjectList::Add(const ObjectEntryDescriptor& entry)
|
||||
{
|
||||
auto& subList = GetList(entry.GetType());
|
||||
subList.push_back(entry);
|
||||
}
|
||||
|
||||
void ObjectList::SetObject(ObjectEntryIndex index, const ObjectEntryDescriptor& entry)
|
||||
{
|
||||
auto& subList = GetList(entry.GetType());
|
||||
if (subList.size() <= index)
|
||||
{
|
||||
subList.resize(static_cast<size_t>(index) + 1);
|
||||
}
|
||||
subList[index] = entry;
|
||||
}
|
||||
|
||||
void ObjectList::SetObject(ObjectType type, ObjectEntryIndex index, std::string_view identifier)
|
||||
{
|
||||
auto entry = ObjectEntryDescriptor(identifier);
|
||||
entry.Type = type;
|
||||
SetObject(index, entry);
|
||||
}
|
||||
|
||||
ObjectEntryIndex ObjectList::Find(ObjectType type, std::string_view identifier)
|
||||
{
|
||||
auto& subList = GetList(type);
|
||||
for (size_t i = 0; i < subList.size(); i++)
|
||||
{
|
||||
if (subList[i].Identifier == identifier)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
return static_cast<ObjectEntryIndex>(i);
|
||||
=======
|
||||
auto thisEntry = object_entry_get_object(objectType, i)->GetObjectEntry();
|
||||
if (thisEntry == *entry)
|
||||
{
|
||||
*entry_type = objectType;
|
||||
*entryIndex = i;
|
||||
return true;
|
||||
}
|
||||
>>>>>>> upstream/develop
|
||||
}
|
||||
}
|
||||
return OBJECT_ENTRY_INDEX_NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -333,17 +221,6 @@ void get_type_entry_index(size_t index, ObjectType* outObjectType, ObjectEntryIn
|
|||
*outEntryIndex = static_cast<ObjectEntryIndex>(index);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
void* get_loaded_object_chunk(size_t index)
|
||||
{
|
||||
ObjectType objectType;
|
||||
ObjectEntryIndex entryIndex;
|
||||
get_type_entry_index(index, &objectType, &entryIndex);
|
||||
return object_entry_get_chunk(objectType, entryIndex);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> upstream/develop
|
||||
void object_entry_get_name_fixed(utf8* buffer, size_t bufferSize, const rct_object_entry* entry)
|
||||
{
|
||||
bufferSize = std::min(static_cast<size_t>(DAT_NAME_LENGTH) + 1, bufferSize);
|
||||
|
|
|
@ -174,14 +174,7 @@ public:
|
|||
// Load the required objects
|
||||
LoadObjects(requiredObjects);
|
||||
|
||||
<<<<<<< HEAD
|
||||
SetNewLoadedObjectList(std::move(loadedObjects));
|
||||
=======
|
||||
// Load defaults.
|
||||
LoadDefaultObjects();
|
||||
|
||||
// Update indices.
|
||||
>>>>>>> upstream/develop
|
||||
UpdateSceneryGroupIndexes();
|
||||
ResetTypeToRideEntryIndexMap();
|
||||
}
|
||||
|
@ -198,11 +191,7 @@ public:
|
|||
const auto* ori = _objectRepository.FindObject(descriptor);
|
||||
if (ori != nullptr)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
auto* loadedObject = ori->LoadedObject;
|
||||
=======
|
||||
auto* loadedObject = ori->LoadedObject.get();
|
||||
>>>>>>> upstream/develop
|
||||
if (loadedObject != nullptr)
|
||||
{
|
||||
UnloadObject(loadedObject);
|
||||
|
@ -250,12 +239,7 @@ public:
|
|||
{
|
||||
// TODO: remove ObjectGeneration::DAT check when the NSF is here
|
||||
const ObjectRepositoryItem* item = &_objectRepository.GetObjects()[i];
|
||||
<<<<<<< HEAD
|
||||
if (item->LoadedObject != nullptr && IsObjectCustom(item))
|
||||
=======
|
||||
if (item->LoadedObject != nullptr && IsObjectCustom(item) && item->LoadedObject->GetLegacyData() != nullptr
|
||||
&& item->LoadedObject->GetGeneration() == ObjectGeneration::DAT)
|
||||
>>>>>>> upstream/develop
|
||||
if (item->LoadedObject != nullptr && IsObjectCustom(item) && item->LoadedObject->GetLegacyData() != nullptr)
|
||||
{
|
||||
objects.push_back(item);
|
||||
}
|
||||
|
@ -317,22 +301,6 @@ private:
|
|||
{
|
||||
if (_loadedObjects.size() > static_cast<size_t>(*slot) && _loadedObjects[*slot] != nullptr)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
ObjectType objectType = ori->Type;
|
||||
if (slot)
|
||||
{
|
||||
if (_loadedObjects.size() > static_cast<size_t>(*slot) && _loadedObjects[*slot] != nullptr)
|
||||
{
|
||||
// Slot already taken
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
slot = FindSpareSlot(objectType);
|
||||
}
|
||||
if (slot)
|
||||
=======
|
||||
// Slot already taken
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -347,7 +315,6 @@ private:
|
|||
if (object != nullptr)
|
||||
{
|
||||
if (_loadedObjects.size() <= static_cast<size_t>(*slot))
|
||||
>>>>>>> upstream/develop
|
||||
{
|
||||
_loadedObjects.resize(slot.value() + 1);
|
||||
}
|
||||
|
@ -397,27 +364,18 @@ private:
|
|||
if (object == nullptr)
|
||||
return;
|
||||
|
||||
<<<<<<< HEAD
|
||||
object->Unload();
|
||||
|
||||
// TODO try to prevent doing a repository search
|
||||
const auto* ori = _objectRepository.FindObject(object->GetDescriptor());
|
||||
if (ori != nullptr)
|
||||
{
|
||||
_objectRepository.UnregisterLoadedObject(ori, object);
|
||||
}
|
||||
=======
|
||||
object->Unload();
|
||||
>>>>>>> upstream/develop
|
||||
}
|
||||
|
||||
// TODO try to prevent doing a repository search
|
||||
const auto* ori = _objectRepository.FindObject(object->GetDescriptor());
|
||||
if (ori != nullptr)
|
||||
{
|
||||
_objectRepository.UnregisterLoadedObject(ori, object);
|
||||
}
|
||||
|
||||
// Because it's possible to have the same loaded object for multiple
|
||||
// slots, we have to make sure find and set all of them to nullptr
|
||||
std::replace(_loadedObjects.begin(), _loadedObjects.end(), object, static_cast<Object*>(nullptr));
|
||||
// Because it's possible to have the same loaded object for multiple
|
||||
// slots, we have to make sure find and set all of them to nullptr
|
||||
std::replace(_loadedObjects.begin(), _loadedObjects.end(), object, static_cast<Object*>(nullptr));
|
||||
}
|
||||
|
||||
void UnloadObjectsExcept(const std::vector<Object*>& newLoadedObjects)
|
||||
|
@ -518,40 +476,32 @@ private:
|
|||
std::vector<const ObjectRepositoryItem*> requiredObjects;
|
||||
std::vector<ObjectEntryDescriptor> missingObjects;
|
||||
|
||||
<<<<<<< HEAD
|
||||
std::vector<const ObjectRepositoryItem*> GetRequiredObjects(const ObjectList& objectList)
|
||||
for (auto objectType = ObjectType::Ride; objectType < ObjectType::Count; objectType++)
|
||||
{
|
||||
std::vector<const ObjectRepositoryItem*> requiredObjects;
|
||||
std::vector<ObjectEntryDescriptor> missingObjects;
|
||||
|
||||
=======
|
||||
>>>>>>> upstream/develop
|
||||
for (auto objectType = ObjectType::Ride; objectType < ObjectType::Count; objectType++)
|
||||
auto maxObjectsOfType = static_cast<ObjectEntryIndex>(object_entry_group_counts[EnumValue(objectType)]);
|
||||
for (ObjectEntryIndex i = 0; i < maxObjectsOfType; i++)
|
||||
{
|
||||
auto maxObjectsOfType = static_cast<ObjectEntryIndex>(object_entry_group_counts[EnumValue(objectType)]);
|
||||
for (ObjectEntryIndex i = 0; i < maxObjectsOfType; i++)
|
||||
const ObjectRepositoryItem* ori = nullptr;
|
||||
const auto& entry = objectList.GetObject(objectType, i);
|
||||
if (entry.HasValue())
|
||||
{
|
||||
const ObjectRepositoryItem* ori = nullptr;
|
||||
const auto& entry = objectList.GetObject(objectType, i);
|
||||
if (entry.HasValue())
|
||||
ori = _objectRepository.FindObject(entry);
|
||||
if (ori == nullptr && entry.GetType() != ObjectType::ScenarioText)
|
||||
{
|
||||
ori = _objectRepository.FindObject(entry);
|
||||
if (ori == nullptr && entry.GetType() != ObjectType::ScenarioText)
|
||||
{
|
||||
missingObjects.push_back(entry);
|
||||
ReportMissingObject(entry);
|
||||
}
|
||||
missingObjects.push_back(entry);
|
||||
ReportMissingObject(entry);
|
||||
}
|
||||
requiredObjects.push_back(ori);
|
||||
}
|
||||
requiredObjects.push_back(ori);
|
||||
}
|
||||
}
|
||||
|
||||
if (!missingObjects.empty())
|
||||
{
|
||||
throw ObjectLoadException(std::move(missingObjects));
|
||||
}
|
||||
if (!missingObjects.empty())
|
||||
{
|
||||
throw ObjectLoadException(std::move(missingObjects));
|
||||
}
|
||||
|
||||
return requiredObjects;
|
||||
return requiredObjects;
|
||||
}
|
||||
|
||||
template<typename T, typename TFunc> static void ParallelFor(const std::vector<T>& items, TFunc func)
|
||||
|
@ -578,15 +528,10 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void LoadObjects(std::vector<const ObjectRepositoryItem*> & requiredObjects)
|
||||
void LoadObjects(std::vector<const ObjectRepositoryItem*>& requiredObjects)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
std::vector<std::unique_ptr<Object>> objects;
|
||||
std::vector<Object*> loadedObjects;
|
||||
=======
|
||||
std::vector<Object*> objects;
|
||||
std::vector<Object*> newLoadedObjects;
|
||||
>>>>>>> upstream/develop
|
||||
std::vector<ObjectEntryDescriptor> badObjects;
|
||||
objects.resize(OBJECT_ENTRY_COUNT);
|
||||
newLoadedObjects.reserve(OBJECT_ENTRY_COUNT);
|
||||
|
|
|
@ -31,19 +31,12 @@ struct IObjectManager
|
|||
virtual ObjectEntryIndex GetLoadedObjectEntryIndex(std::string_view identifier) abstract;
|
||||
virtual ObjectEntryIndex GetLoadedObjectEntryIndex(const ObjectEntryDescriptor& descriptor) abstract;
|
||||
virtual ObjectEntryIndex GetLoadedObjectEntryIndex(const Object* object) abstract;
|
||||
<<<<<<< HEAD
|
||||
virtual ObjectList GetLoadedObjects() abstract;
|
||||
=======
|
||||
>>>>>>> upstream/develop
|
||||
|
||||
virtual Object* LoadObject(std::string_view identifier) abstract;
|
||||
virtual Object* LoadObject(const rct_object_entry* entry) abstract;
|
||||
virtual Object* LoadObject(const ObjectEntryDescriptor& descriptor) abstract;
|
||||
virtual void LoadObjects(const ObjectList& entries) abstract;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
virtual void LoadDefaultObjects() abstract;
|
||||
>>>>>>> upstream/develop
|
||||
virtual void UnloadObjects(const std::vector<ObjectEntryDescriptor>& entries) abstract;
|
||||
virtual void UnloadAll() abstract;
|
||||
|
||||
|
|
|
@ -1497,24 +1497,7 @@ namespace RCT1
|
|||
|
||||
ObjectList GetRequiredObjects()
|
||||
{
|
||||
AppendRequiredObjects(entries, objectType, entryList.GetEntries());
|
||||
}
|
||||
|
||||
void AppendRequiredObjects(
|
||||
std::vector<rct_object_entry>& entries, ObjectType objectType, const std::vector<const char*>& objectNames)
|
||||
{
|
||||
for (const auto objectName : objectNames)
|
||||
{
|
||||
rct_object_entry entry{};
|
||||
entry.flags = ((static_cast<uint8_t>(ObjectSourceGame::RCT2) << 4) & 0xF0) | (EnumValue(objectType) & 0x0F);
|
||||
entry.SetName(objectName);
|
||||
entries.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<rct_object_entry> GetRequiredObjects()
|
||||
{
|
||||
std::vector<rct_object_entry> result;
|
||||
ObjectList result;
|
||||
AppendRequiredObjects(result, ObjectType::Ride, _rideEntries);
|
||||
AppendRequiredObjects(result, ObjectType::SmallScenery, _smallSceneryEntries);
|
||||
AppendRequiredObjects(result, ObjectType::LargeScenery, _largeSceneryEntries);
|
||||
|
@ -1537,6 +1520,11 @@ namespace RCT1
|
|||
}));
|
||||
AppendRequiredObjects(result, ObjectType::ParkEntrance, std::vector<std::string>({ "rct2.park_entrance.pkent1" }));
|
||||
AppendRequiredObjects(result, ObjectType::Water, _waterEntry);
|
||||
AppendRequiredObjects(result, ObjectType::TerrainSurface, _terrainSurfaceEntries);
|
||||
AppendRequiredObjects(result, ObjectType::TerrainEdge, _terrainEdgeEntries);
|
||||
AppendRequiredObjects(result, ObjectType::FootpathSurface, _footpathSurfaceEntries);
|
||||
AppendRequiredObjects(result, ObjectType::FootpathRailings, _footpathRailingsEntries);
|
||||
RCT12AddDefaultObjects(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1560,7 +1560,6 @@ public:
|
|||
return justText.data();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
ObjectList GetRequiredObjects()
|
||||
{
|
||||
std::fill(std::begin(_pathToSurfaceMap), std::end(_pathToSurfaceMap), OBJECT_ENTRY_INDEX_NULL);
|
||||
|
@ -1575,7 +1574,7 @@ public:
|
|||
{
|
||||
for (int16_t i = 0; i < rct2_object_entry_group_counts[objectType]; i++, objectIt++)
|
||||
{
|
||||
auto entry = ObjectEntryDescriptor(_s6.objects[objectIt]);
|
||||
auto entry = ObjectEntryDescriptor(_s6.Objects[objectIt]);
|
||||
if (entry.HasValue())
|
||||
{
|
||||
if (objectType == EnumValue(ObjectType::Paths))
|
||||
|
@ -1656,59 +1655,6 @@ public:
|
|||
}
|
||||
}
|
||||
return area;
|
||||
=======
|
||||
template<size_t TInternalLimit, typename T>
|
||||
static void AddRequiredObjects(std::vector<rct_object_entry>& required, const T& list)
|
||||
{
|
||||
rct_object_entry nullEntry = {};
|
||||
std::memset(&nullEntry, 0xFF, sizeof(nullEntry));
|
||||
|
||||
for (const auto& entry : list)
|
||||
{
|
||||
required.push_back(entry);
|
||||
}
|
||||
|
||||
// NOTE: The segment of this object type needs to be filled to the internal limit
|
||||
// the object manager currently expects this.
|
||||
for (size_t i = std::size(list); i < TInternalLimit; i++)
|
||||
{
|
||||
required.push_back(nullEntry);
|
||||
}
|
||||
}
|
||||
|
||||
ObjectList GetRequiredObjects()
|
||||
{
|
||||
std::vector<rct_object_entry> result;
|
||||
|
||||
AddRequiredObjects<MAX_RIDE_OBJECTS>(result, _s6.RideObjects);
|
||||
AddRequiredObjects<MAX_SMALL_SCENERY_OBJECTS>(result, _s6.SceneryObjects);
|
||||
AddRequiredObjects<MAX_LARGE_SCENERY_OBJECTS>(result, _s6.LargeSceneryObjects);
|
||||
AddRequiredObjects<MAX_WALL_SCENERY_OBJECTS>(result, _s6.WallSceneryObjects);
|
||||
AddRequiredObjects<MAX_BANNER_OBJECTS>(result, _s6.BannerObjects);
|
||||
AddRequiredObjects<MAX_PATH_OBJECTS>(result, _s6.PathObjects);
|
||||
AddRequiredObjects<MAX_PATH_ADDITION_OBJECTS>(result, _s6.PathAdditionObjects);
|
||||
AddRequiredObjects<MAX_SCENERY_GROUP_OBJECTS>(result, _s6.SceneryGroupObjects);
|
||||
AddRequiredObjects<MAX_PARK_ENTRANCE_OBJECTS>(result, _s6.ParkEntranceObjects);
|
||||
AddRequiredObjects<MAX_WATER_OBJECTS>(result, _s6.WaterObjects);
|
||||
AddRequiredObjects<MAX_SCENARIO_TEXT_OBJECTS>(result, _s6.ScenarioTextObjects);
|
||||
|
||||
ObjectList objectList;
|
||||
for (size_t i = 0; i < result.size(); i++)
|
||||
{
|
||||
ObjectType objectType;
|
||||
ObjectEntryIndex entryIndex;
|
||||
get_type_entry_index(i, &objectType, &entryIndex);
|
||||
|
||||
auto desc = ObjectEntryDescriptor(result[i]);
|
||||
if (desc.HasValue())
|
||||
{
|
||||
assert(desc.GetType() == objectType);
|
||||
objectList.SetObject(entryIndex, desc);
|
||||
}
|
||||
}
|
||||
|
||||
return objectList;
|
||||
>>>>>>> upstream/develop
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1028,7 +1028,7 @@ void Ride::Update()
|
|||
{
|
||||
// Breakdown updates are distributed, only one ride can update the breakdown status per tick.
|
||||
const auto updatingRideId = (gCurrentTicks / 2) % MAX_RIDES;
|
||||
if (updatingRideId == id)
|
||||
if (static_cast<ride_id_t>(updatingRideId) == id)
|
||||
ride_breakdown_status_update(this);
|
||||
}
|
||||
|
||||
|
@ -5757,7 +5757,7 @@ std::vector<ride_id_t> GetTracklessRides()
|
|||
auto trackEl = it.element->AsTrack();
|
||||
if (trackEl != nullptr && !trackEl->IsGhost())
|
||||
{
|
||||
auto rideId = trackEl->GetRideIndex();
|
||||
auto rideId = static_cast<size_t>(trackEl->GetRideIndex());
|
||||
if (rideId >= seen.size())
|
||||
{
|
||||
seen.resize(rideId + 1);
|
||||
|
@ -5771,7 +5771,7 @@ std::vector<ride_id_t> GetTracklessRides()
|
|||
std::vector<ride_id_t> result;
|
||||
for (const auto& ride : rideManager)
|
||||
{
|
||||
if (seen.size() <= ride.id || !seen[ride.id])
|
||||
if (seen.size() <= static_cast<size_t>(ride.id) || !seen[static_cast<size_t>(ride.id)])
|
||||
{
|
||||
result.push_back(ride.id);
|
||||
}
|
||||
|
|
|
@ -670,7 +670,7 @@ static ObjectEntryIndex TrackDesignGetDefaultSurfaceIndex(bool isQueue)
|
|||
{
|
||||
for (ObjectEntryIndex i = 0; i < MAX_FOOTPATH_SURFACE_OBJECTS; i++)
|
||||
{
|
||||
auto footpathSurfaceObj = get_path_surface_entry(i);
|
||||
auto footpathSurfaceObj = GetPathSurfaceEntry(i);
|
||||
if (footpathSurfaceObj != nullptr)
|
||||
{
|
||||
if (footpathSurfaceObj->Flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR)
|
||||
|
@ -693,7 +693,7 @@ static ObjectEntryIndex TrackDesignGetDefaultRailingIndex()
|
|||
{
|
||||
for (ObjectEntryIndex i = 0; i < MAX_FOOTPATH_RAILINGS_OBJECTS; i++)
|
||||
{
|
||||
auto footpathRailingsObj = get_path_railings_entry(i);
|
||||
auto footpathRailingsObj = GetPathRailingsEntry(i);
|
||||
if (footpathRailingsObj != nullptr)
|
||||
{
|
||||
return i;
|
||||
|
@ -1258,7 +1258,7 @@ static std::optional<money32> TrackDesignPlaceSceneryElement(
|
|||
if (isQueue)
|
||||
constructFlags |= PathConstructFlag::IsQueue;
|
||||
if (entryInfo->Type == ObjectType::Paths)
|
||||
constructFlags |= PathConstructFlag::IsPathObject;
|
||||
constructFlags |= PathConstructFlag::IsLegacyPathObject;
|
||||
auto footpathPlaceAction = FootpathPlaceFromTrackAction(
|
||||
{ mapCoord.x, mapCoord.y, z * COORDS_Z_STEP }, slope, entryInfo->Index, entryInfo->SecondaryIndex,
|
||||
edges, constructFlags);
|
||||
|
|
|
@ -346,7 +346,7 @@ static TrackDesignAddStatus track_design_save_add_wall(const CoordsXY& loc, Wall
|
|||
static std::optional<rct_object_entry> track_design_save_footpath_get_best_entry(PathElement* pathElement)
|
||||
{
|
||||
rct_object_entry pathEntry;
|
||||
auto legacyPathObj = pathElement->GetPathEntry();
|
||||
auto legacyPathObj = pathElement->GetLegacyPathEntry();
|
||||
if (legacyPathObj != nullptr)
|
||||
{
|
||||
pathEntry = legacyPathObj->GetObjectEntry();
|
||||
|
@ -361,7 +361,7 @@ static std::optional<rct_object_entry> track_design_save_footpath_get_best_entry
|
|||
if (surfaceEntry != nullptr)
|
||||
{
|
||||
auto surfaceId = surfaceEntry->GetIdentifier();
|
||||
auto railingsEntry = pathElement->GetRailingEntry();
|
||||
auto railingsEntry = pathElement->GetRailingsEntry();
|
||||
auto railingsId = railingsEntry == nullptr ? "" : railingsEntry->GetIdentifier();
|
||||
return GetBestObjectEntryForSurface(surfaceId, railingsId);
|
||||
}
|
||||
|
|
|
@ -1271,7 +1271,7 @@ namespace OpenRCT2::Scripting
|
|||
if (_element->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
auto el = _element->AsPath();
|
||||
auto index = el->GetRailingEntryIndex();
|
||||
auto index = el->GetRailingsEntryIndex();
|
||||
if (index != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
duk_push_int(ctx, index);
|
||||
|
@ -1294,7 +1294,7 @@ namespace OpenRCT2::Scripting
|
|||
if (_element->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
auto el = _element->AsPath();
|
||||
el->SetRailingEntryIndex(FromDuk<ObjectEntryIndex>(value));
|
||||
el->SetRailingsEntryIndex(FromDuk<ObjectEntryIndex>(value));
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,27 +125,6 @@ struct FootpathSelection
|
|||
}
|
||||
};
|
||||
|
||||
using PathConstructFlags = uint8_t;
|
||||
namespace PathConstructFlag
|
||||
{
|
||||
constexpr PathConstructFlags IsQueue = 1 << 0;
|
||||
constexpr PathConstructFlags IsPathObject = 1 << 1;
|
||||
} // namespace PathConstructFlag
|
||||
|
||||
struct FootpathSelection
|
||||
{
|
||||
ObjectEntryIndex LegacyPath = OBJECT_ENTRY_INDEX_NULL;
|
||||
ObjectEntryIndex NormalSurface = OBJECT_ENTRY_INDEX_NULL;
|
||||
ObjectEntryIndex QueueSurface = OBJECT_ENTRY_INDEX_NULL;
|
||||
ObjectEntryIndex Railings = OBJECT_ENTRY_INDEX_NULL;
|
||||
bool IsQueueSelected{};
|
||||
|
||||
ObjectEntryIndex GetSelectedSurface() const
|
||||
{
|
||||
return IsQueueSelected ? QueueSurface : NormalSurface;
|
||||
}
|
||||
};
|
||||
|
||||
struct ProvisionalFootpath
|
||||
{
|
||||
ObjectEntryIndex Type;
|
||||
|
|
Loading…
Reference in New Issue