mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-06 19:01:21 +03:00
Implement saving/loading of corprus stats, remove redundant code
This commit is contained in:
parent
3722c7adc3
commit
96e7ff666d
5 changed files with 63 additions and 17 deletions
|
@ -27,6 +27,17 @@ namespace ESM
|
|||
mSpells[id] = random;
|
||||
}
|
||||
|
||||
while (esm.isNextSub("CORP"))
|
||||
{
|
||||
std::string id = esm.getHString();
|
||||
|
||||
CorprusStats stats;
|
||||
esm.getHNT(stats.mWorsenings, "WORS");
|
||||
esm.getHNT(stats.mNextWorsening, "TIME");
|
||||
|
||||
mCorprusSpells[id] = stats;
|
||||
}
|
||||
|
||||
while (esm.isNextSub("USED"))
|
||||
{
|
||||
std::string id = esm.getHString();
|
||||
|
@ -53,6 +64,15 @@ namespace ESM
|
|||
}
|
||||
}
|
||||
|
||||
for (std::map<std::string, CorprusStats>::const_iterator it = mCorprusSpells.begin(); it != mCorprusSpells.end(); ++it)
|
||||
{
|
||||
esm.writeHNString("CORP", it->first);
|
||||
|
||||
const CorprusStats & stats = it->second;
|
||||
esm.writeHNT("WORS", stats.mWorsenings);
|
||||
esm.writeHNT("TIME", stats.mNextWorsening);
|
||||
}
|
||||
|
||||
for (std::map<std::string, TimeStamp>::const_iterator it = mUsedPowers.begin(); it != mUsedPowers.end(); ++it)
|
||||
{
|
||||
esm.writeHNString("USED", it->first);
|
||||
|
|
|
@ -13,9 +13,17 @@ namespace ESM
|
|||
|
||||
struct SpellState
|
||||
{
|
||||
struct CorprusStats
|
||||
{
|
||||
int mWorsenings;
|
||||
TimeStamp mNextWorsening;
|
||||
};
|
||||
|
||||
typedef std::map<std::string, std::map<const int, float> > TContainer;
|
||||
TContainer mSpells;
|
||||
|
||||
std::map<std::string, CorprusStats> mCorprusSpells;
|
||||
|
||||
std::map<std::string, TimeStamp> mUsedPowers;
|
||||
|
||||
std::string mSelectedSpell;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue