diff --git a/CInterface/AngelScript/AngelScriptResolver.cpp b/CInterface/AngelScript/AngelScriptResolver.cpp index f317d59..9ed9757 100644 --- a/CInterface/AngelScript/AngelScriptResolver.cpp +++ b/CInterface/AngelScript/AngelScriptResolver.cpp @@ -5,52 +5,56 @@ export_func AngelScriptResolver* PkmnLib_AngelScriptResolver_Construct() { retur export_func uint8_t PkmnLib_AngelScriptResolver_Destruct(AngelScriptResolver* p) { Try(delete p;) } export_func uint8_t PkmnLib_AngelScriptResolver_Initialize(AngelScriptResolver* p, - CreatureLib::Battling::BattleLibrary* lib) { + CreatureLib::Battling::BattleLibrary* lib) { Try(p->Initialize(lib);) } -export_func uint8_t PkmnLib_AngelScriptResolver_CreateScript(AngelScriptResolver* p, const char* name, const char* script) { +export_func uint8_t PkmnLib_AngelScriptResolver_CreateScript(AngelScriptResolver* p, const char* name, + const char* script) { Try(p->CreateScript(name, script);) } export_func uint8_t PkmnLib_AngelScriptResolver_FinalizeModule(AngelScriptResolver* p) { Try(p->FinalizeModule();) } -export_func uint8_t PkmnLib_AngelScriptResolver_LoadScript(CreatureLib::Battling::BattleScript*& out, AngelScriptResolver* p, - void* owner, ScriptCategory category, const char* scriptName) { +export_func uint8_t PkmnLib_AngelScriptResolver_LoadScript(CreatureLib::Battling::BattleScript*& out, + AngelScriptResolver* p, void* owner, ScriptCategory category, + const char* scriptName) { Try(out = p->LoadScript(owner, category, ArbUt::StringView(scriptName)).TakeOwnership();) } export_func uint8_t PkmnLib_AngelScriptResolver_LoadEvolutionScript(PkmnLib::Battling::EvolutionScript const*& out, - AngelScriptResolver* p, const char* scriptName) { + AngelScriptResolver* p, const char* scriptName) { Try( auto s = p->LoadEvolutionScript(ArbUt::StringView(scriptName)); if (!s.HasValue()) { out = nullptr; } else { out = s.GetValue(); }) } export_func uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToFile(AngelScriptResolver* p, const char* file, - bool stripDebugInfo) { + bool stripDebugInfo) { Try(p->WriteByteCodeToFile(file, stripDebugInfo);) } export_func uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromFile(AngelScriptResolver* p, const char* file) { Try(p->LoadByteCodeFromFile(file);) } export_func uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToMemory(AngelScriptResolver* p, bool stripDebugInfo, - size_t& size, uint8_t*& out) { + size_t& size, uint8_t*& out) { Try(out = p->WriteByteCodeToMemory(size, stripDebugInfo);) } export_func uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromMemory(AngelScriptResolver* p, uint8_t* memory, - size_t size) { + size_t size) { Try(p->LoadByteCodeFromMemory(memory, size);) } export_func uint8_t PkmnLib_AngelScriptResolver_RegisterType(AngelScriptResolver* p, const char* typeName) { Try(p->RegisterType(typeName);) } export_func uint8_t PkmnLib_AngelScriptResolver_RegisterTypeMethod(AngelScriptResolver* p, const char* typeName, - const char* decl, void*(func)(void*)) { + const char* decl, void*(func)(void*)) { Try(p->RegisterTypeMethod(typeName, decl, func);) } export_func uint8_t PkmnLib_AngelScriptResolver_RegisterGlobalMethod(AngelScriptResolver* p, const char* decl, - void*(func)(void*)) { + void*(func)(void*)) { Try(p->RegisterGlobalMethod(decl, func);) } -export_func void PkmnLib_AngelScriptResolver_DefineWord(AngelScriptResolver* p, const char* word) { p->DefineWord(word); } +export_func void PkmnLib_AngelScriptResolver_DefineWord(AngelScriptResolver* p, const char* word) { + p->DefineWord(word); +} #ifdef ANGELSCRIPT_DEBUGGER export_func void PkmnLib_AngelScriptResolver_AddDebugger(AngelScriptResolver* p, u16 port) { diff --git a/CInterface/Battling/Battle.cpp b/CInterface/Battling/Battle.cpp index 501aafb..07148f2 100644 --- a/CInterface/Battling/Battle.cpp +++ b/CInterface/Battling/Battle.cpp @@ -3,14 +3,16 @@ using namespace PkmnLib::Battling; 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) { + CreatureLib::Battling::BattleParty* const* parties, size_t partiesCount, + bool canFlee, uint8_t numberOfSides, uint8_t creaturesPerSide, + uint_fast32_t randomSeed) { ArbUt::List partiesList(parties, parties + partiesCount); Try(out = new Battle(library, partiesList, canFlee, numberOfSides, creaturesPerSide, randomSeed)); } 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_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(); } \ No newline at end of file diff --git a/CInterface/Battling/BattleLibrary.cpp b/CInterface/Battling/BattleLibrary.cpp index df4620c..a1f9c74 100644 --- a/CInterface/Battling/BattleLibrary.cpp +++ b/CInterface/Battling/BattleLibrary.cpp @@ -3,10 +3,10 @@ using namespace PkmnLib::Battling; export_func uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Library::PokemonLibrary* staticLib, - StatCalculator* statCalculator, DamageLibrary* damageLibrary, - ExperienceLibrary* experienceLibrary, - PkmnLib::Battling::ScriptResolver* scriptResolver, - MiscLibrary* miscLibrary, CaptureLibrary* captureLibrary) { + StatCalculator* statCalculator, DamageLibrary* damageLibrary, + ExperienceLibrary* experienceLibrary, + PkmnLib::Battling::ScriptResolver* scriptResolver, + MiscLibrary* miscLibrary, CaptureLibrary* captureLibrary) { Try(out = new BattleLibrary(staticLib, statCalculator, damageLibrary, experienceLibrary, scriptResolver, miscLibrary, captureLibrary)); } diff --git a/CInterface/Battling/ExperienceLibrary.cpp b/CInterface/Battling/ExperienceLibrary.cpp index 9d9f95e..f8ba6f1 100644 --- a/CInterface/Battling/ExperienceLibrary.cpp +++ b/CInterface/Battling/ExperienceLibrary.cpp @@ -5,9 +5,9 @@ using namespace PkmnLib::Battling; export_func ExperienceLibrary* PkmnLib_ExperienceLibrary_Construct() { return new ExperienceLibrary(); } export_func uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary* p, - CreatureLib::Battling::Creature* faintedMon, - CreatureLib::Battling::Creature* const* opponents, - size_t numberOfOpponents) { + CreatureLib::Battling::Creature* faintedMon, + CreatureLib::Battling::Creature* const* opponents, + size_t numberOfOpponents) { Try(p->HandleExperienceGain(faintedMon, std::unordered_set>( opponents, opponents + numberOfOpponents));) } diff --git a/CInterface/Battling/MiscLibrary.cpp b/CInterface/Battling/MiscLibrary.cpp index 0c9c797..6a6fec2 100644 --- a/CInterface/Battling/MiscLibrary.cpp +++ b/CInterface/Battling/MiscLibrary.cpp @@ -9,7 +9,7 @@ export_func MiscLibrary* PkmnLib_MiscLibrary_Construct(PkmnLib::Library::TimeOfD export_func void PkmnLib_MiscLibrary_Destruct(MiscLibrary* p) { delete p; } export_func u8 PkmnLib_MiscLibrary_CanEvolveFromLevelUp(bool& out, MiscLibrary* p, - const PkmnLib::Library::EvolutionData* evoData, - const Pokemon* pokemon) { + const PkmnLib::Library::EvolutionData* evoData, + const Pokemon* pokemon) { Try(out = p->CanEvolveFromLevelUp(evoData, pokemon)) } \ No newline at end of file diff --git a/CInterface/Battling/PkmnScript.cpp b/CInterface/Battling/PkmnScript.cpp index b7de0b2..e2f1104 100644 --- a/CInterface/Battling/PkmnScript.cpp +++ b/CInterface/Battling/PkmnScript.cpp @@ -5,14 +5,14 @@ using namespace PkmnLib::Battling; export_func uint8_t PkmnLib_PkmnScript_ModifyCriticalStage(PkmnScript* script, - CreatureLib::Battling::ExecutingAttack* attack, - CreatureLib::Battling::Creature* target, uint8_t hit, - uint8_t* critStage) { + CreatureLib::Battling::ExecutingAttack* attack, + CreatureLib::Battling::Creature* target, uint8_t hit, + uint8_t* critStage) { Try(script->ModifyCriticalStage(attack, target, hit, critStage);) } export_func u8 PkmnLib_EvolutionScript_DoesEvolveFromLevelUp(EvolutionScript* script, - const PkmnLib::Library::EvolutionData* evoData, - const Pokemon* pokemon, bool* out) { + const PkmnLib::Library::EvolutionData* evoData, + const Pokemon* pokemon, bool* out) { Try(script->DoesEvolveFromLevelUp(evoData, pokemon, out)); } \ No newline at end of file diff --git a/CInterface/Battling/Pokemon.cpp b/CInterface/Battling/Pokemon.cpp index 1afe981..c4a9ffd 100644 --- a/CInterface/Battling/Pokemon.cpp +++ b/CInterface/Battling/Pokemon.cpp @@ -2,15 +2,14 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -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, - const char* nickname, bool hiddenAbility, uint8_t abilityIndex, - CreatureLib::Battling::LearnedAttack* const* moves, size_t moveCount, uint8_t hpIv, - uint8_t attIv, uint8_t defIv, uint8_t sAtIv, uint8_t sDeIv, uint8_t spIv, uint8_t hpEv, - uint8_t attEv, uint8_t defEv, uint8_t sAtEv, uint8_t sDeEv, uint8_t spEv, - const PkmnLib::Library::Nature* nature, bool allowedExperienceGain, bool isEgg) { +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, const char* nickname, + bool hiddenAbility, uint8_t abilityIndex, CreatureLib::Battling::LearnedAttack* const* moves, size_t moveCount, + uint8_t hpIv, uint8_t attIv, uint8_t defIv, uint8_t sAtIv, uint8_t sDeIv, uint8_t spIv, uint8_t hpEv, uint8_t attEv, + uint8_t defEv, uint8_t sAtEv, uint8_t sDeEv, uint8_t spEv, const PkmnLib::Library::Nature* nature, + bool allowedExperienceGain, bool isEgg) { Try({ if (nickname == nullptr) { nickname = ""; @@ -54,7 +53,7 @@ SIMPLE_GET_FUNC(Pokemon, IsEgg, bool) export_func void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); } export_func u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species, - const PkmnLib::Library::PokemonForme* forme) { + const PkmnLib::Library::PokemonForme* forme) { Try(p->Evolve(species, forme);) } diff --git a/CInterface/Core.cpp b/CInterface/Core.cpp index 438279c..c6bdbb5 100644 --- a/CInterface/Core.cpp +++ b/CInterface/Core.cpp @@ -4,4 +4,6 @@ std::string ExceptionHandler::_pkmnLibLastException = ""; std::string ExceptionHandler::_pkmnLibLastExceptionStacktrace = "Unset"; export_func const char* PkmnLib_C_GetLastException() { return ExceptionHandler::GetLastException(); } -export_func const char* PkmnLib_C_GetLastExceptionStacktrace() { return ExceptionHandler::GetLastExceptionStacktrace(); } \ No newline at end of file +export_func const char* PkmnLib_C_GetLastExceptionStacktrace() { + return ExceptionHandler::GetLastExceptionStacktrace(); +} \ No newline at end of file diff --git a/CInterface/Library/EvolutionData.cpp b/CInterface/Library/EvolutionData.cpp index 6d47f4c..f8073cb 100644 --- a/CInterface/Library/EvolutionData.cpp +++ b/CInterface/Library/EvolutionData.cpp @@ -6,59 +6,62 @@ export_func const EvolutionData* PkmnLib_EvolutionData_CreateLevelEvolution(uint return EvolutionData::CreateLevelEvolution(level, into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipEvolution(uint8_t friendship, - const PokemonSpecies* into) { + const PokemonSpecies* into) { return EvolutionData::CreateFriendshipEvolution(friendship, into); } -export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime, - TimeOfDay endTime, - const PokemonSpecies* into) { +export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship, + TimeOfDay startTime, + TimeOfDay endTime, + const PokemonSpecies* into) { return EvolutionData::CreateFriendshipTimeEvolution(friendship, startTime, endTime, into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateKnownMoveEvolution(const MoveData* move, - const PokemonSpecies* into) { + const PokemonSpecies* into) { return EvolutionData::CreateKnownMoveEvolution(move, into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateLocationEvolution(const char* location, - const PokemonSpecies* into) { + const PokemonSpecies* into) { return EvolutionData::CreateLocationEvolution(ArbUt::StringView(location), into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime, - const PokemonSpecies* into) { + const PokemonSpecies* into) { return EvolutionData::CreateTimeEvolution(startTime, endTime, into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemEvolution(const Item* item, - const PokemonSpecies* into) { + const PokemonSpecies* into) { return EvolutionData::CreateHeldItemEvolution(item, into); } -export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime, - TimeOfDay endTime, - const PokemonSpecies* into) { +export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item, + TimeOfDay startTime, + TimeOfDay endTime, + const PokemonSpecies* into) { return EvolutionData::CreateHeldItemTimeEvolution(item, startTime, endTime, into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateGenderBasedEvolution(CreatureLib::Library::Gender gender, - uint8_t level, - const PokemonSpecies* into) { + uint8_t level, + const PokemonSpecies* into) { return EvolutionData::CreateGenderBasedEvolution(gender, level, into); } -export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) { +export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseEvolution(const Item* item, + const PokemonSpecies* into) { return EvolutionData::CreateItemUseEvolution(item, into); } -export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item, - CreatureLib::Library::Gender gender, - const PokemonSpecies* into) { +export_func const EvolutionData* +PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item, CreatureLib::Library::Gender gender, + const PokemonSpecies* into) { return EvolutionData::CreateItemUseWithGenderEvolution(item, gender, into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeEvolution(const PokemonSpecies* into) { return EvolutionData::CreateTradeEvolution(into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithItemEvolution(const Item* item, - const PokemonSpecies* into) { + const PokemonSpecies* into) { return EvolutionData::CreateTradeWithItemEvolution(item, into); } export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded, - const PokemonSpecies* into) { + const PokemonSpecies* into) { return EvolutionData::CreateTradeWithSpeciesEvolution(traded, into); } export_func const EvolutionData* @@ -74,6 +77,6 @@ export_func const PokemonSpecies* PkmnLib_EvolutionData_GetNewSpecies(const Evol } export_func size_t PkmnLib_EvolutionData_GetDataCount(const EvolutionData* data) { return data->GetDataCount(); } export_func uint8_t PkmnLib_EvolutionData_GetDataAt(const EvolutionData* data, size_t index, - const CreatureLib::Library::EffectParameter*& out) { + const CreatureLib::Library::EffectParameter*& out) { Try(out = data->GetDataAt(index).GetRaw()); } diff --git a/CInterface/Library/Item.cpp b/CInterface/Library/Item.cpp index 463b6b0..2a2467d 100644 --- a/CInterface/Library/Item.cpp +++ b/CInterface/Library/Item.cpp @@ -4,12 +4,13 @@ using namespace PkmnLib::Library; export_func Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::ItemCategory category, - CreatureLib::Library::BattleItemCategory battleCategory, int32_t price, - const char* effectName, CreatureLib::Library::EffectParameter* effectParameters[], - size_t effectParameterCount, const char* battleTriggerEffectName, - CreatureLib::Library::EffectParameter* battleTriggerEffectParameters[], - size_t battleTriggerEffectParameterCount, const char* flags[], size_t flagsCount, - uint8_t flingPower) { + CreatureLib::Library::BattleItemCategory battleCategory, int32_t price, + const char* effectName, + CreatureLib::Library::EffectParameter* effectParameters[], + size_t effectParameterCount, const char* battleTriggerEffectName, + CreatureLib::Library::EffectParameter* battleTriggerEffectParameters[], + size_t battleTriggerEffectParameterCount, const char* flags[], + size_t flagsCount, uint8_t flingPower) { std::unordered_set conversedFlags(flagsCount); for (size_t i = 0; i < flagsCount; i++) { conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i])); diff --git a/CInterface/Library/LibrarySettings.cpp b/CInterface/Library/LibrarySettings.cpp index c68cc43..16b71b7 100644 --- a/CInterface/Library/LibrarySettings.cpp +++ b/CInterface/Library/LibrarySettings.cpp @@ -3,7 +3,7 @@ using namespace PkmnLib::Library; export_func const LibrarySettings* PkmnLib_LibrarySettings_Construct(uint8_t maximalLevel, uint8_t maximalMoves, - uint16_t shinyRate) { + uint16_t shinyRate) { return new LibrarySettings(maximalLevel, maximalMoves, shinyRate); } diff --git a/CInterface/Library/Nature.cpp b/CInterface/Library/Nature.cpp index 66c322b..c70c7a2 100644 --- a/CInterface/Library/Nature.cpp +++ b/CInterface/Library/Nature.cpp @@ -3,8 +3,8 @@ using namespace PkmnLib::Library; export_func Nature* PkmnLib_Nature_Construct(CreatureLib::Library::Statistic increasedStat, - CreatureLib::Library::Statistic decreasedStat, float increasedModifier, - float decreasedModifier) { + CreatureLib::Library::Statistic decreasedStat, float increasedModifier, + float decreasedModifier) { return new Nature(increasedStat, decreasedStat, increasedModifier, decreasedModifier); } export_func void PkmnLib_Nature_Destruct(const Nature* p) { delete p; } @@ -15,6 +15,6 @@ SIMPLE_GET_FUNC(Nature, GetIncreasedStat, CreatureLib::Library::Statistic) SIMPLE_GET_FUNC(Nature, GetDecreasedStat, CreatureLib::Library::Statistic) export_func float PkmnLib_Nature_GetStatModifier(const PkmnLib::Library::Nature* nature, - CreatureLib::Library::Statistic stat) { + CreatureLib::Library::Statistic stat) { return nature->GetStatModifier(stat); } \ No newline at end of file diff --git a/CInterface/Library/PokemonLibrary.cpp b/CInterface/Library/PokemonLibrary.cpp index b63168e..b371585 100644 --- a/CInterface/Library/PokemonLibrary.cpp +++ b/CInterface/Library/PokemonLibrary.cpp @@ -3,11 +3,11 @@ using namespace PkmnLib::Library; export_func uint8_t PkmnLib_PokemonLibrary_Construct(PokemonLibrary*& out, PkmnLib::Library::LibrarySettings* settings, - SpeciesLibrary* species, MoveLibrary* moves, ItemLibrary* items, - CreatureLib::Library::GrowthRateLibrary* growthRates, - CreatureLib::Library::TypeLibrary* typeLibrary, - CreatureLib::Library::TalentLibrary* talentLibrary, - NatureLibrary* natures) { + SpeciesLibrary* species, MoveLibrary* moves, ItemLibrary* items, + CreatureLib::Library::GrowthRateLibrary* growthRates, + CreatureLib::Library::TypeLibrary* typeLibrary, + CreatureLib::Library::TalentLibrary* talentLibrary, + NatureLibrary* natures) { Try(out = new PokemonLibrary(settings, species, moves, items, growthRates, typeLibrary, talentLibrary, natures)); } diff --git a/CInterface/Library/PokemonSpecies.cpp b/CInterface/Library/PokemonSpecies.cpp index 9753c72..3d8af79 100644 --- a/CInterface/Library/PokemonSpecies.cpp +++ b/CInterface/Library/PokemonSpecies.cpp @@ -3,10 +3,10 @@ using namespace PkmnLib::Library; export_func uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name, - const PokemonForme* defaultForme, float genderRatio, - const char* growthRate, uint8_t captureRate, uint8_t baseHappiness, - const char* const* eggGroupsRaw, size_t eggGroupsLength, - const char* flags[], size_t flagsCount) { + const PokemonForme* defaultForme, float genderRatio, + const char* growthRate, uint8_t captureRate, uint8_t baseHappiness, + const char* const* eggGroupsRaw, size_t eggGroupsLength, + const char* flags[], size_t flagsCount) { Try( std::unordered_set conversedFlags(flagsCount); for (size_t i = 0; i < flagsCount; i++) { @@ -25,9 +25,12 @@ export_func void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { dele SIMPLE_GET_FUNC(PokemonSpecies, GetBaseHappiness, uint8_t); export_func void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); } -export_func size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { return p->GetEvolutions().Count(); } +export_func size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { + return p->GetEvolutions().Count(); +} -export_func uint8_t PkmnLib_PokemonSpecies_GetEvolution(const PokemonSpecies* p, size_t index, const EvolutionData*& out) { +export_func uint8_t PkmnLib_PokemonSpecies_GetEvolution(const PokemonSpecies* p, size_t index, + const EvolutionData*& out) { Try(out = p->GetEvolutions().At(index).GetRaw()); } @@ -35,7 +38,9 @@ export_func uint8_t PkmnLib_PokemonSpecies_GetEvolutions(const PokemonSpecies* p Try(out = p->GetEvolutions().RawData()); } -export_func size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) { return p->GetEggGroups().Count(); } +export_func size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) { + return p->GetEggGroups().Count(); +} export_func const char* PkmnLib_PokemonSpecies_GetEggGroup(const PokemonSpecies* p, size_t index) { return p->GetEggGroups()[index].c_str(); } \ No newline at end of file diff --git a/CInterface/Library/SpeciesLibrary.cpp b/CInterface/Library/SpeciesLibrary.cpp index dde53a4..894bbc5 100644 --- a/CInterface/Library/SpeciesLibrary.cpp +++ b/CInterface/Library/SpeciesLibrary.cpp @@ -7,7 +7,7 @@ export_func const SpeciesLibrary* PkmnLib_SpeciesLibrary_Construct(size_t initia }; export_func u8 PkmnLib_SpeciesLibrary_FindPreEvolution(const PokemonSpecies*& out, const SpeciesLibrary* p, - const PokemonSpecies* species) { + const PokemonSpecies* species) { Try( auto v = p->FindPreEvolution(species); if (!v.has_value()) { out = nullptr; } else { out = v.value().GetRaw(); }) diff --git a/src/Battling/Library/DamageLibrary.cpp b/src/Battling/Library/DamageLibrary.cpp index 8ca2aba..f0deb4b 100644 --- a/src/Battling/Library/DamageLibrary.cpp +++ b/src/Battling/Library/DamageLibrary.cpp @@ -95,7 +95,6 @@ float PkmnLib::Battling::DamageLibrary::GetStatModifier(CreatureLib::Battling::E PKMN_HOOK(ModifyOffensiveStatValue, attack, attack, target, hit, &offensiveValue); PKMN_HOOK(ModifyDefensiveStatValue, attack, attack, target, hit, &defensiveValue); - return offensiveValue / defensiveValue; } float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling::ExecutingAttack*, diff --git a/src/Battling/Pokemon/Pokemon.cpp b/src/Battling/Pokemon/Pokemon.cpp index 3fd460f..24911fb 100644 --- a/src/Battling/Pokemon/Pokemon.cpp +++ b/src/Battling/Pokemon/Pokemon.cpp @@ -83,8 +83,7 @@ void PkmnLib::Battling::Pokemon::AttemptCapture(PkmnLib::Library::Item* catchIte Ensure(_battleData.Side.HasValue()); Ensure(!IsFainted()); Ensure(IsUsable()); - auto captureLibrary = - GetLibrary().ForceAs()->GetCaptureLibrary(); + auto captureLibrary = GetLibrary().ForceAs()->GetCaptureLibrary(); auto result = captureLibrary->TryCatch(this, catchItem, _battleData.Battle.GetValue()->GetRandom()); _battleData.Battle.GetValue()->TriggerEventListener(this, result); diff --git a/src/Battling/Pokemon/PokemonParty.hpp b/src/Battling/Pokemon/PokemonParty.hpp index e986614..90bc654 100644 --- a/src/Battling/Pokemon/PokemonParty.hpp +++ b/src/Battling/Pokemon/PokemonParty.hpp @@ -8,7 +8,7 @@ namespace PkmnLib::Battling { public: PokemonParty(ArbUt::List party) : CreatureLib::Battling::CreatureParty(std::move(party)) {} - PokemonParty(std::initializer_list party) + PokemonParty(std::initializer_list party) : CreatureLib::Battling::CreatureParty(party) {} PokemonParty(size_t size) : CreatureLib::Battling::CreatureParty(size) {} diff --git a/src/Library/Moves/MoveData.hpp b/src/Library/Moves/MoveData.hpp index 49677a4..b81bb75 100644 --- a/src/Library/Moves/MoveData.hpp +++ b/src/Library/Moves/MoveData.hpp @@ -11,8 +11,8 @@ namespace PkmnLib::Library { MoveData(const ArbUt::StringView& name, u8 type, PkmnLib::Library::MoveCategory category, u8 power, u8 accuracy, u8 baseUsage, CreatureLib::Library::AttackTarget target, i8 priority, const CreatureLib::Library::SecondaryEffect* nullable effect, std::unordered_set flags) - : AttackData(name, type, static_cast(category), power, accuracy, baseUsage, - target, priority, effect, std::move(flags)) {}; + : AttackData(name, type, static_cast(category), power, accuracy, + baseUsage, target, priority, effect, std::move(flags)){}; inline PkmnLib::Library::MoveCategory GetCategory() const { return static_cast(AttackData::GetCategory()); diff --git a/src/Library/Natures/NatureLibrary.hpp b/src/Library/Natures/NatureLibrary.hpp index 86a8dca..5b44335 100644 --- a/src/Library/Natures/NatureLibrary.hpp +++ b/src/Library/Natures/NatureLibrary.hpp @@ -25,9 +25,7 @@ namespace PkmnLib::Library { return _items.Get(name); } - inline ArbUt::BorrowedPtr GetNatureByHash(u32 hash) const { - return _items.GetFromHash(hash); - } + inline ArbUt::BorrowedPtr GetNatureByHash(u32 hash) const { return _items.GetFromHash(hash); } inline const ArbUt::StringView& GetRandomNatureName(ArbUt::Random rand = ArbUt::Random()) const { auto i = rand.Get(_items.Count()); diff --git a/src/Library/Species/SpeciesLibrary.cpp b/src/Library/Species/SpeciesLibrary.cpp index eaed343..df3e614 100644 --- a/src/Library/Species/SpeciesLibrary.cpp +++ b/src/Library/Species/SpeciesLibrary.cpp @@ -7,7 +7,7 @@ namespace PkmnLib::Library { return tryGet->get(); } for (const auto& s : _values) { - const auto* pkmn = dynamic_cast(s.second.get()); + const auto* pkmn = dynamic_cast(s.second.get()); if (pkmn == nullptr) { continue; } diff --git a/src/Library/Species/SpeciesLibrary.hpp b/src/Library/Species/SpeciesLibrary.hpp index 7791c8f..1412dfe 100644 --- a/src/Library/Species/SpeciesLibrary.hpp +++ b/src/Library/Species/SpeciesLibrary.hpp @@ -33,9 +33,7 @@ namespace PkmnLib::Library { return CreatureLib::Library::SpeciesLibrary::GetByHash(hashedKey).As(); } - ArbUt::BorrowedPtr operator[](const ArbUt::StringView& name) const { - return Get(name); - } + ArbUt::BorrowedPtr operator[](const ArbUt::StringView& name) const { return Get(name); } std::optional> FindPreEvolution(const ArbUt::BorrowedPtr& species) const noexcept; diff --git a/src/ScriptResolving/AngelScript/AngelScriptItemUseScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptItemUseScript.hpp index edc678f..d78c238 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptItemUseScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptItemUseScript.hpp @@ -72,8 +72,7 @@ private: #define ITEM_USE_SCRIPT_HOOK_FUNCTION(name, decl) FunctionInfo __##name = Initialize(decl) - ITEM_USE_SCRIPT_HOOK_FUNCTION( - OnInitialize, "void OnInitialize(const narray@ parameters)"); + ITEM_USE_SCRIPT_HOOK_FUNCTION(OnInitialize, "void OnInitialize(const narray@ parameters)"); ITEM_USE_SCRIPT_HOOK_FUNCTION(IsItemUsable, "bool IsItemUsable()"); ITEM_USE_SCRIPT_HOOK_FUNCTION(IsPokemonUseItem, "bool IsPokemonUseItem()"); ITEM_USE_SCRIPT_HOOK_FUNCTION(IsUseValidForPokemon, "bool IsUseValidForPokemon(Pokemon@ target)"); diff --git a/src/ScriptResolving/AngelScript/ByteCodeHandling/IPkmnBinaryStream.hpp b/src/ScriptResolving/AngelScript/ByteCodeHandling/IPkmnBinaryStream.hpp index 0c222be..3bacfaa 100644 --- a/src/ScriptResolving/AngelScript/ByteCodeHandling/IPkmnBinaryStream.hpp +++ b/src/ScriptResolving/AngelScript/ByteCodeHandling/IPkmnBinaryStream.hpp @@ -13,10 +13,11 @@ protected: IPkmnBinaryStream(size_t angelScriptBound) : _angelScriptBound(angelScriptBound) {} public: - virtual void WriteTypes( - const ArbUt::Dictionary>& types, - const ArbUt::Dictionary& itemUseTypes, - const ArbUt::Dictionary& evolutionTypes) { + virtual void + WriteTypes(const ArbUt::Dictionary>& types, + const ArbUt::Dictionary& itemUseTypes, + const ArbUt::Dictionary& evolutionTypes) { // We serialize our types in the format // "[category(byte)][name(str)]\2[decl(str)]\2[name(str)]\2[decl(str)]\1[category(byte)]...." diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp index 44fd571..b839987 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp @@ -26,7 +26,6 @@ static bool GetMove(const PkmnLib::Library::MoveLibrary* obj, const ArbUt::Basic return obj->Get(str); } - void RegisterMoveTypes::RegisterMoveType(asIScriptEngine* engine) { int r = engine->RegisterObjectType("MoveData", 0, asOBJ_REF | asOBJ_NOCOUNT); Ensure(r >= 0); @@ -51,7 +50,7 @@ void RegisterMoveTypes::RegisterMoveLibrary(asIScriptEngine* engine) { int r = engine->RegisterObjectType("MoveLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT); Ensure(r >= 0); r = engine->RegisterObjectMethod("MoveLibrary", "const MoveData@ Get(const constString &in name) const", - asFUNCTION(GetMove), asCALL_CDECL_OBJFIRST); + asFUNCTION(GetMove), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); } diff --git a/src/ScriptResolving/WASM/InterfaceMethods/Library/LibraryMethods.hpp b/src/ScriptResolving/WASM/InterfaceMethods/Library/LibraryMethods.hpp index 46c51d0..d38e3eb 100644 --- a/src/ScriptResolving/WASM/InterfaceMethods/Library/LibraryMethods.hpp +++ b/src/ScriptResolving/WASM/InterfaceMethods/Library/LibraryMethods.hpp @@ -6,8 +6,7 @@ class WebAssemblyScriptResolver; class LibraryMethods { public: - static void Register(ArbUt::Dictionary& externs, - WebAssemblyScriptResolver* resolver); + static void Register(ArbUt::Dictionary& externs, WebAssemblyScriptResolver* resolver); }; #endif // PKMNLIB_LIBRARYMETHODS_H diff --git a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMItemRegistry.hpp b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMItemRegistry.hpp index 293d451..3a3cace 100644 --- a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMItemRegistry.hpp +++ b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMItemRegistry.hpp @@ -6,8 +6,7 @@ class WebAssemblyScriptResolver; class WASMItemRegistry { public: - static void Register(ArbUt::Dictionary& externs, - WebAssemblyScriptResolver* resolver); + static void Register(ArbUt::Dictionary& externs, WebAssemblyScriptResolver* resolver); }; #endif // PKMNLIB_WASMITEMREGISTRY_H diff --git a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMMoveDataRegistry.cpp b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMMoveDataRegistry.cpp index deab09a..f23a15a 100644 --- a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMMoveDataRegistry.cpp +++ b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMMoveDataRegistry.cpp @@ -8,9 +8,7 @@ using namespace CreatureLib::Library; wasm_func_t* MoveData_HasFlagByHash(WebAssemblyScriptResolver* resolver) { return WasmHelpers::CreateFunc( - resolver, {[](WebAssemblyScriptResolver*, AttackData* move, u32 flag) -> bool { - return move->HasFlag(flag); - }}); + resolver, {[](WebAssemblyScriptResolver*, AttackData* move, u32 flag) -> bool { return move->HasFlag(flag); }}); } void WASMMoveDataRegistry::Register(ArbUt::Dictionary& externs, diff --git a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMMoveDataRegistry.hpp b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMMoveDataRegistry.hpp index c32d905..ff596e1 100644 --- a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMMoveDataRegistry.hpp +++ b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMMoveDataRegistry.hpp @@ -7,8 +7,7 @@ class WebAssemblyScriptResolver; class WASMMoveDataRegistry { public: - static void Register(ArbUt::Dictionary& externs, - WebAssemblyScriptResolver* resolver); + static void Register(ArbUt::Dictionary& externs, WebAssemblyScriptResolver* resolver); }; #endif // PKMNLIB_WASMMOVEDATAREGISTRY_H diff --git a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMSpeciesRegistry.cpp b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMSpeciesRegistry.cpp index 2160251..430acb4 100644 --- a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMSpeciesRegistry.cpp +++ b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMSpeciesRegistry.cpp @@ -37,7 +37,6 @@ wasm_func_t* Species_HasEggGroupByHash(WebAssemblyScriptResolver* resolver) { }}); } - void WASMSpeciesRegistry::Register(ArbUt::Dictionary& externs, WebAssemblyScriptResolver* resolver) { REGISTER_GETTER("species_get_id", CreatureSpecies, GetId, resolver) diff --git a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMSpeciesRegistry.hpp b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMSpeciesRegistry.hpp index 28c4a60..722f634 100644 --- a/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMSpeciesRegistry.hpp +++ b/src/ScriptResolving/WASM/InterfaceMethods/Library/WASMSpeciesRegistry.hpp @@ -7,8 +7,7 @@ class WebAssemblyScriptResolver; class WASMSpeciesRegistry { public: - static void Register(ArbUt::Dictionary& externs, - WebAssemblyScriptResolver* resolver); + static void Register(ArbUt::Dictionary& externs, WebAssemblyScriptResolver* resolver); }; #endif // PKMNLIB_WASMSPECIESREGISTRY_HPP diff --git a/src/ScriptResolving/WASM/InterfaceMethods/WASMCoreMethods.cpp b/src/ScriptResolving/WASM/InterfaceMethods/WASMCoreMethods.cpp index 0d2c3bc..c854fd9 100644 --- a/src/ScriptResolving/WASM/InterfaceMethods/WASMCoreMethods.cpp +++ b/src/ScriptResolving/WASM/InterfaceMethods/WASMCoreMethods.cpp @@ -39,7 +39,7 @@ wasm_func_t* CreatePrintFunc(WebAssemblyScriptResolver* resolver) { } void WASMCoreMethods::Register(ArbUt::Dictionary& externs, - WebAssemblyScriptResolver* resolver) { + WebAssemblyScriptResolver* resolver) { externs.Insert("_error", CreateErrorFunc(resolver)); externs.Insert("_print", CreatePrintFunc(resolver)); } diff --git a/src/ScriptResolving/WASM/WasmExternRef.hpp b/src/ScriptResolving/WASM/WasmExternRef.hpp index 9e0fa23..f9c1640 100644 --- a/src/ScriptResolving/WASM/WasmExternRef.hpp +++ b/src/ScriptResolving/WASM/WasmExternRef.hpp @@ -6,6 +6,7 @@ public: WasmExternRef(T* ptr) : _ptr(ptr) {} [[nodiscard]] inline T* GetPtr() const noexcept { return _ptr; } + private: T* _ptr; };