Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/script_engine/src/lib/script_engine/script_manager.cc @ 8193

Last change on this file since 8193 was 8193, checked in by snellen, 18 years ago

script_engine: swapping to integrate into the ORXONOX framework

File size: 2.0 KB
Line 
1#include <string>
2#include <list>
3
4#include "script.h"
5#include "script_manager.h"
6#include "lunar.h"
7
8
9ScriptManager::ScriptManager()
10{
11  this->init();
12}
13
14ScriptManager::~ScriptManager()
15{
16
17
18}
19
20
21void ScriptManager::loadParams(const TiXmlElement* root)
22{
23  //BaseObject::loadParams(root);
24
25  const TiXmlElement* scripttrigger= root->FirstChildElement("ScriptTrigger");
26
27  while( scripttrigger != NULL)
28   {
29     //TODO: generate script trigger in factory and let them load their params.
30      scripttrigger = scripttrigger->NextSiblingElement("ScriptTrigger");
31   }
32
33   
34   LoadParamXML(root, "Scripts", this, ScriptManager, createScriptList);
35}
36
37void ScriptManager::tick(float timestep)
38{
39}
40
41
42void ScriptManager::init()
43{
44
45}
46
47
48void  ScriptManager::createScriptList(const TiXmlElement* scripts)
49{
50 
51  LOAD_PARAM_START_CYCLE(scripts, object);
52  {
53    new Script(object);
54  }
55  LOAD_PARAM_END_CYCLE(object);
56     
57     
58  /*
59  const TiXmlElement* script = scripts->FirstChildElement();
60
61  PRINTF(4)("Creating scriptlist\n");
62
63  while( script != NULL)
64  {
65    { // scope to make the LoadParam work
66    LoadParam(script, "file", this, ScriptManager, setCurrentScriptFile)
67        .describe("the fileName of the script, that should be loaded into this world")
68        .defaultValues("");
69    }
70
71    if(!currentScript.name.empty()) // if LoadParam didn't fail... fill the object list with the needed objects
72    {
73
74    LOAD_PARAM_START_CYCLE(script, object);
75    {
76     // LoadParam_CYCLE(object, "object", this, ScriptManager, addObjectToScript)
77       //   .describe("The name of an object that is needed by a script");
78    }
79    LOAD_PARAM_END_CYCLE(object);
80
81    scriptList.push_back(currentScript);
82    }
83
84    script = script->NextSiblingElement("Script");
85
86  }*/
87
88
89}
90
91
92Script* ScriptManager::getScriptByFile(std::string& file)
93{
94
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;
103
104}
105
Note: See TracBrowser for help on using the repository browser.