Ensure AddLevelAttack adds to distinctMoves
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-04-19 19:11:48 +02:00
parent 680f949df8
commit a580649224
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 4 additions and 2 deletions

View File

@ -2,7 +2,7 @@
using namespace CreatureLib::Library; using namespace CreatureLib::Library;
void LearnableAttacks::AddLevelMove(uint8_t level, const AttackData* attack) { void LearnableAttacks::AddLevelAttack(uint8_t level, const AttackData* attack) {
List<const AttackData*> levelData; List<const AttackData*> levelData;
if (_learnedByLevel.TryGet(level, levelData)) { if (_learnedByLevel.TryGet(level, levelData)) {
@ -11,6 +11,7 @@ void LearnableAttacks::AddLevelMove(uint8_t level, const AttackData* attack) {
levelData = {attack}; levelData = {attack};
_learnedByLevel.Insert(level, levelData); _learnedByLevel.Insert(level, levelData);
} }
_distinctAttacks.insert(attack);
} }
const List<const AttackData*>& LearnableAttacks::GetAttacksForLevel(uint8_t level) const { const List<const AttackData*>& LearnableAttacks::GetAttacksForLevel(uint8_t level) const {

View File

@ -12,6 +12,7 @@ using namespace Arbutils::Collections;
namespace CreatureLib::Library { namespace CreatureLib::Library {
class LearnableAttacks { class LearnableAttacks {
protected:
Dictionary<uint8_t, List<const AttackData*>> _learnedByLevel; Dictionary<uint8_t, List<const AttackData*>> _learnedByLevel;
std::unordered_set<const AttackData*> _distinctAttacks; std::unordered_set<const AttackData*> _distinctAttacks;
@ -28,7 +29,7 @@ namespace CreatureLib::Library {
virtual ~LearnableAttacks() = default; virtual ~LearnableAttacks() = default;
void AddLevelMove(uint8_t level, const AttackData* attack); void AddLevelAttack(uint8_t level, const AttackData* attack);
const List<const AttackData*>& GetAttacksForLevel(uint8_t level) const; const List<const AttackData*>& GetAttacksForLevel(uint8_t level) const;