1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-24 13:09:43 +00:00
openmw/components/esm3/loadcont.hpp

65 lines
1.4 KiB
C++
Raw Normal View History

2012-09-23 18:11:08 +00:00
#ifndef OPENMW_ESM_CONT_H
#define OPENMW_ESM_CONT_H
2012-09-17 07:37:50 +00:00
#include <string>
#include <vector>
2022-06-04 14:07:59 +00:00
#include "components/esm/defs.hpp"
namespace ESM
{
2022-09-22 18:26:05 +00:00
class ESMReader;
class ESMWriter;
2012-09-30 20:51:54 +00:00
2022-09-22 18:26:05 +00:00
/*
* Container definition
*/
2022-09-22 18:26:05 +00:00
struct ContItem
{
int mCount{ 0 };
std::string mItem;
};
2022-09-22 18:26:05 +00:00
/// InventoryList, NPCO subrecord
struct InventoryList
{
std::vector<ContItem> mList;
2022-09-22 18:26:05 +00:00
/// Load one item, assumes subrecord name is already read
void add(ESMReader& esm);
2022-09-22 18:26:05 +00:00
void save(ESMWriter& esm) const;
};
2022-09-22 18:26:05 +00:00
struct Container
{
constexpr static RecNameInts sRecordId = REC_CONT;
2022-06-04 14:07:59 +00:00
2022-09-22 18:26:05 +00:00
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string_view getRecordType() { return "Container"; }
2022-09-22 18:26:05 +00:00
enum Flags
{
Organic = 1, // Objects cannot be placed in this container
Respawn = 2, // Respawns after 4 months
Unknown = 8
};
2022-09-22 18:26:05 +00:00
unsigned int mRecordFlags;
std::string mId, mName, mModel, mScript;
2022-09-22 18:26:05 +00:00
float mWeight; // Not sure, might be max total weight allowed?
int mFlags;
InventoryList mInventory;
2022-09-22 18:26:05 +00:00
void load(ESMReader& esm, bool& isDeleted);
void save(ESMWriter& esm, bool isDeleted = false) const;
2022-09-22 18:26:05 +00:00
void blank();
///< Set record to default state (does not touch the ID).
};
}
#endif