Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/script_engine/script_manager.cc

    r9003 r9869  
    2424#include "lunar.h"
    2525
    26 #include "class_list.h"
    27 
    2826#include "script.h"
    2927#include "script_trigger.h"
    3028#include "luaincl.h"
    31 #include "loading/load_param.h"
    32 #include "parser/tinyxml/tinyxml.h"
     29#include "loading/load_param_xml.h"
    3330
    3431
     
    3734{
    3835  this->setName("ScriptManager");
    39   this->scripts = NULL;
    40   this->triggers = NULL;
    4136
    4237  if (root != NULL)
     
    6257
    6358  // fill the scripts and triggers (doing that on runtime is very slow!)
    64   getTriggers();
    65   getScripts();
    6659}
    6760
     
    7164{
    7265  //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();
    7668  //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
    8172}
    8273
     
    10596Script* ScriptManager::getScriptByFile(const std::string& file)
    10697{
    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);
    115103
    116104  return NULL;
    117105
    118106}
    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.