1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-02-01 19:48:27 +00:00
openmw/components/esm3/effectlist.hpp
Telvanni 4Life 3e586ed693 Changed IRDTstruct (alchemical ingredient magic effects) to use RefIds instead of int for effectId.
Changed various structs (ENAMstruct, EffectKey, SummonKey) to use RefId instead of strict StringRefId to account for null effects.
2026-01-08 07:33:38 -05:00

57 lines
1.4 KiB
C++

#ifndef OPENMW_ESM_EFFECTLIST_H
#define OPENMW_ESM_EFFECTLIST_H
#include <cstdint>
#include <vector>
#include <components/esm/refid.hpp>
namespace ESM
{
class ESMReader;
class ESMWriter;
/** Defines a spell effect. Shared between SPEL (Spells), ALCH
(Potions) and ENCH (Item enchantments) records
*/
struct ENAMstruct
{
// Magical effect, serialized to int16
ESM::RefId mEffectID;
// Which skills/attributes are affected (for restore/drain spells
// etc.)
signed char mSkill, mAttribute; // -1 if N/A
// Other spell parameters
int32_t mRange; // 0 - self, 1 - touch, 2 - target (RangeType enum)
int32_t mArea, mDuration, mMagnMin, mMagnMax;
};
struct IndexedENAMstruct
{
bool operator!=(const IndexedENAMstruct& rhs) const;
bool operator==(const IndexedENAMstruct& rhs) const { return !(this->operator!=(rhs)); }
ENAMstruct mData;
uint32_t mIndex;
};
/// EffectList, ENAM subrecord
struct EffectList
{
std::vector<IndexedENAMstruct> mList;
void populate(const std::vector<ENAMstruct>& effects);
void updateIndexes();
/// Load one effect, assumes subrecord name was already read
void add(ESMReader& esm);
/// Load all effects
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};
}
#endif