Enable pedantic errors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-04-02 13:03:11 +02:00
parent 3739b0bb66
commit a6b1c8a8ec
28 changed files with 122 additions and 116 deletions

View File

@@ -2,7 +2,7 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary* library,
export_func uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary* library,
CreatureLib::Battling::BattleParty* const* parties, size_t partiesCount,
bool canFlee, uint8_t numberOfSides, uint8_t creaturesPerSide,
uint_fast32_t randomSeed) {
@@ -10,7 +10,7 @@ export uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary* libra
Try(out = new Battle(library, partiesList, canFlee, numberOfSides, creaturesPerSide, randomSeed));
}
export void PkmnLib_Battle_Destruct(Battle* p) { p->~Battle(); }
export uint8_t PkmnLib_Battle_SetWeather(Battle* p, const char* name) { Try(p->SetWeather(ArbUt::StringView(name))); };
export uint8_t PkmnLib_Battle_ClearWeather(Battle* p) { Try(p->ClearWeather()); };
export const char* PkmnLib_Battle_GetWeatherName(Battle* p) { return p->GetWeatherName().c_str(); }
export_func void PkmnLib_Battle_Destruct(Battle* p) { p->~Battle(); }
export_func uint8_t PkmnLib_Battle_SetWeather(Battle* p, const char* name) { Try(p->SetWeather(ArbUt::StringView(name))); };
export_func uint8_t PkmnLib_Battle_ClearWeather(Battle* p) { Try(p->ClearWeather()); };
export_func const char* PkmnLib_Battle_GetWeatherName(Battle* p) { return p->GetWeatherName().c_str(); }

View File

@@ -2,7 +2,7 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Library::PokemonLibrary* staticLib,
export_func uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Library::PokemonLibrary* staticLib,
StatCalculator* statCalculator, DamageLibrary* damageLibrary,
ExperienceLibrary* experienceLibrary,
PkmnLib::Battling::ScriptResolver* scriptResolver,
@@ -11,7 +11,7 @@ export uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Lib
miscLibrary, captureLibrary));
}
export void PkmnLib_BattleLibrary_Destruct(BattleLibrary* p) { delete p; }
export_func void PkmnLib_BattleLibrary_Destruct(BattleLibrary* p) { delete p; }
export uint8_t PkmnLib_CaptureLibrary_Construct(CaptureLibrary*& out) { Try(out = new CaptureLibrary()); }
export void PkmnLib_CaptureLibrary_Destruct(CaptureLibrary* p) { delete p; }
export_func uint8_t PkmnLib_CaptureLibrary_Construct(CaptureLibrary*& out) { Try(out = new CaptureLibrary()); }
export_func void PkmnLib_CaptureLibrary_Destruct(CaptureLibrary* p) { delete p; }

View File

@@ -2,6 +2,6 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export DamageLibrary* PkmnLib_DamageLibrary_Construct() { return new DamageLibrary(); }
export_func DamageLibrary* PkmnLib_DamageLibrary_Construct() { return new DamageLibrary(); }
export void PkmnLib_DamageLibrary_Destruct(DamageLibrary* p) { delete p; }
export_func void PkmnLib_DamageLibrary_Destruct(DamageLibrary* p) { delete p; }

View File

@@ -3,16 +3,16 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export void PkmnLib_WeatherChangeEvent_Destruct(WeatherChangeEvent* p) { delete p; }
export const char* PkmnLib_WeatherChangeEvent_GetWeatherName(WeatherChangeEvent* p) {
export_func void PkmnLib_WeatherChangeEvent_Destruct(WeatherChangeEvent* p) { delete p; }
export_func const char* PkmnLib_WeatherChangeEvent_GetWeatherName(WeatherChangeEvent* p) {
return p->GetWeatherName().c_str();
}
export void PkmnLib_CaptureAttemptEvent_Destruct(CaptureAttemptEvent* p) { delete p; }
export const PkmnLib::Battling::Pokemon* PkmnLib_CaptureAttemptEvent_GetPokemon(CaptureAttemptEvent* p) {
export_func void PkmnLib_CaptureAttemptEvent_Destruct(CaptureAttemptEvent* p) { delete p; }
export_func const PkmnLib::Battling::Pokemon* PkmnLib_CaptureAttemptEvent_GetPokemon(CaptureAttemptEvent* p) {
return p->GetPokemon();
}
export const PkmnLib::Battling::CaptureLibrary::CaptureResult
export_func const PkmnLib::Battling::CaptureLibrary::CaptureResult
PkmnLib_CaptureAttemptEvent_GetResult(CaptureAttemptEvent* p) {
return p->GetResult();
}

View File

@@ -2,9 +2,9 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export ExperienceLibrary* PkmnLib_ExperienceLibrary_Construct() { return new ExperienceLibrary(); }
export_func ExperienceLibrary* PkmnLib_ExperienceLibrary_Construct() { return new ExperienceLibrary(); }
export uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary* p,
export_func uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary* p,
CreatureLib::Battling::Creature* faintedMon,
CreatureLib::Battling::Creature* const* opponents,
size_t numberOfOpponents) {
@@ -12,4 +12,4 @@ export uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary*
opponents, opponents + numberOfOpponents));)
}
export void PkmnLib_ExperienceLibrary_Destruct(ExperienceLibrary* p) { delete p; }
export_func void PkmnLib_ExperienceLibrary_Destruct(ExperienceLibrary* p) { delete p; }

