OpenMW
components/esm/loadskil.hpp
Go to the documentation of this file.
00001 #ifndef OPENMW_ESM_SKIL_H
00002 #define OPENMW_ESM_SKIL_H
00003 
00004 #include <string>
00005 
00006 #include <boost/array.hpp>
00007 
00008 #include "defs.hpp"
00009 
00010 namespace ESM {
00011 
00012 class ESMReader;
00013 class ESMWriter;
00014 
00015 /*
00016  * Skill information
00017  *
00018  */
00019 
00020 struct Skill
00021 {
00022     static unsigned int sRecordId;
00023 
00024     std::string mId;
00025 
00026   struct SKDTstruct
00027   {
00028     int mAttribute;     // see defs.hpp
00029     int mSpecialization;// 0 - Combat, 1 - Magic, 2 - Stealth
00030     float mUseValue[4]; // How much skill improves through use. Meaning
00031                // of each field depends on what skill this
00032                // is. We should document this better later.
00033   }; // Total size: 24 bytes
00034   SKDTstruct mData;
00035 
00036   // Skill index. Skils don't have an id ("NAME") like most records,
00037   // they only have a numerical index that matches one of the
00038   // hard-coded skills in the game.
00039   int mIndex;
00040 
00041   std::string mDescription;
00042 
00043     enum SkillEnum
00044     {
00045         Block = 0,
00046         Armorer = 1,
00047         MediumArmor = 2,
00048         HeavyArmor = 3,
00049         BluntWeapon = 4,
00050         LongBlade = 5,
00051         Axe = 6,
00052         Spear = 7,
00053         Athletics = 8,
00054         Enchant = 9,
00055         Destruction = 10,
00056         Alteration = 11,
00057         Illusion = 12,
00058         Conjuration = 13,
00059         Mysticism = 14,
00060         Restoration = 15,
00061         Alchemy = 16,
00062         Unarmored = 17,
00063         Security = 18,
00064         Sneak = 19,
00065         Acrobatics = 20,
00066         LightArmor = 21,
00067         ShortBlade = 22,
00068         Marksman = 23,
00069         Mercantile = 24,
00070         Speechcraft = 25,
00071         HandToHand = 26,
00072         Length
00073     };
00074   static const std::string sSkillNames[Length];
00075   static const std::string sSkillNameIds[Length];
00076   static const std::string sIconNames[Length];
00077   static const boost::array<SkillEnum, Length> sSkillIds;
00078 
00079   void load(ESMReader &esm);
00080   void save(ESMWriter &esm) const;
00081 
00082     void blank();
00084 
00085     static std::string indexToId (int index);
00086 };
00087 }
00088 #endif