Fixes and improvements for LearnableAttacks,
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -3,12 +3,11 @@
|
||||
using namespace CreatureLib::Library;
|
||||
|
||||
void LearnableAttacks::AddLevelAttack(uint8_t level, const AttackData* attack) {
|
||||
ArbUt::List<const AttackData*> levelData;
|
||||
if (_learnedByLevel.TryGet(level, levelData)) {
|
||||
levelData.Append(attack);
|
||||
if (_learnedByLevel.Has(level)) {
|
||||
_learnedByLevel[level].Append(attack);
|
||||
} else {
|
||||
levelData = {attack};
|
||||
_learnedByLevel.Insert(level, levelData);
|
||||
_learnedByLevel.Insert(level, {attack});
|
||||
}
|
||||
_distinctLevelAttacks.insert(attack);
|
||||
if (!_distinctLevelAttacks.Contains(attack))
|
||||
_distinctLevelAttacks.Append(attack);
|
||||
}
|
||||
Reference in New Issue
Block a user