1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00
Files
OpenRCT2/src/openrct2/object/ObjectList.h
Aaron van Geffen a053a84486 Move all object units into OpenRCT2 namespace (#24980)
* Move all object units into OpenRCT2 namespace

* Dealing with fallout, part 1

* Dealing with fallout, part 2

* Dealing with fallout, part 3

* Apply clang-format in a few more places

* Remove redundant 'virtual' keyword
2025-08-17 06:46:03 -03:00

60 lines
2.1 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2025 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "Object.h"
#include <vector>
namespace OpenRCT2
{
class ObjectList
{
private:
std::vector<std::vector<ObjectEntryDescriptor>> _subLists;
public:
ObjectEntryIndex Add(const ObjectEntryDescriptor& entry);
std::vector<ObjectEntryDescriptor>& GetList(ObjectType type);
std::vector<ObjectEntryDescriptor>& GetList(ObjectType type) const;
const ObjectEntryDescriptor& GetObject(ObjectType type, ObjectEntryIndex index) const;
void SetObject(ObjectEntryIndex index, const ObjectEntryDescriptor& entry);
void SetObject(ObjectType type, ObjectEntryIndex index, std::string_view identifier);
ObjectEntryIndex Find(ObjectType type, std::string_view identifier) const;
ObjectEntryIndex FindLegacy(ObjectType type, std::string_view identifier) const;
struct const_iterator
{
private:
const ObjectList* _parent;
size_t _subList;
size_t _index;
void MoveToNextEntry();
public:
const_iterator(const ObjectList* parent, bool end);
const ObjectEntryDescriptor& operator*();
bool operator==(const_iterator& rhs);
bool operator!=(const_iterator& rhs);
const_iterator& operator++();
const_iterator operator++(int);
};
const_iterator begin() const;
const_iterator end() const;
};
void ObjectGetTypeEntryIndex(size_t index, ObjectType* outObjectType, ObjectEntryIndex* outEntryIndex);
size_t getObjectEntryGroupCount(ObjectType objectType);
size_t getObjectTypeLimit(ObjectType type);
} // namespace OpenRCT2