From a95b6d18175f06f9a4688702bb5ecbab9422225b Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 17 Apr 2020 20:15:21 +0200 Subject: [PATCH] C Interface for nature. --- CInterface/Library/Nature.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CInterface/Library/Nature.cpp diff --git a/CInterface/Library/Nature.cpp b/CInterface/Library/Nature.cpp new file mode 100644 index 0000000..f73d5bd --- /dev/null +++ b/CInterface/Library/Nature.cpp @@ -0,0 +1,23 @@ +#include "../../src/Library/Natures/Nature.hpp" +#include "../Core.hpp" +using namespace PkmnLib::Library; + +export Nature* PkmnLib_Nature_Construct(CreatureLib::Library::Statistic increasedStat, CreatureLib::Library::Statistic decreasedStat, + float increasedModifier, float decreasedModifier) { + return new Nature(increasedStat, decreasedStat, increasedModifier, decreasedModifier); +} +export void PkmnLib_Nature_Destruct(const Nature* p) { delete p; } + +#define SIMPLE_GET_FUNC(type, name, returnType) \ + export returnType PkmnLib_##type##_##name(const PkmnLib::Library::type* p) { return p->name(); } + +SIMPLE_GET_FUNC(Nature, GetIncreaseModifier, float) +SIMPLE_GET_FUNC(Nature, GetDecreaseModifier, float) +SIMPLE_GET_FUNC(Nature, GetIncreasedStat, CreatureLib::Library::Statistic) +SIMPLE_GET_FUNC(Nature, GetDecreasedStat, CreatureLib::Library::Statistic) + +#undef SIMPLE_GET_FUNC + +export float PkmnLib_Nature_GetStatModifier(PkmnLib::Library::Nature nature, CreatureLib::Library::Statistic stat){ + return nature.GetStatModifier(stat); +} \ No newline at end of file