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

This commit is contained in:
Deukhoofd 2022-06-07 23:23:40 +02:00
parent e4b818c799
commit a05a9ac76d
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
33 changed files with 120 additions and 117 deletions

View File

@ -9,12 +9,14 @@ export_func uint8_t PkmnLib_AngelScriptResolver_Initialize(AngelScriptResolver*
Try(p->Initialize(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);) Try(p->CreateScript(name, script);)
} }
export_func uint8_t PkmnLib_AngelScriptResolver_FinalizeModule(AngelScriptResolver* p) { Try(p->FinalizeModule();) } 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, export_func uint8_t PkmnLib_AngelScriptResolver_LoadScript(CreatureLib::Battling::BattleScript*& out,
void* owner, ScriptCategory category, const char* scriptName) { AngelScriptResolver* p, void* owner, ScriptCategory category,
const char* scriptName) {
Try(out = p->LoadScript(owner, category, ArbUt::StringView(scriptName)).TakeOwnership();) Try(out = p->LoadScript(owner, category, ArbUt::StringView(scriptName)).TakeOwnership();)
} }
export_func uint8_t PkmnLib_AngelScriptResolver_LoadEvolutionScript(PkmnLib::Battling::EvolutionScript const*& out, export_func uint8_t PkmnLib_AngelScriptResolver_LoadEvolutionScript(PkmnLib::Battling::EvolutionScript const*& out,
@ -50,7 +52,9 @@ export_func uint8_t PkmnLib_AngelScriptResolver_RegisterGlobalMethod(AngelScript
void*(func)(void*)) { void*(func)(void*)) {
Try(p->RegisterGlobalMethod(decl, func);) 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 #ifdef ANGELSCRIPT_DEBUGGER
export_func void PkmnLib_AngelScriptResolver_AddDebugger(AngelScriptResolver* p, u16 port) { export_func void PkmnLib_AngelScriptResolver_AddDebugger(AngelScriptResolver* p, u16 port) {

View File

@ -11,6 +11,8 @@ export_func uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary*
} }
export_func void PkmnLib_Battle_Destruct(Battle* p) { p->~Battle(); } 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 uint8_t PkmnLib_Battle_ClearWeather(Battle* p) { Try(p->ClearWeather()); };
export_func const char* PkmnLib_Battle_GetWeatherName(Battle* p) { return p->GetWeatherName().c_str(); } export_func const char* PkmnLib_Battle_GetWeatherName(Battle* p) { return p->GetWeatherName().c_str(); }

View File

@ -2,15 +2,14 @@
#include "../Core.hpp" #include "../Core.hpp"
using namespace PkmnLib::Battling; using namespace PkmnLib::Battling;
export_func uint8_t export_func uint8_t PkmnLib_Pokemon_Construct(
PkmnLib_Pokemon_Construct(Pokemon*& out, const BattleLibrary* library, const PkmnLib::Library::PokemonSpecies* species, Pokemon*& out, const BattleLibrary* library, const PkmnLib::Library::PokemonSpecies* species,
const PkmnLib::Library::PokemonForme* forme, uint8_t level, uint32_t experience, uint32_t uid, 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, CreatureLib::Library::Gender gender, uint8_t coloring, const PkmnLib::Library::Item* heldItem, const char* nickname,
const char* nickname, bool hiddenAbility, uint8_t abilityIndex, bool hiddenAbility, uint8_t abilityIndex, CreatureLib::Battling::LearnedAttack* const* moves, size_t moveCount,
CreatureLib::Battling::LearnedAttack* const* moves, size_t moveCount, uint8_t hpIv, 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 attIv, uint8_t defIv, uint8_t sAtIv, uint8_t sDeIv, uint8_t spIv, uint8_t hpEv, uint8_t defEv, uint8_t sAtEv, uint8_t sDeEv, uint8_t spEv, const PkmnLib::Library::Nature* nature,
uint8_t attEv, uint8_t defEv, uint8_t sAtEv, uint8_t sDeEv, uint8_t spEv, bool allowedExperienceGain, bool isEgg) {
const PkmnLib::Library::Nature* nature, bool allowedExperienceGain, bool isEgg) {
Try({ Try({
if (nickname == nullptr) { if (nickname == nullptr) {
nickname = ""; nickname = "";

View File

@ -4,4 +4,6 @@ std::string ExceptionHandler::_pkmnLibLastException = "";
std::string ExceptionHandler::_pkmnLibLastExceptionStacktrace = "Unset"; std::string ExceptionHandler::_pkmnLibLastExceptionStacktrace = "Unset";
export_func const char* PkmnLib_C_GetLastException() { return ExceptionHandler::GetLastException(); } export_func const char* PkmnLib_C_GetLastException() { return ExceptionHandler::GetLastException(); }
export_func const char* PkmnLib_C_GetLastExceptionStacktrace() { return ExceptionHandler::GetLastExceptionStacktrace(); } export_func const char* PkmnLib_C_GetLastExceptionStacktrace() {
return ExceptionHandler::GetLastExceptionStacktrace();
}

View File

@ -9,7 +9,8 @@ export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipEvolution
const PokemonSpecies* into) { const PokemonSpecies* into) {
return EvolutionData::CreateFriendshipEvolution(friendship, into); return EvolutionData::CreateFriendshipEvolution(friendship, into);
} }
export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime, export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship,
TimeOfDay startTime,
TimeOfDay endTime, TimeOfDay endTime,
const PokemonSpecies* into) { const PokemonSpecies* into) {
return EvolutionData::CreateFriendshipTimeEvolution(friendship, startTime, endTime, into); return EvolutionData::CreateFriendshipTimeEvolution(friendship, startTime, endTime, into);
@ -31,7 +32,8 @@ export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemEvolution(c
const PokemonSpecies* into) { const PokemonSpecies* into) {
return EvolutionData::CreateHeldItemEvolution(item, into); return EvolutionData::CreateHeldItemEvolution(item, into);
} }
export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime, export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item,
TimeOfDay startTime,
TimeOfDay endTime, TimeOfDay endTime,
const PokemonSpecies* into) { const PokemonSpecies* into) {
return EvolutionData::CreateHeldItemTimeEvolution(item, startTime, endTime, into); return EvolutionData::CreateHeldItemTimeEvolution(item, startTime, endTime, into);
@ -41,12 +43,13 @@ export_func const EvolutionData* PkmnLib_EvolutionData_CreateGenderBasedEvolutio
const PokemonSpecies* into) { const PokemonSpecies* into) {
return EvolutionData::CreateGenderBasedEvolution(gender, level, 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); return EvolutionData::CreateItemUseEvolution(item, into);
} }
export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item, export_func const EvolutionData*
CreatureLib::Library::Gender gender, PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item, CreatureLib::Library::Gender gender,
const PokemonSpecies* into) { const PokemonSpecies* into) {
return EvolutionData::CreateItemUseWithGenderEvolution(item, gender, into); return EvolutionData::CreateItemUseWithGenderEvolution(item, gender, into);
} }

View File

@ -5,11 +5,12 @@ using namespace PkmnLib::Library;
export_func Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::ItemCategory category, export_func Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::ItemCategory category,
CreatureLib::Library::BattleItemCategory battleCategory, int32_t price, CreatureLib::Library::BattleItemCategory battleCategory, int32_t price,
const char* effectName, CreatureLib::Library::EffectParameter* effectParameters[], const char* effectName,
CreatureLib::Library::EffectParameter* effectParameters[],
size_t effectParameterCount, const char* battleTriggerEffectName, size_t effectParameterCount, const char* battleTriggerEffectName,
CreatureLib::Library::EffectParameter* battleTriggerEffectParameters[], CreatureLib::Library::EffectParameter* battleTriggerEffectParameters[],
size_t battleTriggerEffectParameterCount, const char* flags[], size_t flagsCount, size_t battleTriggerEffectParameterCount, const char* flags[],
uint8_t flingPower) { size_t flagsCount, uint8_t flingPower) {
std::unordered_set<uint32_t> conversedFlags(flagsCount); std::unordered_set<uint32_t> conversedFlags(flagsCount);
for (size_t i = 0; i < flagsCount; i++) { for (size_t i = 0; i < flagsCount; i++) {
conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i])); conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i]));

