summaryrefslogtreecommitdiff
path: root/components/esm3/loadalch.hpp
blob: ddecd7e3c774c410f658123637da123d15a25f7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef OPENMW_ESM_ALCH_H
#define OPENMW_ESM_ALCH_H

#include <cstdint>
#include <string>

#include "components/esm/defs.hpp"
#include "components/esm/refid.hpp"
#include "effectlist.hpp"

namespace ESM
{

    class ESMReader;
    class ESMWriter;

    /*
     * Alchemy item (potions)
     */

    struct Potion
    {
        constexpr static RecNameInts sRecordId = REC_ALCH;

        /// Return a string descriptor for this record type. Currently used for debugging / error logs only.
        static std::string_view getRecordType() { return "Potion"; }

        struct ALDTstruct
        {
            float mWeight;
            int32_t mValue;
            int32_t mAutoCalc;
        };
        ALDTstruct mData;

        uint32_t mRecordFlags;
        RefId mId, mScript;
        std::string mName, mModel, mIcon;
        EffectList mEffects;

        void load(ESMReader& esm, bool& isDeleted);
        void save(ESMWriter& esm, bool isDeleted = false) const;

        void blank();
        ///< Set record to default state (does not touch the ID).
    };
}
#endif