OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MWScript::InterpreterContext Class Reference

#include <interpretercontext.hpp>

Inheritance diagram for MWScript::InterpreterContext:
Collaboration diagram for MWScript::InterpreterContext:

Public Member Functions

 InterpreterContext (MWScript::Locals *locals, MWWorld::Ptr reference, const std::string &targetId="")
 The ownership of locals is not transferred. 0-pointer allowed. More...
 
virtual int getLocalShort (int index) const
 
virtual int getLocalLong (int index) const
 
virtual float getLocalFloat (int index) const
 
virtual void setLocalShort (int index, int value)
 
virtual void setLocalLong (int index, int value)
 
virtual void setLocalFloat (int index, float value)
 
virtual void messageBox (const std::string &message, const std::vector< std::string > &buttons)
 
virtual void report (const std::string &message)
 By default, do nothing. More...
 
virtual bool menuMode ()
 
virtual int getGlobalShort (const std::string &name) const
 
virtual int getGlobalLong (const std::string &name) const
 
virtual float getGlobalFloat (const std::string &name) const
 
virtual void setGlobalShort (const std::string &name, int value)
 
virtual void setGlobalLong (const std::string &name, int value)
 
virtual void setGlobalFloat (const std::string &name, float value)
 
virtual std::vector< std::string > getGlobals () const
 
virtual char getGlobalType (const std::string &name) const
 
virtual std::string getActionBinding (const std::string &action) const
 
virtual std::string getNPCName () const
 
virtual std::string getNPCRace () const
 
virtual std::string getNPCClass () const
 
virtual std::string getNPCFaction () const
 
virtual std::string getNPCRank () const
 
virtual std::string getPCName () const
 
virtual std::string getPCRace () const
 
virtual std::string getPCClass () const
 
virtual std::string getPCRank () const
 
virtual std::string getPCNextRank () const
 
virtual int getPCBounty () const
 
virtual std::string getCurrentCellName () const
 
virtual bool isScriptRunning (const std::string &name) const
 
virtual void startScript (const std::string &name, const std::string &targetId="")
 
virtual void stopScript (const std::string &name)
 
virtual float getDistance (const std::string &name, const std::string &id="") const
 
void executeActivation (MWWorld::Ptr ptr, MWWorld::Ptr actor)
 Execute the activation action for this ptr. If ptr is mActivated, mark activation as handled. More...
 
virtual float getSecondsPassed () const
 
virtual bool isDisabled (const std::string &id="") const
 
virtual void enable (const std::string &id="")
 
virtual void disable (const std::string &id="")
 
virtual int getMemberShort (const std::string &id, const std::string &name, bool global) const
 
virtual int getMemberLong (const std::string &id, const std::string &name, bool global) const
 
virtual float getMemberFloat (const std::string &id, const std::string &name, bool global) const
 
virtual void setMemberShort (const std::string &id, const std::string &name, int value, bool global)
 
virtual void setMemberLong (const std::string &id, const std::string &name, int value, bool global)
 
virtual void setMemberFloat (const std::string &id, const std::string &name, float value, bool global)
 
MWWorld::Ptr getReference (bool required=true)
 Reference, that the script is running from (can be empty) More...
 
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 reference has been moved to a new cell. More...
 
virtual std::string getTargetId () const
 
- Public Member Functions inherited from Interpreter::Context
virtual ~Context ()
 
void messageBox (const std::string &message)
 

Private Member Functions

MWWorld::Ptr getReferenceImp (const std::string &id="", bool activeOnly=false, bool doThrow=true)
 
const MWWorld::Ptr getReferenceImp (const std::string &id="", bool activeOnly=false, bool doThrow=true) const
 
const LocalsgetMemberLocals (std::string &id, bool global) const
 id is changed to the respective script ID, if id wasn't a script ID before More...
 
LocalsgetMemberLocals (std::string &id, bool global)
 id is changed to the respective script ID, if id wasn't a script ID before More...
 
int findLocalVariableIndex (const std::string &scriptId, const std::string &name, char type) const
 Throws an exception if local variable can't be found. More...
 

Private Attributes

LocalsmLocals
 
MWWorld::Ptr mReference
 
std::string mTargetId
 

Constructor & Destructor Documentation

MWScript::InterpreterContext::InterpreterContext ( MWScript::Locals locals,
MWWorld::Ptr  reference,
const std::string &  targetId = "" 
)

The ownership of locals is not transferred. 0-pointer allowed.

Here is the call graph for this function:

Member Function Documentation

void MWScript::InterpreterContext::disable ( const std::string &  id = "")
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::enable ( const std::string &  id = "")
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::executeActivation ( MWWorld::Ptr  ptr,
MWWorld::Ptr  actor 
)

Execute the activation action for this ptr. If ptr is mActivated, mark activation as handled.

Here is the call graph for this function:

Here is the caller graph for this function:

int MWScript::InterpreterContext::findLocalVariableIndex ( const std::string &  scriptId,
const std::string &  name,
char  type 
) const
private