View File

@ -25,9 +25,12 @@ export_func void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { dele
SIMPLE_GET_FUNC(PokemonSpecies, GetBaseHappiness, uint8_t); SIMPLE_GET_FUNC(PokemonSpecies, GetBaseHappiness, uint8_t);
export_func void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); } 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()); 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()); 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) { export_func const char* PkmnLib_PokemonSpecies_GetEggGroup(const PokemonSpecies* p, size_t index) {
return p->GetEggGroups()[index].c_str(); return p->GetEggGroups()[index].c_str();
} }

View File

@ -95,7 +95,6 @@ float PkmnLib::Battling::DamageLibrary::GetStatModifier(CreatureLib::Battling::E
PKMN_HOOK(ModifyOffensiveStatValue, attack, attack, target, hit, &offensiveValue); PKMN_HOOK(ModifyOffensiveStatValue, attack, attack, target, hit, &offensiveValue);
PKMN_HOOK(ModifyDefensiveStatValue, attack, attack, target, hit, &defensiveValue); PKMN_HOOK(ModifyDefensiveStatValue, attack, attack, target, hit, &defensiveValue);
return offensiveValue / defensiveValue; return offensiveValue / defensiveValue;
} }
float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling::ExecutingAttack*, float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling::ExecutingAttack*,

