OpenMW
|
00001 #ifndef INTERPRETER_SPATIALOPCODES_H_INCLUDED 00002 #define INTERPRETER_SPATIALOPCODES_H_INCLUDED 00003 00004 #include "opcodes.hpp" 00005 #include "runtime.hpp" 00006 00007 namespace Interpreter 00008 { 00009 class OpGetDistance : public Opcode0 00010 { 00011 public: 00012 00013 virtual void execute (Runtime& runtime) 00014 { 00015 std::string name = runtime.getStringLiteral (runtime[0].mInteger); 00016 00017 Type_Float distance = runtime.getContext().getDistance (name); 00018 00019 runtime[0].mFloat = distance; 00020 } 00021 }; 00022 00023 class OpGetDistanceExplicit : public Opcode0 00024 { 00025 public: 00026 00027 virtual void execute (Runtime& runtime) 00028 { 00029 int index = runtime[0].mInteger; 00030 runtime.pop(); 00031 std::string id = runtime.getStringLiteral (index); 00032 00033 std::string name = runtime.getStringLiteral (runtime[0].mInteger); 00034 00035 Type_Float distance = runtime.getContext().getDistance (name, id); 00036 00037 runtime[0].mFloat = distance; 00038 } 00039 }; 00040 } 00041 00042 #endif 00043