Throws an exception if local variable can't be found.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string MWScript::InterpreterContext::getActionBinding ( const std::string &  action) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getCurrentCellName ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

float MWScript::InterpreterContext::getDistance ( const std::string &  name,
const std::string &  id = "" 
) const
virtual
Note
if id is empty, assumes an implicit reference

Implements Interpreter::Context.

Here is the call graph for this function:

float MWScript::InterpreterContext::getGlobalFloat ( const std::string &  name) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

int MWScript::InterpreterContext::getGlobalLong ( const std::string &  name) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::vector< std::string > MWScript::InterpreterContext::getGlobals ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

int MWScript::InterpreterContext::getGlobalShort ( const std::string &  name) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

char MWScript::InterpreterContext::getGlobalType ( const std::string &  name) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

float MWScript::InterpreterContext::getLocalFloat ( int  index) const
virtual

Implements Interpreter::Context.

int MWScript::InterpreterContext::getLocalLong ( int  index) const
virtual

Implements Interpreter::Context.

int MWScript::InterpreterContext::getLocalShort ( int  index) const
virtual

Implements Interpreter::Context.

float MWScript::InterpreterContext::getMemberFloat ( const std::string &  id,
const std::string &  name,
bool  global 
) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

const Locals & MWScript::InterpreterContext::getMemberLocals ( std::string &  id,
bool  global 
) const
private

id is changed to the respective script ID, if id wasn't a script ID before

Here is the call graph for this function:

Here is the caller graph for this function:

Locals & MWScript::InterpreterContext::getMemberLocals ( std::string &  id,
bool  global 
)
private

id is changed to the respective script ID, if id wasn't a script ID before

Here is the call graph for this function:

int MWScript::InterpreterContext::getMemberLong ( const std::string &  id,
const std::string &  name,
bool  global 
) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

int MWScript::InterpreterContext::getMemberShort ( const std::string &  id,
const std::string &  name,
bool  global 
) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getNPCClass ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getNPCFaction ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getNPCName ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getNPCRace ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getNPCRank ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

int MWScript::InterpreterContext::getPCBounty ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getPCClass ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getPCName ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getPCNextRank ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getPCRace ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getPCRank ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

MWWorld::Ptr MWScript::InterpreterContext::getReference ( bool  required = true)

Reference, that the script is running from (can be empty)

Here is the call graph for this function:

Here is the caller graph for this function:

MWWorld::Ptr MWScript::InterpreterContext::getReferenceImp ( const std::string &  id = "",
bool  activeOnly = false,
bool  doThrow = true 
)
private

If id is empty, a reference the script is run from is returned or in case of a non-local script the reference derived from the target ID.

Here is the call graph for this function:

Here is the caller graph for this function:

const MWWorld::Ptr MWScript::InterpreterContext::getReferenceImp ( const std::string &  id = "",
bool  activeOnly = false,
bool  doThrow = true 
) const
private

If id is empty, a reference the script is run from is returned or in case of a non-local script the reference derived from the target ID.

Here is the call graph for this function:

float MWScript::InterpreterContext::getSecondsPassed ( ) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

std::string MWScript::InterpreterContext::getTargetId ( ) const
virtual

Implements Interpreter::Context.

bool MWScript::InterpreterContext::isDisabled ( const std::string &  id = "") const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

bool MWScript::InterpreterContext::isScriptRunning ( const std::string &  name) const
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

bool MWScript::InterpreterContext::menuMode ( )
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::messageBox ( const std::string &  message,
const std::vector< std::string > &  buttons 
)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWScript::InterpreterContext::report ( const std::string &  message)
virtual

By default, do nothing.

Implements Interpreter::Context.

Reimplemented in MWGui::ConsoleInterpreterContext.

void MWScript::InterpreterContext::setGlobalFloat ( const std::string &  name,
float  value 
)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::setGlobalLong ( const std::string &  name,
int  value 
)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::setGlobalShort ( const std::string &  name,
int  value 
)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::setLocalFloat ( int  index,
float  value 
)
virtual

Implements Interpreter::Context.

void MWScript::InterpreterContext::setLocalLong ( int  index,
int  value 
)
virtual

Implements Interpreter::Context.

void MWScript::InterpreterContext::setLocalShort ( int  index,
int  value 
)
virtual

Implements Interpreter::Context.

void MWScript::InterpreterContext::setMemberFloat ( const std::string &  id,
const std::string &  name,
float  value,
bool  global 
)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::setMemberLong ( const std::string &  id,
const std::string &  name,
int  value,
bool  global 
)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::setMemberShort ( const std::string &  id,
const std::string &  name,
int  value,
bool  global 
)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::startScript ( const std::string &  name,
const std::string &  targetId = "" 
)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::stopScript ( const std::string &  name)
virtual

Implements Interpreter::Context.

Here is the call graph for this function:

void MWScript::InterpreterContext::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 reference has been moved to a new cell.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Locals* MWScript::InterpreterContext::mLocals
private
MWWorld::Ptr MWScript::InterpreterContext::mReference
mutableprivate
std::string MWScript::InterpreterContext::mTargetId
private

The documentation for this class was generated from the following files: