From 53bd6e7a94f417b231d0567640bf068a48a87228 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 12 Dec 2020 14:25:27 +0100 Subject: [PATCH] Update to new Arbutils memory model. --- CInterface/Library/SpeciesLibrary.cpp | 5 ++- src/Battling/Library/DamageLibrary.cpp | 3 +- src/Battling/Library/ExperienceLibrary.cpp | 4 +- src/Battling/Library/MiscLibrary.cpp | 3 +- src/Battling/Pokemon/CreatePokemon.cpp | 37 ++++++++++--------- src/Battling/Pokemon/CreatePokemon.hpp | 1 - src/Battling/Pokemon/Pokemon.cpp | 12 +++--- src/Battling/Pokemon/Pokemon.hpp | 2 +- src/Library/Items/ItemLibrary.hpp | 8 ++-- src/Library/Moves/MoveLibrary.hpp | 10 ++--- src/Library/Species/PokemonSpecies.hpp | 12 +++--- src/Library/Species/SpeciesLibrary.cpp | 12 +++--- src/Library/Species/SpeciesLibrary.hpp | 14 +++---- .../AngelScript/AngelScriptResolver.cpp | 17 +++++---- .../AngelScript/AngelScriptResolver.hpp | 7 +++- .../AngelScript/AngelScriptTypeInfo.hpp | 8 ++-- .../Battling/RegisterPokemonClass.cpp | 2 +- .../AngelScript/TypeRegistry/HelperFile.hpp | 2 + .../ScriptTypeTests/Battle/PokemonTests.cpp | 2 +- 19 files changed, 87 insertions(+), 74 deletions(-) diff --git a/CInterface/Library/SpeciesLibrary.cpp b/CInterface/Library/SpeciesLibrary.cpp index c784d4c..763201c 100644 --- a/CInterface/Library/SpeciesLibrary.cpp +++ b/CInterface/Library/SpeciesLibrary.cpp @@ -4,5 +4,8 @@ using namespace PkmnLib::Library; export const PokemonSpecies* PkmnLib_SpeciesLibrary_FindPreEvolution(const SpeciesLibrary* p, const PokemonSpecies* species) { - return p->FindPreEvolution(species).GetRaw(); + auto v = p->FindPreEvolution(species); + if (!v.has_value()) + return nullptr; + return v.value().GetRaw(); } \ No newline at end of file diff --git a/src/Battling/Library/DamageLibrary.cpp b/src/Battling/Library/DamageLibrary.cpp index ad30347..e5f2ebf 100644 --- a/src/Battling/Library/DamageLibrary.cpp +++ b/src/Battling/Library/DamageLibrary.cpp @@ -83,7 +83,8 @@ float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling: PKMN_HOOK(OverrideCriticalModifier, attack, attack, target, hitIndex, &critModifier); mod *= critModifier; } - float randPercentage = 85 + attack->GetUser()->GetBattle()->GetRandom()->Get(0, 16); + Assert(attack->GetUser()->GetBattle().GetValue()); + float randPercentage = 85 + attack->GetUser()->GetBattle().GetValue()->GetRandom()->Get(0, 16); mod *= randPercentage / 100.0; if (attack->GetUser()->HasType(hitData.GetType())) { float stabModifier = 1.5; diff --git a/src/Battling/Library/ExperienceLibrary.cpp b/src/Battling/Library/ExperienceLibrary.cpp index f20b3a8..31b7db1 100644 --- a/src/Battling/Library/ExperienceLibrary.cpp +++ b/src/Battling/Library/ExperienceLibrary.cpp @@ -36,12 +36,12 @@ void PkmnLib::Battling::ExperienceLibrary::HandleExperienceGain( } auto battle = fainted->GetBattle(); - if (battle == nullptr) { + if (!battle.HasValue()) { return; } std::unordered_set shareExperience; - for (const auto& party : battle->GetParties()) { + for (const auto& party : battle.GetValue()->GetParties()) { for (const auto& mon : party->GetParty()->GetParty()) { if (mon == nullptr) continue; diff --git a/src/Battling/Library/MiscLibrary.cpp b/src/Battling/Library/MiscLibrary.cpp index 2058e66..069a98a 100644 --- a/src/Battling/Library/MiscLibrary.cpp +++ b/src/Battling/Library/MiscLibrary.cpp @@ -7,7 +7,8 @@ bool PkmnLib::Battling::MiscLibrary::IsCritical(CreatureLib::Battling::Executing CreatureLib::Battling::Creature* target, uint8_t hit) const { uint8_t critStage = 0; PKMN_HOOK(ModifyCriticalStage, attack, attack, target, hit, &critStage); - auto rand = target->GetBattle()->GetRandom(); + Assert(target->GetBattle().HasValue()); + auto rand = target->GetBattle().GetValue()->GetRandom(); switch (critStage) { case 0: return rand->Get(24) == 0; case 1: return rand->Get(8) == 0; diff --git a/src/Battling/Pokemon/CreatePokemon.cpp b/src/Battling/Pokemon/CreatePokemon.cpp index 6a1cb09..21177db 100644 --- a/src/Battling/Pokemon/CreatePokemon.cpp +++ b/src/Battling/Pokemon/CreatePokemon.cpp @@ -36,14 +36,15 @@ namespace PkmnLib::Battling { Pokemon* CreatePokemon::Build() { auto rand = ArbUt::Random(); - ArbUt::BorrowedPtr species = nullptr; - if (!this->_library->GetSpeciesLibrary()->TryGet(this->_species, species)) { + + auto species = this->_library->GetSpeciesLibrary()->TryGet(this->_species); + if (!species.has_value()) { std::stringstream err; err << "Invalid species '" << _species << "'."; throw ArbUt::Exception(err.str()); } - ArbUt::BorrowedPtr forme; - if (!species->TryGetForme(this->_forme, forme)) { + auto forme = species.value()->TryGetForme(this->_forme); + if (!forme.has_value()) { std::stringstream err; err << "Invalid forme '" << _forme << "' for species '" << _forme << "'."; throw ArbUt::Exception(err.str()); @@ -51,9 +52,9 @@ namespace PkmnLib::Battling { AssertNotNull(forme); CreatureLib::Library::TalentIndex ability; if (this->_ability.IsEmpty()) { - ability = forme->GetRandomTalent(rand); + ability = forme.value()->GetRandomTalent(rand); } else { - ability = forme->GetTalentIndex(this->_ability); + ability = forme.value()->GetTalentIndex(this->_ability); } auto identifier = this->_identifier; if (identifier == 0) { @@ -61,16 +62,18 @@ namespace PkmnLib::Battling { } auto gender = this->_gender; if (gender == static_cast(-1)) { - gender = species->GetRandomGender(rand); + gender = species.value()->GetRandomGender(rand); } - ArbUt::BorrowedPtr heldItem = nullptr; + ArbUt::OptionalBorrowedPtr heldItem = nullptr; if (!this->_heldItem.IsEmpty()) { - if (!_library->GetItemLibrary()->TryGet(this->_heldItem, heldItem)) { + auto item = _library->GetItemLibrary()->TryGet(this->_heldItem); + if (!item.has_value()) { THROW("Unknown Item: " << this->_heldItem.std_str()); } - AssertNotNull(heldItem); + heldItem = item.value(); } - auto experience = _library->GetGrowthRateLibrary()->CalculateExperience(species->GetGrowthRate(), _level); + auto experience = + _library->GetGrowthRateLibrary()->CalculateExperience(species.value()->GetGrowthRate(), _level); auto attacks = std::vector(_attacks.Count()); for (size_t i = 0; i < _attacks.Count(); i++) { @@ -98,8 +101,8 @@ namespace PkmnLib::Battling { shiny = rand.Get(_library->GetSettings()->GetShinyRate()) == 0; } - auto pkmn = new Pokemon(_library, species, forme, _level, experience, identifier, gender, shiny, heldItem, - _nickname, ability, attacks, ivs, evs, nature, _allowedExperienceGain); + auto pkmn = new Pokemon(_library, species.value(), forme.value(), _level, experience, identifier, gender, shiny, + heldItem, _nickname, ability, attacks, ivs, evs, nature, _allowedExperienceGain); pkmn->Initialize(); return pkmn; } @@ -146,15 +149,15 @@ namespace PkmnLib::Battling { } CreatePokemon& CreatePokemon::LearnMove(const ArbUt::StringView& moveName, CreatureLib::Battling::AttackLearnMethod method) { - ArbUt::BorrowedPtr move = nullptr; - if (!_library->GetMoveLibrary()->TryGet(moveName, move)) { + auto v = _library->GetMoveLibrary()->TryGet(moveName); + if (!v.has_value()) { THROW("Invalid Move given: " << moveName.std_str()); } if (_currentMove >= _library->GetSettings()->GetMaximalAttacks()) { throw ArbUt::Exception("This pokemon already has the maximal allowed moves."); } - Assert(move != nullptr); - _attacks.Append(ToLearnMethod(move, method)); + Assert(v.value() != nullptr); + _attacks.Append(ToLearnMethod(v.value(), method)); return *this; } CreatePokemon& CreatePokemon::IsAllowedExperienceGain(bool value) { diff --git a/src/Battling/Pokemon/CreatePokemon.hpp b/src/Battling/Pokemon/CreatePokemon.hpp index 9df2b83..0392417 100644 --- a/src/Battling/Pokemon/CreatePokemon.hpp +++ b/src/Battling/Pokemon/CreatePokemon.hpp @@ -20,7 +20,6 @@ namespace PkmnLib::Battling { struct ToLearnMethod { ArbUt::BorrowedPtr Move; CreatureLib::Battling::AttackLearnMethod LearnMethod; - ToLearnMethod() : Move(nullptr), LearnMethod(CreatureLib::Battling::AttackLearnMethod::Unknown){}; ToLearnMethod(ArbUt::BorrowedPtr move, CreatureLib::Battling::AttackLearnMethod method) : Move(move), LearnMethod(method){}; diff --git a/src/Battling/Pokemon/Pokemon.cpp b/src/Battling/Pokemon/Pokemon.cpp index 12b4a4b..8ced9b3 100644 --- a/src/Battling/Pokemon/Pokemon.cpp +++ b/src/Battling/Pokemon/Pokemon.cpp @@ -12,8 +12,8 @@ void PkmnLib::Battling::Pokemon::Evolve(ArbUt::BorrowedPtrGetGenderRate() != -1) { // If we are currently in battle, use the battle random so we can get predictable events. - if (!_battle.IsNull()) { - _gender = _species->GetRandomGender(_battle->GetRandom()->GetRNG()); + if (_battle.HasValue()) { + _gender = _species->GetRandomGender(_battle.GetValue()->GetRandom()->GetRNG()); } // Else create a new random. else { @@ -34,8 +34,8 @@ void PkmnLib::Battling::Pokemon::SetStatus(const ArbUt::StringView& name) { } _statusScript = std::unique_ptr( _library->LoadScript(static_cast(PkmnScriptCategory::Status), name)); - if (_battle != nullptr) { - _battle->TriggerEventListener(this, name); + if (_battle.HasValue()) { + _battle.GetValue()->TriggerEventListener(this, name); } } void PkmnLib::Battling::Pokemon::ClearStatus() { @@ -43,7 +43,7 @@ void PkmnLib::Battling::Pokemon::ClearStatus() { return; _statusScript->OnRemove(); _statusScript = nullptr; - if (_battle != nullptr) { - _battle->TriggerEventListener(this, ""_cnc); + if (_battle.HasValue()) { + _battle.GetValue()->TriggerEventListener(this, ""_cnc); } } \ No newline at end of file diff --git a/src/Battling/Pokemon/Pokemon.hpp b/src/Battling/Pokemon/Pokemon.hpp index 40069dc..7c75c8e 100644 --- a/src/Battling/Pokemon/Pokemon.hpp +++ b/src/Battling/Pokemon/Pokemon.hpp @@ -21,7 +21,7 @@ namespace PkmnLib::Battling { const ArbUt::BorrowedPtr& species, const ArbUt::BorrowedPtr& forme, level_int_t level, uint32_t experience, uint32_t uid, CreatureLib::Library::Gender gender, uint8_t coloring, - ArbUt::BorrowedPtr heldItem, const std::string& nickname, + ArbUt::OptionalBorrowedPtr heldItem, const std::string& nickname, const CreatureLib::Library::TalentIndex& talent, const std::vector& moves, CreatureLib::Library::ClampedStatisticSet individualValues, diff --git a/src/Library/Items/ItemLibrary.hpp b/src/Library/Items/ItemLibrary.hpp index acb8a49..1f52738 100644 --- a/src/Library/Items/ItemLibrary.hpp +++ b/src/Library/Items/ItemLibrary.hpp @@ -6,11 +6,9 @@ namespace PkmnLib::Library { class ItemLibrary final : public CreatureLib::Library::ItemLibrary { public: - inline bool TryGet(const ArbUt::BasicStringView& name, ArbUt::BorrowedPtr& item) const { - auto v = item.As(); - auto res = CreatureLib::Library::ItemLibrary::TryGet(name.GetHash(), v); - item = v.ForceAs(); - return res; + inline std::optional> TryGet(const ArbUt::BasicStringView& name) const { + auto res = CreatureLib::Library::ItemLibrary::TryGet(name.GetHash()); + return reinterpret_cast>&>(res); } inline ArbUt::BorrowedPtr Get(const ArbUt::BasicStringView& name) const { diff --git a/src/Library/Moves/MoveLibrary.hpp b/src/Library/Moves/MoveLibrary.hpp index eff4d03..0343f40 100644 --- a/src/Library/Moves/MoveLibrary.hpp +++ b/src/Library/Moves/MoveLibrary.hpp @@ -12,11 +12,11 @@ namespace PkmnLib::Library { return Get(name); } - inline bool TryGet(const ArbUt::BasicStringView& name, ArbUt::BorrowedPtr& move) const { - auto v = move.As(); - auto res = CreatureLib::Library::AttackLibrary::TryGet(name, v); - move = v.As(); - return res; + inline std::optional> TryGet(const ArbUt::BasicStringView& name) const { + auto res = CreatureLib::Library::AttackLibrary::TryGet(name); + if (!res.has_value()) + return {}; + return res.value().ForceAs(); } inline ArbUt::BorrowedPtr Get(const ArbUt::BasicStringView& name) const { return CreatureLib::Library::AttackLibrary::Get(name).As(); diff --git a/src/Library/Species/PokemonSpecies.hpp b/src/Library/Species/PokemonSpecies.hpp index fd3bc25..f346d54 100644 --- a/src/Library/Species/PokemonSpecies.hpp +++ b/src/Library/Species/PokemonSpecies.hpp @@ -29,12 +29,12 @@ namespace PkmnLib::Library { inline bool HasForme(const ArbUt::BasicStringView& key) const { return HasVariant(key); } - inline bool TryGetForme(const ArbUt::BasicStringView& key, - ArbUt::BorrowedPtr& forme) const { - auto v = forme.As(); - auto res = TryGetVariant(key, v); - forme = v.As(); - return res; + inline std::optional> + TryGetForme(const ArbUt::BasicStringView& key) const { + auto res = TryGetVariant(key); + if (!res.has_value()) + return {}; + return res.value().As(); } inline ArbUt::BorrowedPtr GetForme(const ArbUt::BasicStringView& key) const { diff --git a/src/Library/Species/SpeciesLibrary.cpp b/src/Library/Species/SpeciesLibrary.cpp index e5e49af..3dbbf94 100644 --- a/src/Library/Species/SpeciesLibrary.cpp +++ b/src/Library/Species/SpeciesLibrary.cpp @@ -1,20 +1,20 @@ #include "SpeciesLibrary.hpp" namespace PkmnLib::Library { - ArbUt::BorrowedPtr + std::optional> SpeciesLibrary::FindPreEvolution(const ArbUt::BorrowedPtr& species) const noexcept { if (_preEvolutionCache.Has(species)) { return _preEvolutionCache[species]; } - for (auto& s : _values) { - auto pkmn = (PokemonSpecies*)s.second.get(); - for (auto& evo : pkmn->GetEvolutions()) { + for (const auto& s : _values) { + auto* pkmn = (PokemonSpecies*)s.second.get(); + for (const auto& evo : pkmn->GetEvolutions()) { if (evo->GetNewSpecies() == species) { - auto non_const = const_cast(this); + auto* non_const = const_cast(this); non_const->_preEvolutionCache[species] = pkmn; return pkmn; } } } - return nullptr; + return {}; } } diff --git a/src/Library/Species/SpeciesLibrary.hpp b/src/Library/Species/SpeciesLibrary.hpp index 4d3df8f..a696109 100644 --- a/src/Library/Species/SpeciesLibrary.hpp +++ b/src/Library/Species/SpeciesLibrary.hpp @@ -10,12 +10,12 @@ namespace PkmnLib::Library { _preEvolutionCache; public: - inline bool TryGet(const ArbUt::BasicStringView& name, - ArbUt::BorrowedPtr& outSpecies) const { - auto v = outSpecies.As(); - auto res = CreatureLib::Library::SpeciesLibrary::TryGet(name, v); - outSpecies = v.As(); - return res; + inline std::optional> + TryGet(const ArbUt::BasicStringView& name) const { + auto res = CreatureLib::Library::SpeciesLibrary::TryGet(name); + if (!res.has_value()) + return {}; + return res.value().ForceAs(); } inline ArbUt::BorrowedPtr Get(const ArbUt::BasicStringView& name) const { @@ -26,7 +26,7 @@ namespace PkmnLib::Library { return Get(name); } - ArbUt::BorrowedPtr + std::optional> FindPreEvolution(const ArbUt::BorrowedPtr& species) const noexcept; }; } diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp index 81e0b38..49fa9ef 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp @@ -91,7 +91,7 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg, _contextPool = new ContextPool(_engine); } -BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::Battle, GetBattle); +OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::Battle, GetBattle); void AngelScriptResolver::RegisterTypes() { // Register static library types @@ -129,23 +129,26 @@ void AngelScriptResolver::MessageCallback(const asSMessageInfo* msg, void*) { CreatureLib::Battling::Script* AngelScriptResolver::LoadScript(ScriptCategory category, const ArbUt::StringView& scriptName) { ArbUt::Dictionary innerDb; - if (!_typeDatabase.TryGet(category, innerDb)) { + auto v = _typeDatabase.TryGet(category); + if (!v.has_value()) { innerDb.Insert(scriptName, nullptr); _typeDatabase.Insert(category, innerDb); return nullptr; + } else { + innerDb = v.value(); } - AngelScriptTypeInfo* t; - if (!innerDb.TryGet(scriptName, t)) { + auto t = innerDb.TryGet(scriptName); + if (!t.has_value()) { innerDb.Insert(scriptName, nullptr); return nullptr; } - if (t == nullptr) { + if (!t.has_value()) { return nullptr; } auto ctx = _contextPool->RequestContext(); - auto obj = t->Instantiate(ctx); + auto obj = const_cast(t.value().get())->Instantiate(ctx); _contextPool->ReturnContextToPool(ctx); - return new AngelScriptScript(this, t, obj, _contextPool); + return new AngelScriptScript(this, t.value(), obj, _contextPool); } void AngelScriptResolver::FinalizeModule() { int r = _builder.BuildModule(); diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp index 8562b2c..e46ac26 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp @@ -70,10 +70,13 @@ public: } asITypeInfo* GetBaseType(const ArbUt::StringView& name) { - asITypeInfo* t = nullptr; - if (!_baseTypes.TryGet(name, t)) { + asITypeInfo* t; + auto v = _baseTypes.TryGet(name); + if (!v.has_value()) { t = this->_engine->GetTypeInfoByDecl(name.c_str()); _baseTypes.Insert(name, t); + } else { + t = v.value(); } return t; } diff --git a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp index db98410..f563b9e 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp @@ -42,11 +42,11 @@ public: const char* GetDecl() { return _type->GetName(); } asIScriptFunction* GetFunction(const ArbUt::BasicStringView& functionName) { - asIScriptFunction* func; - if (_functions.TryGet(functionName, func)) { - return func; + auto v = _functions.TryGet(functionName); + if (v.has_value()) { + return v.value(); } - func = _type->GetMethodByName(functionName.c_str()); + auto func = _type->GetMethodByName(functionName.c_str()); if (func != nullptr) { func->AddRef(); } diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp index 0ae6309..4dcd617 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp @@ -83,7 +83,7 @@ static std::string NicknameWrapper(const PkmnLib::Battling::Pokemon* obj) { retu BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::CreatureSpecies, GetSpecies); BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const PkmnLib::Library::PokemonForme, GetForme); -BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::Item, GetHeldItem); +OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::Item, GetHeldItem); void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) { [[maybe_unused]] int r = engine->RegisterObjectType("Pokemon", 0, asOBJ_REF | asOBJ_NOCOUNT); diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/HelperFile.hpp b/src/ScriptResolving/AngelScript/TypeRegistry/HelperFile.hpp index 83d0ac7..c5ccce0 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/HelperFile.hpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/HelperFile.hpp @@ -1,4 +1,6 @@ #define BORROWED_PTR_GETTER_FUNC(o, returns, funcName) \ static returns* funcName##Wrapper(o* obj) { return obj->funcName().GetRaw(); } +#define OPTIONAL_BORROWED_PTR_GETTER_FUNC(o, returns, funcName) \ + static returns* funcName##Wrapper(o* obj) { return obj->funcName().GetValue(); } #define UNIQUE_PTR_GETTER_FUNC(o, returns, funcName) \ static returns* funcName##Wrapper(o* obj) { return obj->funcName().get(); } diff --git a/tests/ScriptTests/ScriptTypeTests/Battle/PokemonTests.cpp b/tests/ScriptTests/ScriptTypeTests/Battle/PokemonTests.cpp index c8985b5..bb7abe9 100644 --- a/tests/ScriptTests/ScriptTypeTests/Battle/PokemonTests.cpp +++ b/tests/ScriptTests/ScriptTypeTests/Battle/PokemonTests.cpp @@ -161,7 +161,7 @@ TEST_CASE("Validate Pokemon HeldItem in Script") { .WithGender(CreatureLib::Library::Gender::Male) .Build(); data.Context->SetArgObject(0, const_cast(mon)); - data.Context->SetArgObject(1, (void*)mon->GetHeldItem().GetRaw()); + data.Context->SetArgObject(1, (void*)mon->GetHeldItem().GetValue()); REQUIRE(data.Context->Execute() == asEXECUTION_FINISHED); REQUIRE((bool)data.Context->GetReturnWord());