forked from teamnwah/openmw-tes3coop
added secondary saved game header record
parent
1c7a4d4b3a
commit
dc75627d53
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
#include "savedgame.hpp"
|
||||||
|
|
||||||
|
#include "esmreader.hpp"
|
||||||
|
#include "esmwriter.hpp"
|
||||||
|
#include "defs.hpp"
|
||||||
|
|
||||||
|
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE;
|
||||||
|
|
||||||
|
void ESM::SavedGame::load (ESMReader &esm)
|
||||||
|
{
|
||||||
|
mPlayerName = esm.getHNString("PNAM");
|
||||||
|
esm.getHNOT (mPlayerLevel, "PLEV");
|
||||||
|
mPlayerClass = esm.getHNString("PCLA");
|
||||||
|
mPlayerCell = esm.getHNString("PCEL");
|
||||||
|
esm.getHNT (mInGameTime, "TSTM", 16);
|
||||||
|
esm.getHNT (mTimePlayed, "TIME");
|
||||||
|
|
||||||
|
while (esm.isNextSub ("DEPE"))
|
||||||
|
mContentFiles.push_back (esm.getHString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ESM::SavedGame::save (ESMWriter &esm) const
|
||||||
|
{
|
||||||
|
esm.writeHNCString (mPlayerName, "PNAM");
|
||||||
|
esm.writeHNT ("PLEV", mPlayerLevel);
|
||||||
|
esm.writeHNCString (mPlayerClass, "PCLA");
|
||||||
|
esm.writeHNCString (mPlayerCell, "PCEL");
|
||||||
|
esm.writeHNT ("TSTM", mInGameTime, 16);
|
||||||
|
esm.writeHNT ("TIME", mTimePlayed);
|
||||||
|
|
||||||
|
for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
|
||||||
|
iter!=mContentFiles.end(); ++iter)
|
||||||
|
esm.writeHNCString (*iter, "DEPE");
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef OPENMW_ESM_SAVEDGAME_H
|
||||||
|
#define OPENMW_ESM_SAVEDGAME_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace ESM
|
||||||
|
{
|
||||||
|
class ESMReader;
|
||||||
|
class ESMWriter;
|
||||||
|
|
||||||
|
// format 0, saved games only
|
||||||
|
|
||||||
|
struct SavedGame
|
||||||
|
{
|
||||||
|
static unsigned int sRecordId;
|
||||||
|
|
||||||
|
struct TimeStamp
|
||||||
|
{
|
||||||
|
float mGameHour;
|
||||||
|
int mDay;
|
||||||
|
int mMonth;
|
||||||
|
int mYear;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::string> mContentFiles;
|
||||||
|
std::string mPlayerName;
|
||||||
|
int mPlayerLevel;
|
||||||
|
std::string mPlayerClass;
|
||||||
|
std::string mPlayerCell;
|
||||||
|
TimeStamp mInGameTime;
|
||||||
|
float mTimePlayed;
|
||||||
|
|
||||||
|
/// \todo add field for screenshot
|
||||||
|
|
||||||
|
void load (ESMReader &esm);
|
||||||
|
void save (ESMWriter &esm) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue