Style Fixes
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-07-09 14:36:14 +02:00
parent d5ef7a33f8
commit 5a082c5995
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
10 changed files with 15 additions and 24 deletions

View File

@ -56,7 +56,6 @@ export void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, i8 amount) { p->ChangeF
SIMPLE_GET_FUNC(Pokemon, IsEgg, bool) SIMPLE_GET_FUNC(Pokemon, IsEgg, bool)
export void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); } export void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); }
export u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species, 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);) Try(p->Evolve(species, forme);)

View File

@ -10,10 +10,5 @@ export u8 PkmnLib_SpeciesLibrary_FindPreEvolution(const PokemonSpecies*& out, co
const PokemonSpecies* species) { const PokemonSpecies* species) {
Try( Try(
auto v = p->FindPreEvolution(species); auto v = p->FindPreEvolution(species);
if (!v.has_value()){ if (!v.has_value()) { out = nullptr; } else { out = v.value().GetRaw(); })
out = nullptr;
} else {
out = v.value().GetRaw();
}
)
} }

View File

@ -65,8 +65,7 @@ bool PkmnLib::Battling::MiscLibrary::CanEvolveFromLevelUp(
case Library::EvolutionMethod::IsGenderAndLevel: case Library::EvolutionMethod::IsGenderAndLevel:
return pokemon->GetLevel() >= evolution->GetData(1)->AsInt() && return pokemon->GetLevel() >= evolution->GetData(1)->AsInt() &&
pokemon->GetGender() == (CreatureLib::Library::Gender)evolution->GetData(0)->AsInt(); pokemon->GetGender() == (CreatureLib::Library::Gender)evolution->GetData(0)->AsInt();
case Library::EvolutionMethod::Custom: case Library::EvolutionMethod::Custom: {
{
auto script = dynamic_cast<ScriptResolver*>(pokemon->GetLibrary()->GetScriptResolver().get()) auto script = dynamic_cast<ScriptResolver*>(pokemon->GetLibrary()->GetScriptResolver().get())
->LoadEvolutionScript(evolution->GetData(0)->AsString()); ->LoadEvolutionScript(evolution->GetData(0)->AsString());
if (!script.HasValue()) { if (!script.HasValue()) {

View File

@ -3,8 +3,8 @@
namespace PkmnLib::Library { namespace PkmnLib::Library {
ENUM(EvolutionMethod, uint8_t, Level, HighFriendship, HighFriendshipTime, KnownMove, LocationBased, TimeBased, ENUM(EvolutionMethod, uint8_t, Level, HighFriendship, HighFriendshipTime, KnownMove, LocationBased, TimeBased,
HoldsItem, HoldsItemTime, IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade, TradeWithHeldItem, HoldsItem, HoldsItemTime, IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade,
TradeWithSpecificPokemon, Custom) TradeWithHeldItem, TradeWithSpecificPokemon, Custom)
} }
#endif // PKMNLIB_EVOLUTIONMETHOD_HPP #endif // PKMNLIB_EVOLUTIONMETHOD_HPP

View File

@ -34,8 +34,7 @@ private:
static i32 IncludeCallback(const char* include, const char* from, CScriptBuilder* builder, void* userParam); static i32 IncludeCallback(const char* include, const char* from, CScriptBuilder* builder, void* userParam);
void RegisterTypes(); void RegisterTypes();
void void InitializeByteCode(const ArbUt::Dictionary<i16, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types);
InitializeByteCode(const ArbUt::Dictionary<i16, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types);
void RegisterScriptType(asITypeInfo* typeInfo, const ArbUt::StringView& metadataKind, void RegisterScriptType(asITypeInfo* typeInfo, const ArbUt::StringView& metadataKind,
const ArbUt::StringView& effectName); const ArbUt::StringView& effectName);

View File

@ -1,7 +1,7 @@
#include "RegisterParty.hpp" #include "RegisterParty.hpp"
#include <CreatureLib/Battling/Models/BattleParty.hpp>
#include "../../../../Battling/Pokemon/PokemonParty.hpp" #include "../../../../Battling/Pokemon/PokemonParty.hpp"
#include "../HelperFile.hpp" #include "../HelperFile.hpp"
#include <CreatureLib/Battling/Models/BattleParty.hpp>
void RegisterParty::Register(asIScriptEngine* engine) { void RegisterParty::Register(asIScriptEngine* engine) {
RegisterPartyClass(engine); RegisterPartyClass(engine);

View File

@ -45,8 +45,8 @@ void RegisterTurnChoices::RegisterMoveTurnChoice(asIScriptEngine* engine) {
r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property", r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property",
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL); asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL);
Ensure(r >= 0); Ensure(r >= 0);
r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property", r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property", asFUNCTION(GetUserWrapper),
asFUNCTION(GetUserWrapper), asCALL_CDECL_OBJFIRST); asCALL_CDECL_OBJFIRST);
Ensure(r >= 0); Ensure(r >= 0);
r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property", r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property",
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL); asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL);

View File

@ -17,4 +17,3 @@
// Hack to handle AngelScript not recognizing different sized enums on fields, and returning invalid values due to it. // 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) \ #define ENUM__SIZE_WRAPPER(name, type, func) \
int32_t name(type* obj) { return static_cast<int32_t>(obj->func()); } int32_t name(type* obj) { return static_cast<int32_t>(obj->func()); }