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,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);)
}

View File

@ -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(); })
}

View File

@ -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<ScriptResolver*>(pokemon->GetLibrary()->GetScriptResolver().get())
->LoadEvolutionScript(evolution->GetData(0)->AsString());
->LoadEvolutionScript(evolution->GetData(0)->AsString());
if (!script.HasValue()) {
return false;
}

View File

@ -38,7 +38,7 @@ namespace PkmnLib::Battling {
CreatureLib::Battling::CreatureIndex target) const override;
bool CanEvolveFromLevelUp(const ArbUt::BorrowedPtr<const PkmnLib::Library::EvolutionData>& evolution,
const ArbUt::BorrowedPtr<const Pokemon>& pokemon);
const ArbUt::BorrowedPtr<const Pokemon>& pokemon);
inline PkmnLib::Library::TimeOfDay GetTime() const noexcept { return _getTime(); }
};

View File

@ -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

View File

@ -8,7 +8,7 @@ namespace PkmnLib::Library {
}
for (const auto& s : _values) {
const auto* pkmn = dynamic_cast<const PokemonSpecies*>(s.second.get());
if (pkmn == nullptr){
if (pkmn == nullptr) {
continue;
}
for (const auto& evo : pkmn->GetEvolutions()) {

View File

@ -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<i16, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types);
void InitializeByteCode(const ArbUt::Dictionary<i16, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types);
void RegisterScriptType(asITypeInfo* typeInfo, const ArbUt::StringView& metadataKind,
const ArbUt::StringView& effectName);

View File

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

View File

@ -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);

View File

@ -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<int32_t>(obj->func()); }
int32_t name(type* obj) { return static_cast<int32_t>(obj->func()); }