2012-09-23 18:11:08 +00:00
|
|
|
#ifndef OPENMW_ESM_ATTR_H
|
|
|
|
#define OPENMW_ESM_ATTR_H
|
2010-09-24 13:28:14 +00:00
|
|
|
|
|
|
|
#include <string>
|
2023-08-03 18:21:44 +00:00
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
#include "defs.hpp"
|
|
|
|
#include "refid.hpp"
|
2010-09-24 13:28:14 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2023-08-03 18:21:44 +00:00
|
|
|
class ESMReader;
|
|
|
|
class ESMWriter;
|
2010-09-24 13:28:14 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
/*
|
|
|
|
* Attribute definitions
|
|
|
|
*/
|
2010-09-24 13:28:14 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
struct Attribute
|
2010-09-24 13:28:14 +00:00
|
|
|
{
|
2023-08-03 18:21:44 +00:00
|
|
|
constexpr static RecNameInts sRecordId = REC_ATTR;
|
|
|
|
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
|
|
|
static std::string_view getRecordType() { return "Attribute"; }
|
|
|
|
|
|
|
|
using AttributeID = StringRefId;
|
|
|
|
static const AttributeID Strength;
|
|
|
|
static const AttributeID Intelligence;
|
|
|
|
static const AttributeID Willpower;
|
|
|
|
static const AttributeID Agility;
|
|
|
|
static const AttributeID Speed;
|
|
|
|
static const AttributeID Endurance;
|
|
|
|
static const AttributeID Personality;
|
|
|
|
static const AttributeID Luck;
|
|
|
|
static constexpr int Length = 8;
|
2010-09-24 13:28:14 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
AttributeID mId;
|
2023-05-31 15:02:18 +00:00
|
|
|
std::string mName, mDescription, mIcon;
|
|
|
|
float mWerewolfValue{};
|
2010-09-24 13:28:14 +00:00
|
|
|
|
2023-08-03 18:21:44 +00:00
|
|
|
void load(ESMReader& esm, bool& isDeleted);
|
|
|
|
void save(ESMWriter& esm, bool isDeleted = false) const;
|
2023-05-20 15:49:32 +00:00
|
|
|
|
2023-08-03 18:21:44 +00:00
|
|
|
static RefId indexToRefId(int index);
|
|
|
|
static int refIdToIndex(RefId id);
|
2022-09-22 18:26:05 +00:00
|
|
|
};
|
2010-09-24 13:28:14 +00:00
|
|
|
}
|
|
|
|
#endif
|