2012-09-23 18:11:08 +00:00
|
|
|
#ifndef OPENMW_ESM_CONT_H
|
|
|
|
#define OPENMW_ESM_CONT_H
|
2010-02-21 16:55:12 +00:00
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2012-09-23 18:41:41 +00:00
|
|
|
#include "esmcommon.hpp"
|
2010-02-21 16:55:12 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2010-02-21 16:55:12 +00:00
|
|
|
|
2012-09-30 20:51:54 +00:00
|
|
|
class ESMReader;
|
|
|
|
class ESMWriter;
|
|
|
|
|
2010-02-21 16:55:12 +00:00
|
|
|
/*
|
|
|
|
* Container definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ContItem
|
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
int mCount;
|
|
|
|
NAME32 mItem;
|
2010-02-21 16:55:12 +00:00
|
|
|
};
|
|
|
|
|
2015-02-12 03:56:05 +00:00
|
|
|
/// InventoryList, NPCO subrecord
|
2010-02-21 16:55:12 +00:00
|
|
|
struct InventoryList
|
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
std::vector<ContItem> mList;
|
2010-02-21 16:55:12 +00:00
|
|
|
|
2015-02-10 22:16:25 +00:00
|
|
|
/// Load one item, assumes subrecord name is already read
|
|
|
|
void add(ESMReader &esm);
|
|
|
|
|
2013-09-16 10:32:35 +00:00
|
|
|
void save(ESMWriter &esm) const;
|
2010-02-21 16:55:12 +00:00
|
|
|
};
|
|
|
|
|
2012-09-30 19:34:53 +00:00
|
|
|
struct Container
|
2010-02-21 16:55:12 +00:00
|
|
|
{
|
2013-09-24 11:17:28 +00:00
|
|
|
static unsigned int sRecordId;
|
2015-06-14 00:31:00 +00:00
|
|
|
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
|
|
|
static std::string getRecordType() { return "Container"; }
|
2013-09-24 11:17:28 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
enum Flags
|
2010-02-21 16:55:12 +00:00
|
|
|
{
|
2011-04-08 13:58:21 +00:00
|
|
|
Organic = 1, // Objects cannot be placed in this container
|
|
|
|
Respawn = 2, // Respawns after 4 months
|
|
|
|
Unknown = 8
|
2010-02-21 16:55:12 +00:00
|
|
|
};
|
|
|
|
|
2012-10-07 17:24:47 +00:00
|
|
|
std::string mId, mName, mModel, mScript;
|
2010-02-21 16:55:12 +00:00
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
float mWeight; // Not sure, might be max total weight allowed?
|
|
|
|
int mFlags;
|
|
|
|
InventoryList mInventory;
|
2010-02-21 16:55:12 +00:00
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
void load(ESMReader &esm, bool &isDeleted);
|
|
|
|
void save(ESMWriter &esm, bool isDeleted = false) const;
|
2013-05-06 12:10:43 +00:00
|
|
|
|
|
|
|
void blank();
|
|
|
|
///< Set record to default state (does not touch the ID).
|
2010-02-21 16:55:12 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|