26 lines
1.5 KiB
C++
26 lines
1.5 KiB
C++
#include "../../src/Library/DataLibrary.hpp"
|
|
#include "../Core.hpp"
|
|
using namespace CreatureLib::Library;
|
|
|
|
export uint8_t CreatureLib_DataLibrary_Construct(const DataLibrary*& out, LibrarySettings* settings,
|
|
SpeciesLibrary* species, AttackLibrary* attacks, ItemLibrary* items,
|
|
GrowthRateLibrary* growthRates, TypeLibrary* typeLibrary) {
|
|
Try(out = new DataLibrary(
|
|
std::unique_ptr<const LibrarySettings>(settings), std::unique_ptr<const SpeciesLibrary>(species),
|
|
std::unique_ptr<const AttackLibrary>(attacks), std::unique_ptr<const ItemLibrary>(items),
|
|
std::unique_ptr<const GrowthRateLibrary>(growthRates), std::unique_ptr<const TypeLibrary>(typeLibrary));)
|
|
}
|
|
|
|
export void CreatureLib_DataLibrary_Destruct(const DataLibrary* p) { delete p; }
|
|
|
|
#define SIMPLE_GET_FUNC(type, name, returnType) \
|
|
export returnType CreatureLib_##type##_##name(const type* p) { return p->name().get(); }
|
|
|
|
SIMPLE_GET_FUNC(DataLibrary, GetSettings, const LibrarySettings*);
|
|
SIMPLE_GET_FUNC(DataLibrary, GetSpeciesLibrary, const SpeciesLibrary*);
|
|
SIMPLE_GET_FUNC(DataLibrary, GetAttackLibrary, const AttackLibrary*);
|
|
SIMPLE_GET_FUNC(DataLibrary, GetItemLibrary, const ItemLibrary*);
|
|
SIMPLE_GET_FUNC(DataLibrary, GetGrowthRates, const GrowthRateLibrary*);
|
|
SIMPLE_GET_FUNC(DataLibrary, GetTypeLibrary, const TypeLibrary*);
|
|
|
|
#undef SIMPLE_GET_FUNC |