mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-16 20:16:34 +00:00
Use namespace for servicesoffered
This commit is contained in:
parent
b2746a7b4b
commit
2ab87f2d22
3 changed files with 20 additions and 10 deletions
|
@ -34,7 +34,7 @@ namespace MWLua
|
|||
services
|
||||
= MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(rec.mClass)->mData.mServices;
|
||||
}
|
||||
for (const auto& [flag, name] : ServiceNames)
|
||||
for (const auto& [flag, name] : MWLua::ServiceNames)
|
||||
{
|
||||
providedServices[name] = (services & flag) != 0;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace
|
|||
const sol::table services = rec["servicesOffered"];
|
||||
int flags = 0;
|
||||
|
||||
for (const auto& [mask, key] : ServiceNames)
|
||||
for (const auto& [mask, key] : MWLua::ServiceNames)
|
||||
{
|
||||
sol::object value = services[key];
|
||||
if (value != sol::nil && value.as<bool>())
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
#ifndef MWLUA_SERVICESOFFERED_HPP
|
||||
#define MWLUA_SERVICESOFFERED_HPP
|
||||
|
||||
#include <array>
|
||||
#include <components/esm3/loadnpc.hpp>
|
||||
#include <string_view>
|
||||
|
||||
inline constexpr std::array<std::pair<int, std::string_view>, 19> 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" }, { ESM::NPC::Books, "Books" }, { ESM::NPC::Ingredients, "Ingredients" },
|
||||
{ ESM::NPC::Picks, "Picks" }, { ESM::NPC::Probes, "Probes" }, { ESM::NPC::Lights, "Lights" },
|
||||
{ ESM::NPC::Apparatus, "Apparatus" }, { ESM::NPC::RepairItem, "RepairItem" }, { ESM::NPC::Misc, "Misc" },
|
||||
{ ESM::NPC::Potions, "Potions" }, { ESM::NPC::MagicItems, "MagicItems" } } };
|
||||
namespace MWLua
|
||||
{
|
||||
|
||||
inline constexpr std::array<std::pair<int, std::string_view>, 19> 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" }, { ESM::NPC::Books, "Books" }, { ESM::NPC::Ingredients, "Ingredients" },
|
||||
{ ESM::NPC::Picks, "Picks" }, { ESM::NPC::Probes, "Probes" }, { ESM::NPC::Lights, "Lights" },
|
||||
{ ESM::NPC::Apparatus, "Apparatus" }, { ESM::NPC::RepairItem, "RepairItem" }, { ESM::NPC::Misc, "Misc" },
|
||||
{ ESM::NPC::Potions, "Potions" }, { ESM::NPC::MagicItems, "MagicItems" } } };
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue