1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 07:23:54 +00:00
openmw/components/esm/attr.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
647 B
C++
Raw Normal View History

#include "attr.hpp"
#include <components/misc/strings/algorithm.hpp>
2023-05-25 10:49:27 +00:00
#include <stdexcept>
using namespace ESM;
2013-08-09 12:14:58 +00:00
const std::string Attribute::sAttributeNames[Attribute::Length] = {
"Strength",
"Intelligence",
"Willpower",
"Agility",
"Speed",
"Endurance",
"Personality",
"Luck",
2013-08-09 12:14:58 +00:00
};
Attribute::AttributeID Attribute::stringToAttributeId(std::string_view attribute)
{
2023-05-27 19:54:13 +00:00
for (int id = 0; id < Attribute::Length; ++id)
2023-05-21 11:01:11 +00:00
if (Misc::StringUtils::ciEqual(sAttributeNames[id], attribute))
2023-05-27 19:54:13 +00:00
return Attribute::AttributeID(id);
throw std::logic_error("No such attribute: " + std::string(attribute));
}