mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 17:49:55 +00:00
49d912e5b6
Nice side effects: - Subrecord name comparison now uses magic number instead of string (faster) - Improves the error message for unknown subrecords: will print the record in question instead of failing to read the next record with a strange error
60 lines
1,021 B
C++
60 lines
1,021 B
C++
#ifndef OPENMW_ESM_CONT_H
|
|
#define OPENMW_ESM_CONT_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "esmcommon.hpp"
|
|
|
|
namespace ESM
|
|
{
|
|
|
|
class ESMReader;
|
|
class ESMWriter;
|
|
|
|
/*
|
|
* Container definition
|
|
*/
|
|
|
|
struct ContItem
|
|
{
|
|
int mCount;
|
|
NAME32 mItem;
|
|
};
|
|
|
|
/// InventoryList, NPCO subrecord
|
|
struct InventoryList
|
|
{
|
|
std::vector<ContItem> mList;
|
|
|
|
/// Load one item, assumes subrecord name is already read
|
|
void add(ESMReader &esm);
|
|
|
|
void save(ESMWriter &esm) const;
|
|
};
|
|
|
|
struct Container
|
|
{
|
|
static unsigned int sRecordId;
|
|
|
|
enum Flags
|
|
{
|
|
Organic = 1, // Objects cannot be placed in this container
|
|
Respawn = 2, // Respawns after 4 months
|
|
Unknown = 8
|
|
};
|
|
|
|
std::string mId, mName, mModel, mScript;
|
|
|
|
float mWeight; // Not sure, might be max total weight allowed?
|
|
int mFlags;
|
|
InventoryList mInventory;
|
|
|
|
void load(ESMReader &esm);
|
|
void save(ESMWriter &esm) const;
|
|
|
|
void blank();
|
|
///< Set record to default state (does not touch the ID).
|
|
};
|
|
}
|
|
#endif
|