OpenMW
components/esm/loadfact.hpp
Go to the documentation of this file.
00001 #ifndef OPENMW_ESM_FACT_H
00002 #define OPENMW_ESM_FACT_H
00003 
00004 #include <string>
00005 #include <vector>
00006 
00007 namespace ESM
00008 {
00009 
00010 class ESMReader;
00011 class ESMWriter;
00012 
00013 /*
00014  * Faction definitions
00015  */
00016 
00017 // Requirements for each rank
00018 struct RankData
00019 {
00020     int mAttribute1, mAttribute2; // Attribute level
00021 
00022     int mSkill1, mSkill2; // Skill level (faction skills given in
00023     // skillID below.) You need one skill at
00024     // level 'skill1' and two skills at level
00025     // 'skill2' to advance to this rank.
00026 
00027     int mFactReaction; // Reaction from faction members
00028 };
00029 
00030 struct Faction
00031 {
00032     static unsigned int sRecordId;
00033 
00034     std::string mId, mName;
00035 
00036     struct FADTstruct
00037     {
00038         // Which attributes we like
00039         int mAttribute[2];
00040 
00041         RankData mRankData[10];
00042 
00043         int mSkills[6]; // IDs of skills this faction require
00044         int mUnknown; // Always -1?
00045         int mIsHidden; // 1 - hidden from player
00046 
00047         int& getSkill (int index, bool ignored = false);
00049 
00050         int getSkill (int index, bool ignored = false) const;
00052     }; // 240 bytes
00053 
00054     FADTstruct mData;
00055 
00056     struct Reaction
00057     {
00058         std::string mFaction;
00059         int mReaction;
00060     };
00061 
00062     std::vector<Reaction> mReactions;
00063 
00064     // Name of faction ranks (may be empty for NPC factions)
00065     std::string mRanks[10];
00066 
00067     void load(ESMReader &esm);
00068     void save(ESMWriter &esm) const;
00069 
00070     void blank();
00072 };
00073 }
00074 #endif