Reworked LearnedAttacks class, added C interface.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-02 15:23:08 +01:00
parent 60cbc80549
commit 3bca3c0673
3 changed files with 37 additions and 8 deletions

View File

@@ -1,19 +1,21 @@
#ifndef CREATURELIB_LEARNABLEATTACKS_HPP
#define CREATURELIB_LEARNABLEATTACKS_HPP
#include <unordered_map>
#include <vector>
#include "../Attacks/AttackData.hpp"
namespace CreatureLib::Library {
class LearnableAttacks {
std::vector<std::vector<const AttackData*>> _learnedByLevel;
std::unordered_map<uint8_t, std::vector<const AttackData*>> _learnedByLevel;
public:
LearnableAttacks(uint8_t maxLevel) : _learnedByLevel(std::vector<std::vector<const AttackData*>>(maxLevel)) {}
LearnableAttacks(size_t levelAttackCapacity)
: _learnedByLevel(std::unordered_map<uint8_t, std::vector<const AttackData*>>(levelAttackCapacity)) {}
void AddLevelMove(uint8_t level, AttackData* attack);
void AddLevelMove(uint8_t level, const AttackData* attack);
const std::vector<const AttackData*>& GetMovesForLevel(uint8_t level) const;
const std::vector<const AttackData*>& GetAttacksForLevel(uint8_t level) const;
};
}