OpenMW
components/esm/loadweap.hpp
Go to the documentation of this file.
00001 #ifndef OPENMW_ESM_WEAP_H
00002 #define OPENMW_ESM_WEAP_H
00003 
00004 #include <string>
00005 
00006 namespace ESM
00007 {
00008 
00009 class ESMReader;
00010 class ESMWriter;
00011 
00012 /*
00013  * Weapon definition
00014  */
00015 
00016 struct Weapon
00017 {
00018     static unsigned int sRecordId;
00019 
00020     enum Type
00021     {
00022         ShortBladeOneHand = 0,
00023         LongBladeOneHand = 1,
00024         LongBladeTwoHand = 2,
00025         BluntOneHand = 3,
00026         BluntTwoClose = 4,
00027         BluntTwoWide = 5,
00028         SpearTwoWide = 6,
00029         AxeOneHand = 7,
00030         AxeTwoHand = 8,
00031         MarksmanBow = 9,
00032         MarksmanCrossbow = 10,
00033         MarksmanThrown = 11,
00034         Arrow = 12,
00035         Bolt = 13
00036     };
00037 
00038     enum Flags
00039     {
00040         Magical = 0x01,
00041         Silver = 0x02
00042     };
00043 
00044 #pragma pack(push)
00045 #pragma pack(1)
00046     struct WPDTstruct
00047     {
00048         float mWeight;
00049         int mValue;
00050         short mType;
00051         short mHealth;
00052         float mSpeed, mReach;
00053         short mEnchant; // Enchantment points. The real value is mEnchant/10.f
00054         unsigned char mChop[2], mSlash[2], mThrust[2]; // Min and max
00055         int mFlags;
00056     }; // 32 bytes
00057 #pragma pack(pop)
00058 
00059     WPDTstruct mData;
00060 
00061     std::string mId, mName, mModel, mIcon, mEnchant, mScript;
00062 
00063     void load(ESMReader &esm);
00064     void save(ESMWriter &esm) const;
00065 
00066     void blank();
00068 };
00069 }
00070 #endif