View File

@@ -2,13 +2,13 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export MiscLibrary* PkmnLib_MiscLibrary_Construct(PkmnLib::Library::TimeOfDay (*getTime)()) {
export_func MiscLibrary* PkmnLib_MiscLibrary_Construct(PkmnLib::Library::TimeOfDay (*getTime)()) {
return new MiscLibrary(getTime);
}
export void PkmnLib_MiscLibrary_Destruct(MiscLibrary* p) { delete p; }
export_func void PkmnLib_MiscLibrary_Destruct(MiscLibrary* p) { delete p; }
export u8 PkmnLib_MiscLibrary_CanEvolveFromLevelUp(bool& out, MiscLibrary* p,
export_func u8 PkmnLib_MiscLibrary_CanEvolveFromLevelUp(bool& out, MiscLibrary* p,
const PkmnLib::Library::EvolutionData* evoData,
const Pokemon* pokemon) {
Try(out = p->CanEvolveFromLevelUp(evoData, pokemon))

View File

@@ -4,14 +4,14 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export uint8_t PkmnLib_PkmnScript_ModifyCriticalStage(PkmnScript* script,
export_func uint8_t PkmnLib_PkmnScript_ModifyCriticalStage(PkmnScript* script,
CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, uint8_t hit,
uint8_t* critStage) {
Try(script->ModifyCriticalStage(attack, target, hit, critStage);)
}
export u8 PkmnLib_EvolutionScript_DoesEvolveFromLevelUp(EvolutionScript* script,
export_func u8 PkmnLib_EvolutionScript_DoesEvolveFromLevelUp(EvolutionScript* script,
const PkmnLib::Library::EvolutionData* evoData,
const Pokemon* pokemon, bool* out) {
Try(script->DoesEvolveFromLevelUp(evoData, pokemon, out));

View File

@@ -2,7 +2,7 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export uint8_t
export_func uint8_t
PkmnLib_Pokemon_Construct(Pokemon*& out, const BattleLibrary* library, const PkmnLib::Library::PokemonSpecies* species,
const PkmnLib::Library::PokemonForme* forme, uint8_t level, uint32_t experience, uint32_t uid,
CreatureLib::Library::Gender gender, uint8_t coloring, const PkmnLib::Library::Item* heldItem,
@@ -27,37 +27,37 @@ PkmnLib_Pokemon_Construct(Pokemon*& out, const BattleLibrary* library, const Pkm
})
};
export void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; }
export_func void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; }
SIMPLE_GET_FUNC(Pokemon, IsShiny, bool)
SIMPLE_GET_FUNC(Pokemon, WasCaught, bool)
SIMPLE_GET_FUNC_SMART_PTR(Pokemon, GetNature, const PkmnLib::Library::Nature*)
export u8 PkmnLib_Pokemon_GetIndividualValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
export_func u8 PkmnLib_Pokemon_GetIndividualValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
return p->GetIndividualValue(stat);
}
export void PkmnLib_Pokemon_SetIndividualValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) {
export_func void PkmnLib_Pokemon_SetIndividualValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) {
p->SetIndividualValue(stat, value);
}
export u8 PkmnLib_Pokemon_GetEffortValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
export_func u8 PkmnLib_Pokemon_GetEffortValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
return p->GetEffortValue(stat);
}
export void PkmnLib_Pokemon_SetEffortValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) {
export_func void PkmnLib_Pokemon_SetEffortValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) {
p->SetEffortValue(stat, value);
}
SIMPLE_GET_FUNC(Pokemon, GetFriendship, uint8_t)
export void PkmnLib_Pokemon_SetFriendship(Pokemon* p, u8 value) { p->SetFriendship(value); }
export void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, i8 amount) { p->ChangeFriendship(amount); }
export_func void PkmnLib_Pokemon_SetFriendship(Pokemon* p, u8 value) { p->SetFriendship(value); }
export_func void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, i8 amount) { p->ChangeFriendship(amount); }
SIMPLE_GET_FUNC(Pokemon, IsEgg, bool)
export void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); }
export_func void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); }
export u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species,
export_func u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species,
const PkmnLib::Library::PokemonForme* forme) {
Try(p->Evolve(species, forme);)
}
export u8 PkmnLib_Pokemon_AttemptCapture(Pokemon* p, PkmnLib::Library::Item* non_null catchItem) {
export_func u8 PkmnLib_Pokemon_AttemptCapture(Pokemon* p, PkmnLib::Library::Item* non_null catchItem) {
Try(p->AttemptCapture(catchItem);)
}

View File

@@ -2,6 +2,6 @@
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export StatCalculator* PkmnLib_StatCalculator_Construct() { return new StatCalculator(); }
export_func StatCalculator* PkmnLib_StatCalculator_Construct() { return new StatCalculator(); }
export void PkmnLib_StatCalculator_Destruct(StatCalculator* p) { delete p; }
export_func void PkmnLib_StatCalculator_Destruct(StatCalculator* p) { delete p; }