OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
locals.hpp
Go to the documentation of this file.
1 #ifndef GAME_SCRIPT_LOCALS_H
2 #define GAME_SCRIPT_LOCALS_H
3 
4 #include <vector>
5 
7 
8 namespace ESM
9 {
10  class Script;
11  struct Locals;
12 }
13 
14 namespace MWScript
15 {
16  class Locals
17  {
19 
20  void ensure (const std::string& scriptName);
21 
22  public:
23  std::vector<Interpreter::Type_Short> mShorts;
24  std::vector<Interpreter::Type_Integer> mLongs;
25  std::vector<Interpreter::Type_Float> mFloats;
26 
27  Locals();
28 
32  bool isEmpty() const;
33 
35  bool configure (const ESM::Script& script);
36 
40  bool setVarByInt(const std::string& script, const std::string& var, int val);
41 
43  //
44  // \note If it can not be determined if the variable exists, the error will be
45  // ignored and false will be returned.
46  bool hasVar(const std::string& script, const std::string& var);
47 
52  int getIntVar (const std::string& script, const std::string& var);
53 
58  float getFloatVar (const std::string& script, const std::string& var);
59 
63  bool write (ESM::Locals& locals, const std::string& script) const;
64 
66  void read (const ESM::Locals& locals, const std::string& script);
67  };
68 }
69 
70 #endif
bool write(ESM::Locals &locals, const std::string &script) const
Definition: locals.cpp:151
Definition: locals.hpp:16
Definition: loadscpt.hpp:19
std::vector< Interpreter::Type_Integer > mLongs
Definition: locals.hpp:24
bool setVarByInt(const std::string &script, const std::string &var, int val)
Definition: locals.cpp:126
bool hasVar(const std::string &script, const std::string &var)
Definition: locals.cpp:57
bool isEmpty() const
Definition: locals.cpp:52
bool mInitialised
Definition: locals.hpp:18
int getIntVar(const std::string &script, const std::string &var)
Definition: locals.cpp:74
Locals()
Definition: locals.cpp:31
float getFloatVar(const std::string &script, const std::string &var)
Definition: locals.cpp:100
Storage structure for local variables (only used in saved games)
Definition: locals.hpp:18
std::vector< Interpreter::Type_Short > mShorts
Definition: locals.hpp:23
void read(const ESM::Locals &locals, const std::string &script)
Definition: locals.cpp:196
bool configure(const ESM::Script &script)
Definition: locals.cpp:33
std::vector< Interpreter::Type_Float > mFloats
Definition: locals.hpp:25
void ensure(const std::string &scriptName)
Definition: locals.cpp:20