From 208cd14cfe989c72d9a9e8a0fbf4311721e8bb20 Mon Sep 17 00:00:00 2001 From: Zackhasacat Date: Sun, 3 Sep 2023 11:26:10 -0500 Subject: [PATCH] Use lua table, getESMStore --- apps/openmw/mwlua/types/actor.hpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwlua/types/actor.hpp b/apps/openmw/mwlua/types/actor.hpp index 32a18931c0..409559475f 100644 --- a/apps/openmw/mwlua/types/actor.hpp +++ b/apps/openmw/mwlua/types/actor.hpp @@ -20,8 +20,9 @@ namespace MWLua template void addActorServicesBindings(sol::usertype& record, const Context& context) { - record["servicesOffered"] = sol::readonly_property([](const T& rec) -> std::map { - std::map providedServices; + record["servicesOffered"] = sol::readonly_property([context](const T& rec) -> sol::table { + sol::state_view& lua = context.mLua->sol(); + sol::table providedServices(lua, sol::create); constexpr std::array, 19> serviceNames = { { { ESM::NPC::Spells, "Spells" }, { ESM::NPC::Spellmaking, "Spellmaking" }, { ESM::NPC::Enchanting, "Enchanting" }, @@ -36,12 +37,8 @@ namespace MWLua if constexpr (std::is_same_v) { if (rec.mFlags & ESM::NPC::Autocalc) - services = MWBase::Environment::get() - .getWorld() - ->getStore() - .get() - .find(rec.mClass) - ->mData.mServices; + services + = MWBase::Environment::get().getESMStore()->get().find(rec.mClass)->mData.mServices; } for (const auto& [flag, name] : serviceNames) {