- Timestamp:
- Jun 7, 2006, 8:29:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/script_engine/script_manager.cc
r8208 r8210 23 23 ScriptManager::~ScriptManager() 24 24 { 25 25 // delete all scripts since they are useless without the manager 26 if(getScripts()) 27 for(std::list<BaseObject*>::const_iterator it = scripts->begin(); it != scripts->end(); it++ ) 28 { 29 ClassList::removeFromClassList( (*it) ); 30 } 26 31 27 32 } … … 30 35 void ScriptManager::loadParams(const TiXmlElement* root) 31 36 { 37 this->reset(); 32 38 //BaseObject::loadParams(root); 33 39 { 34 LoadParamXML(root, "ScriptTriggers", this, ScriptManager, createTriggers); 35 40 LoadParamXML(root, "ScriptTriggers", this, ScriptManager, createTriggers); 41 36 42 LoadParamXML(root, "Scripts", this, ScriptManager, createScripts); 37 43 } // make shure that the loading process is finished 38 44 39 45 // fill the scripts and triggers (doing that on runtime is very slow!) 40 46 getTriggers(); 41 47 getScripts(); 42 43 48 49 44 50 } 45 51 46 52 void ScriptManager::reset() 47 53 { 48 //TODO: delete all scripts and triggers, empty lists. 54 //Delete all scripts as they aren't deleted automatically 55 if(getScripts()) 56 for(std::list<BaseObject*>::const_iterator it = scripts->begin(); it != scripts->end(); it++ ) 57 { 58 ClassList::removeFromClassList( (*it) ); 59 } 49 60 50 51 61 this->scripts = NULL; 62 this->triggers = NULL; 52 63 } 53 64 … … 56 67 //this->setClassID(""); 57 68 this->setName("ScriptManager"); 58 69 59 70 this->scripts = NULL; 60 71 this->triggers = NULL; … … 64 75 void ScriptManager::createScripts(const TiXmlElement* scripts) 65 76 { 66 77 67 78 LOAD_PARAM_START_CYCLE(scripts, object); 68 79 { … … 94 105 } 95 106 } 96 107 97 108 return NULL; 98 109 … … 102 113 bool ScriptManager::getScripts() 103 114 { 104 return (this->scripts != NULL || (this->scripts = ClassList::getList(CL_SCRIPT)) != NULL); 115 return (this->scripts != NULL || (this->scripts = ClassList::getList(CL_SCRIPT)) != NULL); 105 116 } 106 117 107 118 bool ScriptManager::getTriggers() 108 119 { 109 return (this->triggers != NULL || (this->triggers = ClassList::getList(CL_SCRIPT_TRIGGER)) != NULL); 120 return (this->triggers != NULL || (this->triggers = ClassList::getList(CL_SCRIPT_TRIGGER)) != NULL); 110 121 } 111 122
Note: See TracChangeset
for help on using the changeset viewer.