1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00
OpenMW/components/esm3/loadscpt.hpp

67 lines
1.6 KiB
C++
Raw Normal View History

2012-09-23 22:11:08 +04:00
#ifndef OPENMW_ESM_SCPT_H
#define OPENMW_ESM_SCPT_H
2012-09-17 11:37:50 +04:00
#include <string>
#include <vector>
2022-06-04 16:07:59 +02:00
#include "components/esm/defs.hpp"
#include "components/esm/esmcommon.hpp"
namespace ESM
{
2012-10-01 00:51:54 +04:00
class ESMReader;
class ESMWriter;
/*
* Script definitions
*/
class Script
{
public:
2022-06-04 16:07:59 +02:00
constexpr static unsigned int sRecordId = REC_SCPT;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string_view getRecordType() { return "Script"; }
struct SCHDstruct
{
/// Data from script-precompling in the editor.
/// \warning Do not use them. OpenCS currently does not precompile scripts.
2012-09-17 11:37:50 +04:00
int mNumShorts, mNumLongs, mNumFloats, mScriptDataSize, mStringTableSize;
};
struct SCHD
{
std::string mName;
Script::SCHDstruct mData;
};
unsigned int mRecordFlags;
std::string mId;
2012-09-17 11:37:50 +04:00
SCHDstruct mData;
/// Variable names generated by script-precompiling in the editor.
/// \warning Do not use this field. OpenCS currently does not precompile scripts.
std::vector<std::string> mVarNames;
/// Bytecode generated from script-precompiling in the editor.
/// \warning Do not use this field. OpenCS currently does not precompile scripts.
std::vector<unsigned char> mScriptData;
/// Script source code
std::string mScriptText;
void load(ESMReader &esm, bool &isDeleted);
void save(ESMWriter &esm, bool isDeleted = false) const;
2013-04-07 15:17:35 +02:00
void blank();
///< Set record to default state (does not touch the ID/index).
private:
void loadSCVR(ESMReader &esm);
};
}
#endif