Replace most collections with Arbutils collections for more safety.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-22 19:21:40 +01:00
parent f190121e74
commit 27288563cd
40 changed files with 234 additions and 226 deletions

View File

@@ -2,17 +2,20 @@
#define CREATURELIB_LEARNABLEATTACKS_HPP
#include <Arbutils/Assert.hpp>
#include <Arbutils/Collections/Dictionary.hpp>
#include <Arbutils/Collections/List.hpp>
#include <unordered_map>
#include <vector>
#include "../Attacks/AttackData.hpp"
using namespace Arbutils::Collections;
namespace CreatureLib::Library {
class LearnableAttacks {
std::unordered_map<uint8_t, std::vector<const AttackData*>> _learnedByLevel;
Dictionary<uint8_t, List<const AttackData*>> _learnedByLevel;
public:
LearnableAttacks(size_t levelAttackCapacity)
: _learnedByLevel(std::unordered_map<uint8_t, std::vector<const AttackData*>>(levelAttackCapacity)) {
: _learnedByLevel(Dictionary<uint8_t, List<const AttackData*>>(levelAttackCapacity)) {
for (auto kv : _learnedByLevel) {
for (auto attack : kv.second)
AssertNotNull(attack)
@@ -21,7 +24,7 @@ namespace CreatureLib::Library {
void AddLevelMove(uint8_t level, const AttackData* attack);
const std::vector<const AttackData*>& GetAttacksForLevel(uint8_t level) const;
const List<const AttackData*>& GetAttacksForLevel(uint8_t level) const;
};
}