Replace most collections with Arbutils collections for more safety.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user