2010-02-25 18:01:24 +00:00
|
|
|
#ifndef _ESM_LEVLISTS_H
|
|
|
|
#define _ESM_LEVLISTS_H
|
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2012-04-08 09:51:52 +00:00
|
|
|
#include "record.hpp"
|
2010-02-25 18:01:24 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2010-02-25 18:01:24 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Leveled lists. Since these have identical layout, I only bothered
|
|
|
|
* to implement it once.
|
|
|
|
*
|
|
|
|
* We should later implement the ability to merge leveled lists from
|
|
|
|
* several files.
|
|
|
|
*/
|
|
|
|
|
2012-04-08 09:51:52 +00:00
|
|
|
struct LeveledListBase : public Record
|
2010-02-25 18:01:24 +00:00
|
|
|
{
|
2011-04-08 13:58:21 +00:00
|
|
|
enum Flags
|
2010-02-25 18:01:24 +00:00
|
|
|
{
|
2011-04-08 13:58:21 +00:00
|
|
|
AllLevels = 0x01, // Calculate from all levels <= player
|
|
|
|
// level, not just the closest below
|
|
|
|
// player.
|
|
|
|
Each = 0x02 // Select a new item each time this
|
|
|
|
// list is instantiated, instead of
|
|
|
|
// giving several identical items
|
|
|
|
}; // (used when a container has more
|
|
|
|
// than one instance of one leveled
|
|
|
|
// list.)
|
2012-09-17 07:37:50 +00:00
|
|
|
int mFlags;
|
|
|
|
unsigned char mChanceNone; // Chance that none are selected (0-255?)
|
2010-02-25 18:01:24 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
// Record name used to read references. Must be set before load() is
|
|
|
|
// called.
|
2012-09-17 07:37:50 +00:00
|
|
|
const char *mRecName;
|
2010-02-25 18:01:24 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
struct LevelItem
|
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
std::string mId;
|
|
|
|
short mLevel;
|
2011-04-08 13:58:21 +00:00
|
|
|
};
|
2010-02-25 18:01:24 +00:00
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
std::vector<LevelItem> mList;
|
2010-02-25 18:01:24 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
void load(ESMReader &esm);
|
2012-04-06 19:04:30 +00:00
|
|
|
void save(ESMWriter &esm);
|
2012-04-08 09:51:52 +00:00
|
|
|
|
|
|
|
int getName()
|
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
if (mRecName[0] == 'C')
|
2012-04-08 09:51:52 +00:00
|
|
|
return REC_LEVC;
|
|
|
|
|
|
|
|
return REC_LEVI;
|
|
|
|
}
|
2010-02-25 18:01:24 +00:00
|
|
|
};
|
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
struct CreatureLevList: LeveledListBase
|
|
|
|
{
|
|
|
|
CreatureLevList()
|
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
mRecName = "CNAM";
|
2011-04-08 13:58:21 +00:00
|
|
|
}
|
|
|
|
};
|
2010-02-25 18:01:24 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
struct ItemLevList: LeveledListBase
|
|
|
|
{
|
|
|
|
ItemLevList()
|
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
mRecName = "INAM";
|
2011-04-08 13:58:21 +00:00
|
|
|
}
|
|
|
|
};
|
2010-02-25 18:01:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|