Changeset 9699 in orxonox.OLD for branches/new_class_id/src/lib/script_engine/script_manager.cc
- Timestamp:
- Aug 25, 2006, 12:03:59 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/script_engine/script_manager.cc
r9003 r9699 24 24 #include "lunar.h" 25 25 26 #include "class_list.h"27 28 26 #include "script.h" 29 27 #include "script_trigger.h" … … 37 35 { 38 36 this->setName("ScriptManager"); 39 this->scripts = NULL;40 this->triggers = NULL;41 37 42 38 if (root != NULL) … … 62 58 63 59 // fill the scripts and triggers (doing that on runtime is very slow!) 64 getTriggers();65 getScripts();66 60 } 67 61 … … 71 65 { 72 66 //Delete all scripts as they aren't deleted automatically 73 if(this->getScripts()) 74 while(!scripts->empty()) 75 delete scripts->front(); 67 while(!Script::objectList().empty()) 68 delete Script::objectList().front(); 76 69 //Delete all triggers 77 if(this->getTriggers()) 78 while(!triggers->empty()) 79 delete triggers->front(); 80 70 while(!ScriptTrigger::objectList().empty()) 71 delete ScriptTrigger::objectList().front(); 72 81 73 } 82 74 … … 105 97 Script* ScriptManager::getScriptByFile(const std::string& file) 106 98 { 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 } 99 for (NewObjectList<Script>::const_iterator it = Script::objectList().begin(); 100 it != Script::objectList().end(); 101 ++it) 102 if( ((*it))->getFileName().compare(file) == 0) 103 return (*it); 115 104 116 105 return NULL; 117 106 118 107 } 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.