Fixes item use scripts not being properly initialised, and not setting its owner

This commit is contained in:
Deukhoofd 2022-05-15 11:15:13 +02:00
parent 1639a132a9
commit ad733d92c6
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ private:
} }
FunctionInfo InitializeSetOwner() { FunctionInfo InitializeSetOwner() {
auto val = _scriptObject->GetObjectType()->GetMethodByDecl("void SetOwner(ref@ owner)", true); auto val = _scriptObject->GetObjectType()->GetMethodByDecl("void SetOwner(const Item@ owner)", true);
if (val != nullptr) { if (val != nullptr) {
return FunctionInfo{.Exists = true, .Function = val}; return FunctionInfo{.Exists = true, .Function = val};
} }
@ -73,7 +73,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 BattleLibrary@ library, 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)");