Changeset 9869 in orxonox.OLD for trunk/src/lib/script_engine/script_manager.cc
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/script_engine/script_manager.cc
r9003 r9869 24 24 #include "lunar.h" 25 25 26 #include "class_list.h"27 28 26 #include "script.h" 29 27 #include "script_trigger.h" 30 28 #include "luaincl.h" 31 #include "loading/load_param.h" 32 #include "parser/tinyxml/tinyxml.h" 29 #include "loading/load_param_xml.h" 33 30 34 31 … … 37 34 { 38 35 this->setName("ScriptManager"); 39 this->scripts = NULL;40 this->triggers = NULL;41 36 42 37 if (root != NULL) … … 62 57 63 58 // fill the scripts and triggers (doing that on runtime is very slow!) 64 getTriggers();65 getScripts();66 59 } 67 60 … … 71 64 { 72 65 //Delete all scripts as they aren't deleted automatically 73 if(this->getScripts()) 74 while(!scripts->empty()) 75 delete scripts->front(); 66 while(!Script::objectList().empty()) 67 delete Script::objectList().front(); 76 68 //Delete all triggers 77 if(this->getTriggers()) 78 while(!triggers->empty()) 79 delete triggers->front(); 80 69 while(!ScriptTrigger::objectList().empty()) 70 delete ScriptTrigger::objectList().front(); 71 81 72 } 82 73 … … 105 96 Script* ScriptManager::getScriptByFile(const std::string& file) 106 97 { 107 if(getScripts()) 108 for(std::list<BaseObject*>::const_iterator it = scripts->begin(); it != scripts->end(); it++ ) 109 { 110 if( (dynamic_cast<Script*>(*it))->getFileName().compare(file) == 0) 111 { 112 return dynamic_cast<Script*>(*it); 113 } 114 } 98 for (ObjectList<Script>::const_iterator it = Script::objectList().begin(); 99 it != Script::objectList().end(); 100 ++it) 101 if( ((*it))->getFileName().compare(file) == 0) 102 return (*it); 115 103 116 104 return NULL; 117 105 118 106 } 119 120 121 bool ScriptManager::getScripts()122 {123 return (this->scripts != NULL || (this->scripts = ClassList::getList(CL_SCRIPT)) != NULL);124 }125 126 bool ScriptManager::getTriggers()127 {128 return (this->triggers != NULL || (this->triggers = ClassList::getList(CL_SCRIPT_TRIGGER)) != NULL);129 }130 131 132
Note: See TracChangeset
for help on using the changeset viewer.