Bunch of fixes for Owners of scripts.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-10-30 11:44:16 +02:00
parent 0f6d538695
commit 3732cab54b
6 changed files with 100 additions and 13 deletions

View File

@@ -20,13 +20,13 @@ AngelScriptScript::AngelScriptScript(const ArbUt::OptionalBorrowedPtr<void>& own
ContextPool* ctxPool)
: PkmnLib::Battling::PkmnScript(owner), _resolver(resolver), _type(type), _ctxPool(ctxPool), _obj(obj) {
if (_type->GetGetOwner().Exists && owner.HasValue()) {
if (ownerType == nullptr){
if (ownerType == nullptr) {
THROW("Script was created with owner value, but with unknown owner type.")
}
CScriptHandle* handle = nullptr;
AngelScriptUtils::AngelscriptFunctionCall(
_type->GetGetOwner().Function, _ctxPool, _obj, _resolver, GetName(), [&](asIScriptContext*) {},
[&](asIScriptContext* ctx) { handle = (CScriptHandle*)ctx->GetReturnObject(); });
[&](asIScriptContext* ctx) { handle = (CScriptHandle*)ctx->GetReturnAddress(); });
handle->Set(owner.GetValue(), ownerType);
}
}