SUpport for EggMoves
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-11 19:36:18 +02:00
parent badfccf440
commit 9274b675e9
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 42 additions and 0 deletions

View File

@ -29,5 +29,7 @@ public:
export returnType PkmnLib_##type##_##name(const type* p) { return p->name(); }
#define SIMPLE_GET_FUNC_SMART_PTR(type, name, returnType) \
export returnType PkmnLib_##type##_##name(const type* p) { return p->name().GetRaw(); }
#define DESTRUCTOR(type) \
export void PkmnLib_##type##_Destruct(const type* p) { delete p; }
#endif // PKMNLIB_CORE_HPP

View File

@ -0,0 +1,14 @@
#include "../../src/Library/Species/LearnableMoves.hpp"
#include "../Core.hpp"
using namespace PkmnLib::Library;
export uint8_t PkmnLib_LearnableMoves_Construct(LearnableMoves*& out, size_t levelAttackCapacity) {
Try(out = new LearnableMoves(levelAttackCapacity));
}
DESTRUCTOR(LearnableMoves)
export void PkmnLib_LearnableMoves_AddEggMove(LearnableMoves* p, MoveData* move) { p->AddEggMove(move); }
export size_t PkmnLib_LearnableMoves_GetEggMovesCount(LearnableMoves* p) { return p->GetEggMoves().Count(); }
export const MoveData* const* PkmnLib_LearnableMoves_GetEggMoves(LearnableMoves* p) {
return reinterpret_cast<const MoveData* const*>(p->GetEggMoves().RawData());
}

View File

@ -0,0 +1 @@
#include "LearnableMoves.hpp"

View File

@ -0,0 +1,25 @@
#ifndef PKMNLIB_LEARNABLEMOVES_HPP
#define PKMNLIB_LEARNABLEMOVES_HPP
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/Memory/BorrowedPtr.hpp>
#include <CreatureLib/Library/CreatureData/LearnableAttacks.hpp>
#include "../Moves/MoveData.hpp"
namespace PkmnLib::Library {
class LearnableMoves : CreatureLib::Library::LearnableAttacks {
ArbUt::List<ArbUt::BorrowedPtr<const MoveData>> _eggMoves;
public:
explicit LearnableMoves(size_t levelAttackCapacity) : LearnableAttacks(levelAttackCapacity) {}
void AddEggMove(const ArbUt::BorrowedPtr<const MoveData>& move) noexcept {
if (!_eggMoves.Contains(move))
_eggMoves.Append(move);
}
const ArbUt::List<ArbUt::BorrowedPtr<const MoveData>>& GetEggMoves() const noexcept { return _eggMoves; }
};
}
#endif // PKMNLIB_LEARNABLEMOVES_HPP