OpenMW
components/esm/loadclas.hpp
Go to the documentation of this file.
00001 #ifndef OPENMW_ESM_CLAS_H
00002 #define OPENMW_ESM_CLAS_H
00003 
00004 #include <string>
00005 
00006 namespace ESM
00007 {
00008 
00009 class ESMReader;
00010 class ESMWriter;
00011 
00012 /*
00013  * Character class definitions
00014  */
00015 
00016 // These flags tells us which items should be auto-calculated for this
00017 // class
00018 struct Class
00019 {
00020     static unsigned int sRecordId;
00021 
00022     enum AutoCalc
00023     {
00024         Weapon = 0x00001,
00025         Armor = 0x00002,
00026         Clothing = 0x00004,
00027         Books = 0x00008,
00028         Ingredient = 0x00010,
00029         Lockpick = 0x00020,
00030         Probe = 0x00040,
00031         Lights = 0x00080,
00032         Apparatus = 0x00100,
00033         Repair = 0x00200,
00034         Misc = 0x00400,
00035         Spells = 0x00800,
00036         MagicItems = 0x01000,
00037         Potions = 0x02000,
00038         Training = 0x04000,
00039         Spellmaking = 0x08000,
00040         Enchanting = 0x10000,
00041         RepairItem = 0x20000
00042     };
00043 
00044     enum Specialization
00045     {
00046         Combat = 0,
00047         Magic = 1,
00048         Stealth = 2
00049     };
00050 
00051     static const Specialization sSpecializationIds[3];
00052     static const char *sGmstSpecializationIds[3];
00053 
00054     struct CLDTstruct
00055     {
00056         int mAttribute[2]; // Attributes that get class bonus
00057         int mSpecialization; // 0 = Combat, 1 = Magic, 2 = Stealth
00058         int mSkills[5][2]; // Minor and major skills.
00059         int mIsPlayable; // 0x0001 - Playable class
00060 
00061         // I have no idea how to autocalculate these items...
00062         int mCalc;
00063 
00064         int& getSkill (int index, bool major);
00066 
00067         int getSkill (int index, bool major) const;
00069     }; // 60 bytes
00070 
00071     std::string mId, mName, mDescription;
00072     CLDTstruct mData;
00073 
00074     void load(ESMReader &esm);
00075     void save(ESMWriter &esm) const;
00076 
00077     void blank();
00079 
00080 };
00081 }
00082 #endif