1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00
OpenMW/components/esm/luascripts.hpp

48 lines
1.2 KiB
C++

#ifndef OPENMW_ESM_LUASCRIPTS_H
#define OPENMW_ESM_LUASCRIPTS_H
#include <vector>
#include <string>
namespace ESM
{
class ESMReader;
class ESMWriter;
// Storage structure for LuaUtil::ScriptsContainer. This is not a top-level record.
// Used either for global scripts or for local scripts on a specific object.
struct LuaTimer
{
double mTime;
bool mHours; // false - game seconds, true - game hours
std::string mCallbackName;
std::string mCallbackArgument; // Serialized Lua table. It is a binary data. Can contain '\0'.
};
struct LuaScript
{
std::string mScriptPath;
std::string mData; // Serialized Lua table. It is a binary data. Can contain '\0'.
std::vector<LuaTimer> mTimers;
};
struct LuaScripts
{
std::vector<LuaScript> mScripts;
void load (ESMReader &esm);
void save (ESMWriter &esm) const;
};
// Saves binary string `data` (can contain '\0') as record LUAD.
void saveLuaBinaryData(ESM::ESMWriter& esm, const std::string& data);
// Loads LUAD as binary string. If next subrecord is not LUAD, then returns an empty string.
std::string loadLuaBinaryData(ESM::ESMReader& esm);
}
#endif