From df37558ec09a888e19373c97c45de81502ac537d Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 24 Apr 2020 18:43:18 +0200 Subject: [PATCH] Fix for random value from library not working. --- src/Library/BaseLibrary.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Library/BaseLibrary.hpp b/src/Library/BaseLibrary.hpp index a07028c..a8bdfa5 100644 --- a/src/Library/BaseLibrary.hpp +++ b/src/Library/BaseLibrary.hpp @@ -13,6 +13,7 @@ namespace CreatureLib::Library { template class BaseLibrary { Arbutils::Collections::Dictionary _values; Arbutils::Collections::List _listValues; + size_t _index; public: BaseLibrary(size_t initialCapacity = 32) : _values(initialCapacity), _listValues(initialCapacity) {} @@ -27,12 +28,12 @@ namespace CreatureLib::Library { inline void Insert(const Arbutils::CaseInsensitiveConstString& key, const T* value) { AssertNotNull(value) _values.Insert(key.GetHash(), value); - _listValues.Append(key); + _listValues[_index++] = key; } inline void Insert(uint32_t hashedKey, const T* value) { AssertNotNull(value) _values.Insert(hashedKey, value); - _listValues.Append(hashedKey); + _listValues[_index++] = hashedKey; } inline void Delete(const Arbutils::CaseInsensitiveConstString& key) {