2010-07-04 10:43:34 +02:00
|
|
|
#ifndef GAME_SCRIPT_GLOBALSCRIPTS_H
|
|
|
|
#define GAME_SCRIPT_GLOBALSCRIPTS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
2013-12-15 16:16:50 +01:00
|
|
|
#include <libs/platform/stdint.h>
|
|
|
|
|
2010-07-04 10:43:34 +02:00
|
|
|
#include "locals.hpp"
|
|
|
|
|
2013-12-15 16:16:50 +01:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
class ESMWriter;
|
|
|
|
class ESMReader;
|
|
|
|
}
|
|
|
|
|
2013-12-12 13:15:38 +01:00
|
|
|
namespace MWWorld
|
2010-07-04 10:43:34 +02:00
|
|
|
{
|
|
|
|
struct ESMStore;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWScript
|
|
|
|
{
|
|
|
|
class GlobalScripts
|
|
|
|
{
|
2012-10-01 19:17:04 +04:00
|
|
|
const MWWorld::ESMStore& mStore;
|
2010-07-04 16:00:32 +02:00
|
|
|
std::map<std::string, std::pair<bool, Locals> > mScripts; // running, local variables
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2010-07-04 10:43:34 +02:00
|
|
|
public:
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2012-10-01 19:17:04 +04:00
|
|
|
GlobalScripts (const MWWorld::ESMStore& store);
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2010-07-04 10:43:34 +02:00
|
|
|
void addScript (const std::string& name);
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2010-07-04 16:00:32 +02:00
|
|
|
void removeScript (const std::string& name);
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2010-07-04 16:00:32 +02:00
|
|
|
bool isRunning (const std::string& name) const;
|
2012-04-23 15:27:03 +02:00
|
|
|
|
|
|
|
void run();
|
2010-07-04 16:00:32 +02:00
|
|
|
///< run all active global scripts
|
2013-12-12 13:15:38 +01:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
void addStartup();
|
|
|
|
///< Add startup script
|
2013-12-15 16:16:50 +01:00
|
|
|
|
|
|
|
int countSavedGameRecords() const;
|
|
|
|
|
|
|
|
void write (ESM::ESMWriter& writer) const;
|
|
|
|
|
|
|
|
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
|
|
|
///< Records for variables that do not exist are dropped silently.
|
|
|
|
///
|
|
|
|
/// \return Known type?
|
2010-07-04 10:43:34 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|