diff --git a/OpenRCT2.xcodeproj/project.pbxproj b/OpenRCT2.xcodeproj/project.pbxproj index 199f5a71b6..ed9e0c686d 100644 --- a/OpenRCT2.xcodeproj/project.pbxproj +++ b/OpenRCT2.xcodeproj/project.pbxproj @@ -557,7 +557,6 @@ D44270EA1CC81B3200D84D28 /* IStream.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = IStream.hpp; sourceTree = ""; usesTabs = 0; }; D44270EB1CC81B3200D84D28 /* Json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Json.cpp; sourceTree = ""; usesTabs = 0; }; D44270EC1CC81B3200D84D28 /* Json.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Json.hpp; sourceTree = ""; usesTabs = 0; }; - D44270ED1CC81B3200D84D28 /* List.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = List.hpp; sourceTree = ""; usesTabs = 0; }; D44270EE1CC81B3200D84D28 /* Math.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Math.hpp; sourceTree = ""; usesTabs = 0; }; D44270EF1CC81B3200D84D28 /* Memory.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Memory.hpp; sourceTree = ""; usesTabs = 0; }; D44270F01CC81B3200D84D28 /* Path.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Path.cpp; sourceTree = ""; usesTabs = 0; }; @@ -1369,7 +1368,6 @@ D44270EA1CC81B3200D84D28 /* IStream.hpp */, D44270EB1CC81B3200D84D28 /* Json.cpp */, D44270EC1CC81B3200D84D28 /* Json.hpp */, - D44270ED1CC81B3200D84D28 /* List.hpp */, D44270EE1CC81B3200D84D28 /* Math.hpp */, D44270EF1CC81B3200D84D28 /* Memory.hpp */, D464FEBC1D31A66E00CBABAC /* MemoryStream.cpp */, diff --git a/openrct2.vcxproj b/openrct2.vcxproj index a92c9f7118..81a261d1d1 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -372,7 +372,6 @@ - diff --git a/src/core/List.hpp b/src/core/List.hpp deleted file mode 100644 index 70c1897144..0000000000 --- a/src/core/List.hpp +++ /dev/null @@ -1,150 +0,0 @@ -#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers -/***************************************************************************** - * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. - * - * OpenRCT2 is the work of many authors, a full list can be found in contributors.md - * For more information, visit https://github.com/OpenRCT2/OpenRCT2 - * - * OpenRCT2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * A full copy of the GNU General Public License can be found in licence.txt - *****************************************************************************/ -#pragma endregion - -#pragma once - -#include -#include - -#include "../common.h" -#include "Guard.hpp" -#include "Memory.hpp" - -/** - * A container that stores elements in contiguous memory. Automatically reallocates memory when required. Equivalent to - * std::vector. - */ -template -class List : public std::vector -{ -public: - typedef typename std::vector::const_reference const_reference; - typedef typename std::vector::reference reference; - size_t GetCapacity() const { return this->capacity(); } - size_t GetCount() const { return this->size(); } - const T * GetItems() const { return this->data(); } - - List() : std::vector() { } - - List(std::initializer_list initializerList) : std::vector(initializerList) { } - - List(size_t capacity) : std::vector(capacity) { } - - List(const T * items, size_t count) : std::vector(items, items + count) { } - - void EnsureCapacity(size_t capacity) - { - this->reserve(capacity); - } - - void ShrinkToLength() - { - this->shrink_to_fit(); - } - - void Clear() - { - this->clear(); - } - - void Add(T item) - { - this->push_back(item); - } - - void AddRange(std::initializer_list initializerList) - { - this->insert(this->end(), initializerList.begin(), initializerList.end()); - } - - void Insert(T item, size_t index) - { - Guard::ArgumentInRange(index, (size_t)0, this->size(), GUARD_LINE); - this->insert(this->begin() + index, item); - } - - bool Remove(T item) - { - for (size_t i = 0; i < this->size(); i++) - { - if (*this[i] == item) - { - RemoveAt(i); - return true; - } - } - return false; - } - - void RemoveAt(size_t index) - { - Guard::ArgumentInRange(index, (size_t)0, this->size() - 1, GUARD_LINE); - this->erase(this->begin() + index); - } - - const T * ToArray() const - { - return Memory::DuplicateArray(this->data(), this->size()); - } - - const_reference operator[](size_t index) const - { - Guard::ArgumentInRange(index, (size_t)0, this->size() - 1, GUARD_LINE); - return std::vector::operator[](index); - } - - reference operator[](size_t index) - { - Guard::ArgumentInRange(index, (size_t)0, this->size() - 1, GUARD_LINE); - return std::vector::operator[](index); - } - - size_t IndexOf(std::function predicate) - { - for (size_t i = 0; i < this->size(); i++) - { - T item = std::vector::operator[](i); - if (predicate(item)) - { - return i; - } - } - return SIZE_MAX; - } - - size_t IndexOf(T item, std::function comparer) - { - for (size_t i = 0; i < this->size(); i++) - { - T element = std::vector::operator[](i); - if (comparer(item, element)) - { - return i; - } - } - return SIZE_MAX; - } - - bool Contains(std::function predicate) - { - return IndexOf(predicate) != SIZE_MAX; - } - - bool Contains(T item, std::function comparer) - { - return IndexOf(item, comparer) != SIZE_MAX; - } -}; diff --git a/src/rct1/tables.cpp b/src/rct1/tables.cpp index 55c5eb4538..dfd14d8465 100644 --- a/src/rct1/tables.cpp +++ b/src/rct1/tables.cpp @@ -15,7 +15,7 @@ #pragma endregion #include "../common.h" -#include "../core/List.hpp" +#include "../core/Guard.hpp" #include "../core/Util.hpp" #include "Tables.h"