View File

@ -83,8 +83,7 @@ void PkmnLib::Battling::Pokemon::AttemptCapture(PkmnLib::Library::Item* catchIte
Ensure(_battleData.Side.HasValue()); Ensure(_battleData.Side.HasValue());
Ensure(!IsFainted()); Ensure(!IsFainted());
Ensure(IsUsable()); Ensure(IsUsable());
auto captureLibrary = auto captureLibrary = GetLibrary().ForceAs<const BattleLibrary>()->GetCaptureLibrary();
GetLibrary().ForceAs<const BattleLibrary>()->GetCaptureLibrary();
auto result = captureLibrary->TryCatch(this, catchItem, _battleData.Battle.GetValue()->GetRandom()); auto result = captureLibrary->TryCatch(this, catchItem, _battleData.Battle.GetValue()->GetRandom());
_battleData.Battle.GetValue()->TriggerEventListener<CaptureAttemptEvent>(this, result); _battleData.Battle.GetValue()->TriggerEventListener<CaptureAttemptEvent>(this, result);

View File

@ -11,8 +11,8 @@ namespace PkmnLib::Library {
MoveData(const ArbUt::StringView& name, u8 type, PkmnLib::Library::MoveCategory category, u8 power, u8 accuracy, MoveData(const ArbUt::StringView& name, u8 type, PkmnLib::Library::MoveCategory category, u8 power, u8 accuracy,
u8 baseUsage, CreatureLib::Library::AttackTarget target, i8 priority, u8 baseUsage, CreatureLib::Library::AttackTarget target, i8 priority,
const CreatureLib::Library::SecondaryEffect* nullable effect, std::unordered_set<u32> flags) const CreatureLib::Library::SecondaryEffect* nullable effect, std::unordered_set<u32> flags)
: AttackData(name, type, static_cast<CreatureLib::Library::AttackCategory>(category), power, accuracy, baseUsage, : AttackData(name, type, static_cast<CreatureLib::Library::AttackCategory>(category), power, accuracy,
target, priority, effect, std::move(flags)) {}; baseUsage, target, priority, effect, std::move(flags)){};
inline PkmnLib::Library::MoveCategory GetCategory() const { inline PkmnLib::Library::MoveCategory GetCategory() const {
return static_cast<PkmnLib::Library::MoveCategory>(AttackData::GetCategory()); return static_cast<PkmnLib::Library::MoveCategory>(AttackData::GetCategory());

View File

@ -25,9 +25,7 @@ namespace PkmnLib::Library {
return _items.Get(name); return _items.Get(name);
} }
inline ArbUt::BorrowedPtr<const Nature> GetNatureByHash(u32 hash) const { inline ArbUt::BorrowedPtr<const Nature> GetNatureByHash(u32 hash) const { return _items.GetFromHash(hash); }
return _items.GetFromHash(hash);
}
inline const ArbUt::StringView& GetRandomNatureName(ArbUt::Random rand = ArbUt::Random()) const { inline const ArbUt::StringView& GetRandomNatureName(ArbUt::Random rand = ArbUt::Random()) const {
auto i = rand.Get(_items.Count()); auto i = rand.Get(_items.Count());

View File

@ -33,9 +33,7 @@ namespace PkmnLib::Library {
return CreatureLib::Library::SpeciesLibrary::GetByHash(hashedKey).As<const PokemonSpecies>(); return CreatureLib::Library::SpeciesLibrary::GetByHash(hashedKey).As<const PokemonSpecies>();
} }
ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::StringView& name) const { ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::StringView& name) const { return Get(name); }
return Get(name);
}
std::optional<ArbUt::BorrowedPtr<const PokemonSpecies>> std::optional<ArbUt::BorrowedPtr<const PokemonSpecies>>
FindPreEvolution(const ArbUt::BorrowedPtr<const PokemonSpecies>& species) const noexcept; FindPreEvolution(const ArbUt::BorrowedPtr<const PokemonSpecies>& species) const noexcept;

View File

@ -72,8 +72,7 @@ private:
#define ITEM_USE_SCRIPT_HOOK_FUNCTION(name, decl) FunctionInfo __##name = Initialize(decl) #define ITEM_USE_SCRIPT_HOOK_FUNCTION(name, decl) FunctionInfo __##name = Initialize(decl)
ITEM_USE_SCRIPT_HOOK_FUNCTION( ITEM_USE_SCRIPT_HOOK_FUNCTION(OnInitialize, "void OnInitialize(const narray<EffectParameter@>@ parameters)");
OnInitialize, "void OnInitialize(const narray<EffectParameter@>@ parameters)");
ITEM_USE_SCRIPT_HOOK_FUNCTION(IsItemUsable, "bool IsItemUsable()"); ITEM_USE_SCRIPT_HOOK_FUNCTION(IsItemUsable, "bool IsItemUsable()");
ITEM_USE_SCRIPT_HOOK_FUNCTION(IsPokemonUseItem, "bool IsPokemonUseItem()"); ITEM_USE_SCRIPT_HOOK_FUNCTION(IsPokemonUseItem, "bool IsPokemonUseItem()");
ITEM_USE_SCRIPT_HOOK_FUNCTION(IsUseValidForPokemon, "bool IsUseValidForPokemon(Pokemon@ target)"); ITEM_USE_SCRIPT_HOOK_FUNCTION(IsUseValidForPokemon, "bool IsUseValidForPokemon(Pokemon@ target)");

View File

@ -13,8 +13,9 @@ protected:
IPkmnBinaryStream(size_t angelScriptBound) : _angelScriptBound(angelScriptBound) {} IPkmnBinaryStream(size_t angelScriptBound) : _angelScriptBound(angelScriptBound) {}
public: public:
virtual void WriteTypes( virtual void
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo* non_null>>& types, WriteTypes(const ArbUt::Dictionary<ScriptCategory,
ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo * non_null>>& types,
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo * non_null>& itemUseTypes, const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo * non_null>& itemUseTypes,
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo * non_null>& evolutionTypes) { const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo * non_null>& evolutionTypes) {
// We serialize our types in the format // We serialize our types in the format

View File

@ -26,7 +26,6 @@ static bool GetMove(const PkmnLib::Library::MoveLibrary* obj, const ArbUt::Basic
return obj->Get(str); return obj->Get(str);
} }
void RegisterMoveTypes::RegisterMoveType(asIScriptEngine* engine) { void RegisterMoveTypes::RegisterMoveType(asIScriptEngine* engine) {
int r = engine->RegisterObjectType("MoveData", 0, asOBJ_REF | asOBJ_NOCOUNT); int r = engine->RegisterObjectType("MoveData", 0, asOBJ_REF | asOBJ_NOCOUNT);
Ensure(r >= 0); Ensure(r >= 0);

View File

@ -6,8 +6,7 @@
class WebAssemblyScriptResolver; class WebAssemblyScriptResolver;
class LibraryMethods { class LibraryMethods {
public: public:
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, WebAssemblyScriptResolver* resolver);
WebAssemblyScriptResolver* resolver);
}; };
#endif // PKMNLIB_LIBRARYMETHODS_H #endif // PKMNLIB_LIBRARYMETHODS_H

View File

@ -6,8 +6,7 @@
class WebAssemblyScriptResolver; class WebAssemblyScriptResolver;
class WASMItemRegistry { class WASMItemRegistry {
public: public:
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, WebAssemblyScriptResolver* resolver);
WebAssemblyScriptResolver* resolver);
}; };
#endif // PKMNLIB_WASMITEMREGISTRY_H #endif // PKMNLIB_WASMITEMREGISTRY_H

View File

@ -8,9 +8,7 @@ using namespace CreatureLib::Library;
wasm_func_t* MoveData_HasFlagByHash(WebAssemblyScriptResolver* resolver) { wasm_func_t* MoveData_HasFlagByHash(WebAssemblyScriptResolver* resolver) {
return WasmHelpers::CreateFunc<bool, AttackData*, u32>( return WasmHelpers::CreateFunc<bool, AttackData*, u32>(
resolver, {[](WebAssemblyScriptResolver*, AttackData* move, u32 flag) -> bool { resolver, {[](WebAssemblyScriptResolver*, AttackData* move, u32 flag) -> bool { return move->HasFlag(flag); }});
return move->HasFlag(flag);
}});
} }
void WASMMoveDataRegistry::Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, void WASMMoveDataRegistry::Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,

View File

@ -7,8 +7,7 @@
class WebAssemblyScriptResolver; class WebAssemblyScriptResolver;
class WASMMoveDataRegistry { class WASMMoveDataRegistry {
public: public:
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, WebAssemblyScriptResolver* resolver);
WebAssemblyScriptResolver* resolver);
}; };
#endif // PKMNLIB_WASMMOVEDATAREGISTRY_H #endif // PKMNLIB_WASMMOVEDATAREGISTRY_H

