Fix for random value from library not working.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-04-24 18:43:18 +02:00
parent 3ad21fecc2
commit df37558ec0
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 3 additions and 2 deletions

View File

@ -13,6 +13,7 @@ namespace CreatureLib::Library {
template <class T> class BaseLibrary {
Arbutils::Collections::Dictionary<uint32_t, const T*> _values;
Arbutils::Collections::List<uint32_t> _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) {