Fixes CreatePokemon initializing invalid moves.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-08-29 17:06:45 +02:00
parent 75d6100689
commit bb4fd8456c
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 4 additions and 2 deletions

View File

@ -76,7 +76,9 @@ namespace PkmnLib::Battling {
for (size_t i = 0; i < _attacks.Count(); i++) { for (size_t i = 0; i < _attacks.Count(); i++) {
auto& kv = _attacks[i]; auto& kv = _attacks[i];
auto move = kv.Move; auto move = kv.Move;
attacks[i] = new LearnedMove(move, kv.LearnMethod); if (move.HasValue()) {
attacks[i] = new LearnedMove(move.GetValue(), kv.LearnMethod);
}
} }
auto ivs = CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 31>(_ivHp, _ivAttack, _ivDefense, _ivSpAtt, auto ivs = CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 31>(_ivHp, _ivAttack, _ivDefense, _ivSpAtt,
_ivSpDef, _ivSpeed); _ivSpDef, _ivSpeed);

View File

@ -18,7 +18,7 @@ namespace PkmnLib::Battling {
uint32_t _identifier = 0; uint32_t _identifier = 0;
struct ToLearnMethod { struct ToLearnMethod {
ArbUt::BorrowedPtr<const Library::MoveData> Move; ArbUt::OptionalBorrowedPtr<const Library::MoveData> Move;
CreatureLib::Battling::AttackLearnMethod LearnMethod; CreatureLib::Battling::AttackLearnMethod LearnMethod;
ToLearnMethod(ArbUt::BorrowedPtr<const Library::MoveData> move, ToLearnMethod(ArbUt::BorrowedPtr<const Library::MoveData> move,
CreatureLib::Battling::AttackLearnMethod method) CreatureLib::Battling::AttackLearnMethod method)