View File

@ -37,7 +37,6 @@ wasm_func_t* Species_HasEggGroupByHash(WebAssemblyScriptResolver* resolver) {
}}); }});
} }
void WASMSpeciesRegistry::Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, void WASMSpeciesRegistry::Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,
WebAssemblyScriptResolver* resolver) { WebAssemblyScriptResolver* resolver) {
REGISTER_GETTER("species_get_id", CreatureSpecies, GetId, resolver) REGISTER_GETTER("species_get_id", CreatureSpecies, GetId, resolver)

View File

@ -7,8 +7,7 @@ class WebAssemblyScriptResolver;
class WASMSpeciesRegistry { class WASMSpeciesRegistry {
public: public:
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, WebAssemblyScriptResolver* resolver);
WebAssemblyScriptResolver* resolver);
}; };
#endif // PKMNLIB_WASMSPECIESREGISTRY_HPP #endif // PKMNLIB_WASMSPECIESREGISTRY_HPP

View File

@ -6,6 +6,7 @@ public:
WasmExternRef(T* ptr) : _ptr(ptr) {} WasmExternRef(T* ptr) : _ptr(ptr) {}
[[nodiscard]] inline T* GetPtr() const noexcept { return _ptr; } [[nodiscard]] inline T* GetPtr() const noexcept { return _ptr; }
private: private:
T* _ptr; T* _ptr;
}; };