Changeset 9003 in orxonox.OLD for trunk/src/lib/script_engine
- Timestamp:
- Jul 2, 2006, 1:36:13 PM (19 years ago)
- Location:
- trunk/src/lib/script_engine
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/script_engine/script.cc
r8783 r9003 24 24 25 25 #include "class_list.h" 26 // uncommet this when the std:string and the const bug is fixed 27 //CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT, 28 // addMethod("addObject", ExecutorLua2<Script,std::string,std::string>(&Script::addObject)) 29 // ): 26 30 27 31 Script::Script(const TiXmlElement* root) … … 73 77 bool Script::loadFile(const std::string& filename) 74 78 { 75 79 this->setName(filename); 76 80 std::string filedest(ResourceManager::getInstance()->getDataDir()); 77 81 filedest += "scripts/" + filename; … … 93 97 { 94 98 currentFile = filename; 99 //this->addThisScript(); 95 100 return true; 96 101 } … … 323 328 } 324 329 330 331 void Script::addThisScript() 332 { 333 BaseObject* scriptClass = ClassList::getObject("Script", CL_SCRIPT_CLASS); 334 if (scriptClass != NULL) 335 { 336 static_cast<ScriptClass*>(scriptClass)->registerClass(this); 337 static_cast<ScriptClass*>(scriptClass)->insertObject(this, this,"thisscript", false); 338 } 339 } 340 325 341 int Script::reportError(int error) 326 342 { -
trunk/src/lib/script_engine/script.h
r8711 r9003 31 31 void loadFileNoRet(const std::string& filename) { loadFile(filename); }; 32 32 bool loadFile(const std::string& filename); 33 void addObject( const std::string& className,const std::string& objectName);33 void addObject( const std::string& className,const std::string& objectName); 34 34 35 35 /// QUERRYING … … 61 61 62 62 private: 63 63 void addThisScript(); 64 64 int reportError(int error); //!< Get errormessage from the lua stack and print it. 65 65 bool registerStandartClasses(); //!< Register all the classes that the script might need -
trunk/src/lib/script_engine/script_class.h
r8408 r9003 34 34 virtual void registerClass(Script* script) = 0; 35 35 virtual int insertObject(Script* L, BaseObject* obj, bool gc=false) = 0; 36 virtual int insertObject(Script* L, BaseObject* obj, const std::string& name, bool gc=false) = 0; 36 37 37 38 const ScriptMethod* scriptMethods() const { return this->_scriptMethods; } … … 64 65 return Lunar<T>::insertObject(L, dynamic_cast<T*>(obj), obj->getName(), gc); 65 66 } 67 68 virtual int insertObject(Script* L, BaseObject* obj,const std::string& name, bool gc=false) 69 { 70 return Lunar<T>::insertObject(L, dynamic_cast<T*>(obj), name, gc); 71 } 66 72 }; 67 73 -
trunk/src/lib/script_engine/script_manager.cc
r8711 r9003 74 74 while(!scripts->empty()) 75 75 delete scripts->front(); 76 //Delete all triggers 77 if(this->getTriggers()) 78 while(!triggers->empty()) 79 delete triggers->front(); 80 76 81 } 77 82
Note: See TracChangeset
for help on using the changeset viewer.