diff --git a/apps/openmw/mwlua/types/actor.hpp b/apps/openmw/mwlua/types/actor.hpp index 9e009395da..3b90a6bfb0 100644 --- a/apps/openmw/mwlua/types/actor.hpp +++ b/apps/openmw/mwlua/types/actor.hpp @@ -17,9 +17,9 @@ namespace MWLua template void addActorServicesBindings(sol::usertype& record, const Context& context) { - record["servicesOffered"] = sol::readonly_property([](const T& rec) -> std::vector { - std::vector providedServices; - std::map serviceNames = { { ESM::NPC::Spells, "Spells" }, + record["servicesOffered"] = sol::readonly_property([](const T& rec) -> std::map { + std::map providedServices; + const static std::map serviceNames = { { ESM::NPC::Spells, "Spells" }, { ESM::NPC::Spellmaking, "Spellmaking" }, { ESM::NPC::Enchanting, "Enchanting" }, { ESM::NPC::Training, "Training" }, { ESM::NPC::Repair, "Repair" }, { ESM::NPC::AllItems, "Barter" }, { ESM::NPC::Weapon, "Weapon" }, { ESM::NPC::Armor, "Armor" }, { ESM::NPC::Clothing, "Clothing" }, @@ -41,12 +41,9 @@ namespace MWLua } for (const auto& [flag, name] : serviceNames) { - if (services & flag) - providedServices.push_back(name); + providedServices[name] = (services & flag) != 0; } - - if (!rec.getTransport().empty()) - providedServices.push_back("Travel"); + providedServices["Travel"] = !rec.getTransport().empty(); return providedServices; }); }