1 #ifndef GAME_SCRIPT_INTERPRETERCONTEXT_H
2 #define GAME_SCRIPT_INTERPRETERCONTEXT_H
4 #include <boost/shared_ptr.hpp>
8 #include "../mwworld/ptr.hpp"
9 #include "../mwworld/action.hpp"
18 struct MWInputManager;
40 bool activeOnly =
false,
bool doThrow=
true)
const;
55 const std::string& targetId =
"");
73 const std::vector<std::string>& buttons);
92 virtual std::vector<std::string>
getGlobals ()
const;
124 virtual void startScript (
const std::string&
name,
const std::string& targetId =
"");
128 virtual float getDistance (
const std::string&
name,
const std::string&
id =
"")
const;
136 virtual bool isDisabled (
const std::string&
id =
"")
const;
138 virtual void enable (
const std::string&
id =
"");
140 virtual void disable (
const std::string&
id =
"");
142 virtual int getMemberShort (
const std::string&
id,
const std::string&
name,
bool global)
const;
144 virtual int getMemberLong (
const std::string&
id,
const std::string&
name,
bool global)
const;
146 virtual float getMemberFloat (
const std::string&
id,
const std::string&
name,
bool global)
const;
148 virtual void setMemberShort (
const std::string&
id,
const std::string&
name,
int value,
bool global);
150 virtual void setMemberLong (
const std::string&
id,
const std::string&
name,
int value,
bool global);
152 virtual void setMemberFloat (
const std::string&
id,
const std::string&
name,
float value,
bool global);
virtual float getLocalFloat(int index) const
Definition: interpretercontext.cpp:166
void message(CodeContainer &code, Literals &literals, const std::string &message, int buttons)
Definition: generator.cpp:537
virtual int getMemberShort(const std::string &id, const std::string &name, bool global) const
Definition: interpretercontext.cpp:512
Definition: locals.hpp:16
MWWorld::Ptr getReference(bool required=true)
Reference, that the script is running from (can be empty)
Definition: interpretercontext.cpp:570
virtual std::string getPCName() const
Definition: interpretercontext.cpp:335
virtual std::string getPCRace() const
Definition: interpretercontext.cpp:342
virtual std::string getNPCRank() const
Definition: interpretercontext.cpp:318
virtual std::string getNPCName() const
Definition: interpretercontext.cpp:291
virtual std::vector< std::string > getGlobals() const
Definition: interpretercontext.cpp:247
virtual bool isDisabled(const std::string &id="") const
Definition: interpretercontext.cpp:494
virtual char getGlobalType(const std::string &name) const
Definition: interpretercontext.cpp:263
virtual float getGlobalFloat(const std::string &name) const
Definition: interpretercontext.cpp:227
virtual void enable(const std::string &id="")
Definition: interpretercontext.cpp:500
virtual bool isScriptRunning(const std::string &name) const
Definition: interpretercontext.cpp:427
MWWorld::Ptr mReference
Definition: interpretercontext.hpp:28
virtual void setGlobalFloat(const std::string &name, float value)
Definition: interpretercontext.cpp:242
virtual int getMemberLong(const std::string &id, const std::string &name, bool global) const
Definition: interpretercontext.cpp:522
virtual std::string getCurrentCellName() const
Definition: interpretercontext.cpp:422
virtual int getLocalLong(int index) const
Definition: interpretercontext.cpp:158
InterpreterContext(MWScript::Locals *locals, MWWorld::Ptr reference, const std::string &targetId="")
The ownership of locals is not transferred. 0-pointer allowed.
Definition: interpretercontext.cpp:139
virtual int getGlobalShort(const std::string &name) const
Definition: interpretercontext.cpp:216
virtual bool menuMode()
Definition: interpretercontext.cpp:211
virtual float getSecondsPassed() const
Definition: interpretercontext.cpp:489
virtual std::string getNPCClass() const
Definition: interpretercontext.cpp:304
int findLocalVariableIndex(const std::string &scriptId, const std::string &name, char type) const
Throws an exception if local variable can't be found.
Definition: interpretercontext.cpp:113
std::string mTargetId
Definition: interpretercontext.hpp:30
virtual float getMemberFloat(const std::string &id, const std::string &name, bool global) const
Definition: interpretercontext.cpp:532
virtual std::string getPCRank() const
Definition: interpretercontext.cpp:356
virtual std::string getPCNextRank() const
Definition: interpretercontext.cpp:385
Definition: context.hpp:9
virtual void setGlobalShort(const std::string &name, int value)
Definition: interpretercontext.cpp:232
virtual void messageBox(const std::string &message, const std::vector< std::string > &buttons)=0
virtual std::string getNPCFaction() const
Definition: interpretercontext.cpp:311
virtual float getDistance(const std::string &name, const std::string &id="") const
Definition: interpretercontext.cpp:442
virtual void startScript(const std::string &name, const std::string &targetId="")
Definition: interpretercontext.cpp:432
virtual void report(const std::string &message)
By default, do nothing.
Definition: interpretercontext.cpp:207
virtual std::string getActionBinding(const std::string &action) const
Definition: interpretercontext.cpp:269
Locals * mLocals
Definition: interpretercontext.hpp:27
virtual void messageBox(const std::string &message, const std::vector< std::string > &buttons)
Definition: interpretercontext.cpp:198
virtual int getPCBounty() const
Definition: interpretercontext.cpp:415
void updatePtr(const MWWorld::Ptr &base, const MWWorld::Ptr &updated)
Update the Ptr stored in mReference, if there is one stored there. Should be called after the referen...
Definition: interpretercontext.cpp:580
MWWorld::Ptr getReferenceImp(const std::string &id="", bool activeOnly=false, bool doThrow=true)
Definition: interpretercontext.cpp:32
virtual void setMemberFloat(const std::string &id, const std::string &name, float value, bool global)
Definition: interpretercontext.cpp:561
virtual void setLocalShort(int index, int value)
Definition: interpretercontext.cpp:174
virtual std::string getNPCRace() const
Definition: interpretercontext.cpp:297
virtual void setLocalFloat(int index, float value)
Definition: interpretercontext.cpp:190
virtual void setLocalLong(int index, int value)
Definition: interpretercontext.cpp:182
virtual void stopScript(const std::string &name)
Definition: interpretercontext.cpp:437
virtual int getLocalShort(int index) const
Definition: interpretercontext.cpp:150
virtual std::string getPCClass() const
Definition: interpretercontext.cpp:349
virtual std::string getTargetId() const
Definition: interpretercontext.cpp:575
virtual int getGlobalLong(const std::string &name) const
Definition: interpretercontext.cpp:221
virtual void setMemberShort(const std::string &id, const std::string &name, int value, bool global)
Definition: interpretercontext.cpp:542
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
Definition: interpretercontext.hpp:25
void executeActivation(MWWorld::Ptr ptr, MWWorld::Ptr actor)
Execute the activation action for this ptr. If ptr is mActivated, mark activation as handled...
Definition: interpretercontext.cpp:479
const Locals & getMemberLocals(std::string &id, bool global) const
id is changed to the respective script ID, if id wasn't a script ID before
Definition: interpretercontext.cpp:72
virtual void setGlobalLong(const std::string &name, int value)
Definition: interpretercontext.cpp:237
virtual void setMemberLong(const std::string &id, const std::string &name, int value, bool global)
Definition: interpretercontext.cpp:552
const char * name
Definition: crashcatcher.cpp:59
virtual void disable(const std::string &id="")
Definition: interpretercontext.cpp:506