From 5a082c5995b8f7583af83039ecd94962cd2ffed9 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 9 Jul 2021 14:36:14 +0200 Subject: [PATCH] Style Fixes --- CInterface/Battling/Pokemon.cpp | 3 +-- CInterface/Library/SpeciesLibrary.cpp | 9 ++------- src/Battling/Library/MiscLibrary.cpp | 5 ++--- src/Battling/Library/MiscLibrary.hpp | 2 +- src/Library/Evolutions/EvolutionMethod.hpp | 4 ++-- src/Library/Species/SpeciesLibrary.cpp | 2 +- src/ScriptResolving/AngelScript/AngelScriptResolver.hpp | 3 +-- .../AngelScript/TypeRegistry/Battling/RegisterParty.cpp | 2 +- .../TypeRegistry/Battling/RegisterTurnChoices.cpp | 4 ++-- .../AngelScript/TypeRegistry/HelperFile.hpp | 5 ++--- 10 files changed, 15 insertions(+), 24 deletions(-) diff --git a/CInterface/Battling/Pokemon.cpp b/CInterface/Battling/Pokemon.cpp index 4684279..c23c9e9 100644 --- a/CInterface/Battling/Pokemon.cpp +++ b/CInterface/Battling/Pokemon.cpp @@ -56,8 +56,7 @@ export void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, i8 amount) { p->ChangeF SIMPLE_GET_FUNC(Pokemon, IsEgg, bool) export void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); } - export 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);) } \ No newline at end of file diff --git a/CInterface/Library/SpeciesLibrary.cpp b/CInterface/Library/SpeciesLibrary.cpp index 71c4d78..174b256 100644 --- a/CInterface/Library/SpeciesLibrary.cpp +++ b/CInterface/Library/SpeciesLibrary.cpp @@ -7,13 +7,8 @@ export const SpeciesLibrary* PkmnLib_SpeciesLibrary_Construct(size_t initialCapa }; export 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(); - } - ) + if (!v.has_value()) { out = nullptr; } else { out = v.value().GetRaw(); }) } \ No newline at end of file diff --git a/src/Battling/Library/MiscLibrary.cpp b/src/Battling/Library/MiscLibrary.cpp index b26883d..cc72c3f 100644 --- a/src/Battling/Library/MiscLibrary.cpp +++ b/src/Battling/Library/MiscLibrary.cpp @@ -65,10 +65,9 @@ bool PkmnLib::Battling::MiscLibrary::CanEvolveFromLevelUp( case Library::EvolutionMethod::IsGenderAndLevel: return pokemon->GetLevel() >= evolution->GetData(1)->AsInt() && pokemon->GetGender() == (CreatureLib::Library::Gender)evolution->GetData(0)->AsInt(); - case Library::EvolutionMethod::Custom: - { + case Library::EvolutionMethod::Custom: { auto script = dynamic_cast(pokemon->GetLibrary()->GetScriptResolver().get()) - ->LoadEvolutionScript(evolution->GetData(0)->AsString()); + ->LoadEvolutionScript(evolution->GetData(0)->AsString()); if (!script.HasValue()) { return false; } diff --git a/src/Battling/Library/MiscLibrary.hpp b/src/Battling/Library/MiscLibrary.hpp index 5ea1962..cdac1cf 100644 --- a/src/Battling/Library/MiscLibrary.hpp +++ b/src/Battling/Library/MiscLibrary.hpp @@ -38,7 +38,7 @@ namespace PkmnLib::Battling { CreatureLib::Battling::CreatureIndex target) const override; bool CanEvolveFromLevelUp(const ArbUt::BorrowedPtr& evolution, - const ArbUt::BorrowedPtr& pokemon); + const ArbUt::BorrowedPtr& pokemon); inline PkmnLib::Library::TimeOfDay GetTime() const noexcept { return _getTime(); } }; diff --git a/src/Library/Evolutions/EvolutionMethod.hpp b/src/Library/Evolutions/EvolutionMethod.hpp index 9b58f36..1537c5e 100644 --- a/src/Library/Evolutions/EvolutionMethod.hpp +++ b/src/Library/Evolutions/EvolutionMethod.hpp @@ -3,8 +3,8 @@ namespace PkmnLib::Library { ENUM(EvolutionMethod, uint8_t, Level, HighFriendship, HighFriendshipTime, KnownMove, LocationBased, TimeBased, - HoldsItem, HoldsItemTime, IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade, TradeWithHeldItem, - TradeWithSpecificPokemon, Custom) + HoldsItem, HoldsItemTime, IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade, + TradeWithHeldItem, TradeWithSpecificPokemon, Custom) } #endif // PKMNLIB_EVOLUTIONMETHOD_HPP diff --git a/src/Library/Species/SpeciesLibrary.cpp b/src/Library/Species/SpeciesLibrary.cpp index 6c20560..74bf419 100644 --- a/src/Library/Species/SpeciesLibrary.cpp +++ b/src/Library/Species/SpeciesLibrary.cpp @@ -8,7 +8,7 @@ namespace PkmnLib::Library { } for (const auto& s : _values) { const auto* pkmn = dynamic_cast(s.second.get()); - if (pkmn == nullptr){ + if (pkmn == nullptr) { continue; } for (const auto& evo : pkmn->GetEvolutions()) { diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp index 1d6ef96..4570921 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp @@ -34,8 +34,7 @@ private: static i32 IncludeCallback(const char* include, const char* from, CScriptBuilder* builder, void* userParam); void RegisterTypes(); - void - InitializeByteCode(const ArbUt::Dictionary>& types); + void InitializeByteCode(const ArbUt::Dictionary>& types); void RegisterScriptType(asITypeInfo* typeInfo, const ArbUt::StringView& metadataKind, const ArbUt::StringView& effectName); diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterParty.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterParty.cpp index e60048a..9ac095c 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterParty.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterParty.cpp @@ -1,7 +1,7 @@ #include "RegisterParty.hpp" +#include #include "../../../../Battling/Pokemon/PokemonParty.hpp" #include "../HelperFile.hpp" -#include void RegisterParty::Register(asIScriptEngine* engine) { RegisterPartyClass(engine); diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterTurnChoices.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterTurnChoices.cpp index 0500377..5659d1b 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterTurnChoices.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterTurnChoices.cpp @@ -45,8 +45,8 @@ void RegisterTurnChoices::RegisterMoveTurnChoice(asIScriptEngine* engine) { r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property", asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL); Ensure(r >= 0); - r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property", - asFUNCTION(GetUserWrapper), asCALL_CDECL_OBJFIRST); + r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property", asFUNCTION(GetUserWrapper), + asCALL_CDECL_OBJFIRST); Ensure(r >= 0); r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property", asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL); diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/HelperFile.hpp b/src/ScriptResolving/AngelScript/TypeRegistry/HelperFile.hpp index a5d45ff..af9693c 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/HelperFile.hpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/HelperFile.hpp @@ -5,7 +5,7 @@ #define UNIQUE_PTR_GETTER_FUNC(o, returns, funcName) \ static returns* funcName##Wrapper(o* obj) { return obj->funcName().get(); } -#define REGISTER_ENUM(enumName, asName) \ +#define REGISTER_ENUM(enumName, asName) \ { \ auto __r = engine->RegisterEnum(asName); \ Ensure(__r >= 0); \ @@ -16,5 +16,4 @@ } // Hack to handle AngelScript not recognizing different sized enums on fields, and returning invalid values due to it. #define ENUM__SIZE_WRAPPER(name, type, func) \ -int32_t name(type* obj) { return static_cast(obj->func()); } - + int32_t name(type* obj) { return static_cast(obj->func()); }