Cleanup of CInterface, removed operator-> on BorrowedPtr, as it throws when null.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-07-07 15:54:25 +02:00
parent e0821c1a68
commit d50926afba
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
6 changed files with 8 additions and 32 deletions

View File

@ -22,11 +22,6 @@ export Pokemon* PkmnLib_Pokemon_Construct(const BattleLibrary* library, const Pk
export void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; } export void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; }
#define SIMPLE_GET_FUNC(type, name, returnType) \
export returnType PkmnLib_##type##_##name(const PkmnLib::Battling::type* p) { return p->name(); }
#define SIMPLE_GET_FUNC_SMART_PTR(type, name, returnType) \
export returnType PkmnLib_##type##_##name(const PkmnLib::Battling::type* p) { return p->name().operator->(); }
SIMPLE_GET_FUNC(Pokemon, IsShiny, bool) SIMPLE_GET_FUNC(Pokemon, IsShiny, bool)
SIMPLE_GET_FUNC_SMART_PTR(Pokemon, GetNature, const PkmnLib::Library::Nature*) SIMPLE_GET_FUNC_SMART_PTR(Pokemon, GetNature, const PkmnLib::Library::Nature*)
@ -38,6 +33,3 @@ export uint8_t PkmnLib_Pokemon_GetIndividualValue(const Pokemon* p, CreatureLib:
export uint8_t PkmnLib_Pokemon_GetEffortValue(const Pokemon* p, CreatureLib::Library::Statistic stat) { export uint8_t PkmnLib_Pokemon_GetEffortValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
return p->GetEffortValue(stat); return p->GetEffortValue(stat);
} }
#undef SIMPLE_GET_FUNC
#undef SIMPLE_GET_FUNC_SMART_PTR

View File

@ -26,4 +26,9 @@ public:
return PkmnLibException; \ return PkmnLibException; \
} }
#define SIMPLE_GET_FUNC(type, name, returnType) \
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(); }
#endif // PKMNLIB_CORE_HPP #endif // PKMNLIB_CORE_HPP

View File

@ -16,9 +16,4 @@ export Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::Item
export void PkmnLib_Item_Destruct(const Item* p) { delete p; } export void PkmnLib_Item_Destruct(const Item* 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(Item, GetFlingPower, uint8_t) SIMPLE_GET_FUNC(Item, GetFlingPower, uint8_t)
#undef SIMPLE_GET_FUNC

View File

@ -9,9 +9,4 @@ export const LibrarySettings* PkmnLib_LibrarySettings_Construct(uint8_t maximalL
export void PkmnLib_LibrarySettings_Destruct(const LibrarySettings* p) { delete p; } export void PkmnLib_LibrarySettings_Destruct(const LibrarySettings* 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(LibrarySettings, GetShinyRate, uint16_t); SIMPLE_GET_FUNC(LibrarySettings, GetShinyRate, uint16_t);
#undef SIMPLE_GET_FUNC

View File

@ -9,16 +9,11 @@ export Nature* PkmnLib_Nature_Construct(CreatureLib::Library::Statistic increase
} }
export void PkmnLib_Nature_Destruct(const Nature* p) { delete p; } 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, GetIncreaseModifier, float)
SIMPLE_GET_FUNC(Nature, GetDecreaseModifier, float) SIMPLE_GET_FUNC(Nature, GetDecreaseModifier, float)
SIMPLE_GET_FUNC(Nature, GetIncreasedStat, CreatureLib::Library::Statistic) SIMPLE_GET_FUNC(Nature, GetIncreasedStat, CreatureLib::Library::Statistic)
SIMPLE_GET_FUNC(Nature, GetDecreasedStat, CreatureLib::Library::Statistic) SIMPLE_GET_FUNC(Nature, GetDecreasedStat, CreatureLib::Library::Statistic)
#undef SIMPLE_GET_FUNC
export float PkmnLib_Nature_GetStatModifier(const PkmnLib::Library::Nature* nature, export float PkmnLib_Nature_GetStatModifier(const PkmnLib::Library::Nature* nature,
CreatureLib::Library::Statistic stat) { CreatureLib::Library::Statistic stat) {
return nature->GetStatModifier(stat); return nature->GetStatModifier(stat);

View File

@ -11,13 +11,7 @@ export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint
export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; } export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* 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(PokemonSpecies, GetBaseHappiness, uint8_t); SIMPLE_GET_FUNC(PokemonSpecies, GetBaseHappiness, uint8_t);
#undef SIMPLE_GET_FUNC
export void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); } export void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); }
export size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { return p->GetEvolutions().Count(); } export size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { return p->GetEvolutions().Count(); }