Return optional pointer instead of raw pointers in Pokemon::GetMoves
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
939cf4e328
commit
1c66aa8696
|
@ -42,8 +42,8 @@ namespace PkmnLib::Battling {
|
|||
|
||||
inline bool IsShiny() const noexcept { return _coloring == 1; }
|
||||
|
||||
const ArbUt::List<LearnedMove*>& GetMoves() const {
|
||||
return reinterpret_cast<const ArbUt::List<LearnedMove*>&>(_attacks);
|
||||
const ArbUt::List<ArbUt::OptionalBorrowedPtr<LearnedMove>>& GetMoves() const {
|
||||
return reinterpret_cast<const ArbUt::List<ArbUt::OptionalBorrowedPtr<LearnedMove>>&>(_attacks);
|
||||
}
|
||||
|
||||
inline const ArbUt::BorrowedPtr<const PkmnLib::Library::Nature>& GetNature() const noexcept { return _nature; }
|
||||
|
|
|
@ -28,9 +28,9 @@ TEST_CASE("Get Attack name from Pokemon") {
|
|||
.LearnMove("testMove"_cnc, CreatureLib::Battling::AttackLearnMethod::Level)
|
||||
.LearnMove("testMove2"_cnc, CreatureLib::Battling::AttackLearnMethod::Level)
|
||||
.Build();
|
||||
auto move = mon->GetMoves()[0];
|
||||
auto move = mon->GetMoves()[0].GetValue();
|
||||
REQUIRE(move->GetMoveData()->GetName() == "testMove"_cnc);
|
||||
auto move2 = mon->GetMoves()[1];
|
||||
auto move2 = mon->GetMoves()[1].GetValue();
|
||||
REQUIRE(move2->GetMoveData()->GetName() == "testMove2"_cnc);
|
||||
delete mon;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue