Adds caching for expensive type resolution.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include "AngelScriptScript.hpp"
|
||||
#include "AngelScriptTypeInfo.hpp"
|
||||
|
||||
class AngelscriptUserdata;
|
||||
|
||||
class AngelScriptResolver final : public PkmnLib::Battling::ScriptResolver {
|
||||
private:
|
||||
asIScriptEngine* _engine = nullptr;
|
||||
@@ -21,6 +23,7 @@ private:
|
||||
ContextPool* _contextPool = nullptr;
|
||||
CScriptBuilder _builder = {};
|
||||
std::string _sourceDirectory = {};
|
||||
AngelscriptUserdata* _userData;
|
||||
|
||||
ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>> _typeDatabase;
|
||||
ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*> _baseTypes;
|
||||
@@ -42,18 +45,8 @@ private:
|
||||
const ArbUt::StringView& effectName);
|
||||
|
||||
public:
|
||||
~AngelScriptResolver() override {
|
||||
for (const auto& ius : _itemUseScripts) {
|
||||
delete ius.second;
|
||||
}
|
||||
delete _contextPool;
|
||||
for (const auto& category : _typeDatabase) {
|
||||
for (const auto& type : category.second) {
|
||||
delete type.second;
|
||||
}
|
||||
}
|
||||
_engine->ShutDownAndRelease();
|
||||
}
|
||||
AngelScriptResolver();
|
||||
~AngelScriptResolver() override;
|
||||
|
||||
void Initialize(CreatureLib::Battling::BattleLibrary* library) override { Initialize(library, true); }
|
||||
void Initialize(CreatureLib::Battling::BattleLibrary* library, bool includeStandard);
|
||||
@@ -112,5 +105,7 @@ public:
|
||||
}
|
||||
|
||||
inline ContextPool* GetContextPool() const noexcept { return _contextPool; }
|
||||
|
||||
inline AngelscriptUserdata* GetUserdata() const noexcept { return _userData; }
|
||||
};
|
||||
#endif // PKMNLIB_ANGELSCRIPRESOLVER_HPP
|
||||
|
||||
Reference in New Issue
Block a user