diff --git a/src/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp b/src/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp index f3c5344..362ee44 100644 --- a/src/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp +++ b/src/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp @@ -53,24 +53,19 @@ void RegisterPokemonClass::RegisterLearnedAttack(asIScriptEngine* engine) { ENUM__SIZE_WRAPPER(Pkmn_GenderWrapper, PkmnLib::Battling::Pokemon, GetGender) - -static asITypeInfo* _uint8TypeInfo = nullptr; -static CScriptArray* GetTypes(const PkmnLib::Battling::Pokemon* obj) { - if (_uint8TypeInfo == nullptr){ - asIScriptContext* ctx = asGetActiveContext(); - if (!ctx) { - return nullptr; - } +CScriptArray* GetTypes(const PkmnLib::Battling::Pokemon* obj) { + asIScriptContext* ctx = asGetActiveContext(); + if (ctx) { asIScriptEngine* engine = ctx->GetEngine(); - _uint8TypeInfo = engine->GetTypeInfoByDecl("array"); + asITypeInfo* t = engine->GetTypeInfoByDecl("array"); + auto a = obj->GetTypes(); + CScriptArray* arr = CScriptArray::Create(t, a.size()); + for (size_t i = 0; i < a.size(); i++){ + arr->SetValue(i, &a[i]); + } + return arr; } - - auto a = obj->GetTypes(); - CScriptArray* arr = CScriptArray::Create(_uint8TypeInfo, a.size()); - for (size_t i = 0; i < a.size(); i++){ - arr->SetValue(i, &a[i]); - } - return arr; + return nullptr; } void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {