1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 19:21:04 +00:00
This commit is contained in:
lazydev 2013-02-28 02:43:03 +04:00
parent f717fe0254
commit b93eb84401
3 changed files with 33 additions and 16 deletions

View File

@ -37,14 +37,14 @@ public:
*************************************************************************/ *************************************************************************/
int getVer() const { return mCtx.header.version; } int getVer() const { return mCtx.header.version; }
float getFVer() { if(mCtx.header.version == VER_12) return 1.2; else return 1.3; } float getFVer() const { if(mCtx.header.version == VER_12) return 1.2; else return 1.3; }
int getSpecial() { return mSpf; } int getSpecial() const { return mSpf; }
int getType() { return mCtx.header.type; } int getType() const { return mCtx.header.type; }
const std::string getAuthor() { return mCtx.header.author.toString(); } const std::string getAuthor() const { return mCtx.header.author.toString(); }
const std::string getDesc() { return mCtx.header.desc.toString(); } const std::string getDesc() const { return mCtx.header.desc.toString(); }
const SaveData &getSaveData() const { return mSaveData; } const SaveData &getSaveData() const { return mSaveData; }
const MasterList &getMasters() { return mMasters; } const MasterList &getMasters() const { return mMasters; }
const NAME &retSubName() { return mCtx.subName; } const NAME &retSubName() const { return mCtx.subName; }
uint32_t getSubSize() const { return mCtx.leftSub; } uint32_t getSubSize() const { return mCtx.leftSub; }
/************************************************************************* /*************************************************************************
@ -85,7 +85,7 @@ public:
int mIdx; int mIdx;
void setIndex(const int index) {mIdx = index; mCtx.index = index;} void setIndex(const int index) {mIdx = index; mCtx.index = index;}
const int getIndex() {return mIdx;} const int getIndex() {return mIdx;}
void setGlobalReaderList(std::vector<ESMReader> *list) {mGlobalReaderList = list;} void setGlobalReaderList(std::vector<ESMReader> *list) {mGlobalReaderList = list;}
std::vector<ESMReader> *getGlobalReaderList() {return mGlobalReaderList;} std::vector<ESMReader> *getGlobalReaderList() {return mGlobalReaderList;}

View File

@ -7,13 +7,28 @@ namespace ESM
{ {
void Apparatus::load(ESMReader &esm) void Apparatus::load(ESMReader &esm)
{ {
mModel = esm.getHNString("MODL"); // we will not treat duplicated subrecords as errors here
mName = esm.getHNString("FNAM"); while (esm.hasMoreSubs())
esm.getHNT(mData, "AADT", 16); {
mScript = esm.getHNOString("SCRI"); esm.getSubName();
mIcon = esm.getHNString("ITEX"); NAME subName = esm.retSubName();
if (subName == "MODL")
mModel = esm.getHString();
else if (subName == "FNAM")
mName = esm.getHString();
else if (subName == "AADT")
esm.getHT(mData);
else if (subName == "SCRI")
mScript = esm.getHString();
else if (subName == "ITEX")
mIcon = esm.getHString();
else
esm.fail("wrong subrecord type " + subName.toString() + " for APPA record");
}
} }
void Apparatus::save(ESMWriter &esm)
void Apparatus::save(ESMWriter &esm) const
{ {
esm.writeHNCString("MODL", mModel); esm.writeHNCString("MODL", mModel);
esm.writeHNCString("FNAM", mName); esm.writeHNCString("FNAM", mName);

View File

@ -1,6 +1,7 @@
#ifndef OPENMW_ESM_APPA_H #ifndef OPENMW_ESM_APPA_H
#define OPENMW_ESM_APPA_H #define OPENMW_ESM_APPA_H
#include "esmcommon.hpp"
#include <string> #include <string>
namespace ESM namespace ESM
@ -13,8 +14,9 @@ class ESMWriter;
* Alchemist apparatus * Alchemist apparatus
*/ */
struct Apparatus class Apparatus
{ {
public:
enum AppaType enum AppaType
{ {
MortarPestle = 0, MortarPestle = 0,
@ -35,7 +37,7 @@ struct Apparatus
std::string mId, mModel, mIcon, mScript, mName; std::string mId, mModel, mIcon, mScript, mName;
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm); void save(ESMWriter &esm) const;
}; };
} }
#endif #endif