OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
globalscripts.hpp
Go to the documentation of this file.
1 #ifndef GAME_SCRIPT_GLOBALSCRIPTS_H
2 #define GAME_SCRIPT_GLOBALSCRIPTS_H
3 
4 #include <string>
5 #include <map>
6 
7 #include <stdint.h>
8 
9 #include "locals.hpp"
10 
11 namespace ESM
12 {
13  class ESMWriter;
14  class ESMReader;
15 }
16 
17 namespace Loading
18 {
19  class Listener;
20 }
21 
22 namespace MWWorld
23 {
24  class ESMStore;
25 }
26 
27 namespace MWScript
28 {
30  {
31  bool mRunning;
33  std::string mId; // ID used to start targeted script (empty if not a targeted script)
34 
36  };
37 
39  {
41  std::map<std::string, GlobalScriptDesc> mScripts;
42 
43  public:
44 
45  GlobalScripts (const MWWorld::ESMStore& store);
46 
47  void addScript (const std::string& name, const std::string& targetId = "");
48 
49  void removeScript (const std::string& name);
50 
51  bool isRunning (const std::string& name) const;
52 
53  void run();
55 
56  void clear();
57 
58  void addStartup();
60 
61  int countSavedGameRecords() const;
62 
63  void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
64 
65  bool readRecord (ESM::ESMReader& reader, uint32_t type);
69 
70  Locals& getLocals (const std::string& name);
73  };
74 }
75 
76 #endif
Definition: locals.hpp:16
Definition: esmreader.hpp:21
Definition: globalscripts.hpp:38
void write(ESM::ESMWriter &writer, Loading::Listener &progress) const
Definition: globalscripts.cpp:128
GlobalScriptDesc()
Definition: globalscripts.cpp:19
Definition: loadinglistener.hpp:8
int countSavedGameRecords() const
Definition: globalscripts.cpp:123
Definition: esmwriter.hpp:17
Definition: esmstore.hpp:17
bool isRunning(const std::string &name) const
Definition: globalscripts.cpp:59
void addStartup()
Add startup script.
Definition: globalscripts.cpp:92
bool readRecord(ESM::ESMReader &reader, uint32_t type)
Definition: globalscripts.cpp:149
Definition: globalscripts.hpp:29
std::map< std::string, GlobalScriptDesc > mScripts
Definition: globalscripts.hpp:41
std::string mId
Definition: globalscripts.hpp:33
void run()
run all active global scripts
Definition: globalscripts.cpp:70
void addScript(const std::string &name, const std::string &targetId="")
Definition: globalscripts.cpp:26
void removeScript(const std::string &name)
Definition: globalscripts.cpp:50
Locals & getLocals(const std::string &name)
Definition: globalscripts.cpp:194
void clear()
Definition: globalscripts.cpp:87
GlobalScripts(const MWWorld::ESMStore &store)
Definition: globalscripts.cpp:22
bool mRunning
Definition: globalscripts.hpp:31
const MWWorld::ESMStore & mStore
Definition: globalscripts.hpp:40
Locals mLocals
Definition: globalscripts.hpp:32
const char * name
Definition: crashcatcher.cpp:59