Changeset 8193 in orxonox.OLD for branches/script_engine/src/lib/script_engine/script_manager.cc
- Timestamp:
- Jun 7, 2006, 3:04:14 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/script_engine/script_manager.cc
r8178 r8193 31 31 } 32 32 33 const TiXmlElement* scripts = root->FirstChildElement("Scripts"); 34 35 if( scripts == NULL) 36 { 37 PRINTF(1)("ScriptManager is missing 'Scripts'\n"); 38 } 39 else 40 { 41 createScriptList(scripts); 42 } 43 44 33 34 LoadParamXML(root, "Scripts", this, ScriptManager, createScriptList); 45 35 } 46 36 … … 50 40 51 41 52 void ScriptManager::initScripts()53 {54 for(std::list<LuaScript>::iterator it = scriptList.begin(); it != scriptList.end(); it++ )55 {56 (*it).script.loadFile((*it).name);57 }58 }59 60 42 void ScriptManager::init() 61 43 { 62 currentWorld.assign("");63 44 64 45 } … … 67 48 void ScriptManager::createScriptList(const TiXmlElement* scripts) 68 49 { 50 51 LOAD_PARAM_START_CYCLE(scripts, object); 52 { 53 new Script(object); 54 } 55 LOAD_PARAM_END_CYCLE(object); 56 57 58 /* 69 59 const TiXmlElement* script = scripts->FirstChildElement(); 70 60 … … 94 84 script = script->NextSiblingElement("Script"); 95 85 96 } 86 }*/ 97 87 98 88 … … 103 93 { 104 94 105 for(std::list<LuaScript>::iterator it = scriptList.begin(); it != scriptList.end(); it++ )106 {107 if( (*it).name.compare(file) == 0)108 {109 return &((*it).script);110 }111 }112 return NULL;95 // for(std::list<LuaScript>::iterator it = scriptList.begin(); it != scriptList.end(); it++ ) 96 // { 97 // if( (*it).name.compare(file) == 0) 98 // { 99 // return &((*it).script); 100 // } 101 // } 102 // return NULL; 113 103 114 104 } 115 105 116 void ScriptManager::setCurrentScriptFile(const std::string& file)117 {118 if( !fileIsInScriptList(file) )119 currentScript.name = file;120 else121 currentScript.name.assign("");122 }123 124 void ScriptManager::addObjectToScript(const std::string object)125 {126 if(!objectIsInObjectList(object,currentScript))127 currentScript.objectList.push_back(object);128 }129 130 131 bool ScriptManager::fileIsInScriptList(const std::string& file)132 {133 for(std::list<LuaScript>::const_iterator it = scriptList.begin(); it != scriptList.end(); it++ )134 {135 if( (*it).name.compare(file) == 0)136 {137 return true;138 }139 }140 return false;141 }142 143 144 bool ScriptManager::objectIsInObjectList(const std::string& object, const LuaScript& script)145 {146 for(std::list<std::string>::const_iterator it = script.objectList.begin(); it != script.objectList.end(); it++ )147 {148 if( (*it).compare(object) == 0)149 {150 return true;151 }152 }153 return false;154 }155 156
Note: See TracChangeset
for help on using the changeset viewer.