Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4003 in orxonox.OLD for orxonox/branches/ll2trunktemp/src/factory.cc


Ignore:
Timestamp:
Apr 28, 2005, 2:25:08 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/ll2trunktemp: some small modifications, testing, why 2 instances of fabricate are deleted, and not just the first one

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/ll2trunktemp/src/factory.cc

    r3994 r4003  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    2321
    2422/*  --------------------------------------------------
    25 *                Factory
    26 *   --------------------------------------------------
    27 */
     23 *               Factory
     24 *   --------------------------------------------------
     25 */
    2826
    2927/**
     
    3432Factory::Factory ()
    3533{
    36         classname = "NULL";
    37         next = NULL;
     34  classname = "NULL";
     35  next = NULL;
     36 
     37  initialize();
    3838}
    3939
     
    4545Factory::~Factory ()
    4646{
    47   //if( next != NULL)   delete next;
     47  printf("%s\n", this->classname);
     48  Factory* tmpDel = this->next;
     49  this->next = NULL;
     50  //  if (tmpDel)
     51  //    delete tmpDel;
    4852}
    49 
    5053
    5154/**
     
    5457BaseObject* Factory::fabricate( TiXmlElement* data)
    5558{
    56         return NULL;
     59  return NULL;
    5760}
    5861
     
    6265void Factory::initialize()
    6366{
    64         assert( classname != NULL);
    65         GameLoader* gl = GameLoader::getInstance();
    66         gl->registerFactory( this);
     67  assert( classname != NULL);
     68  GameLoader* gl = GameLoader::getInstance();
     69  gl->registerFactory( this);
    6770}
    6871
     
    7275void Factory::registerFactory( Factory* factory)
    7376{
    74         if( next == NULL) setNext( factory);
    75         else next->registerFactory( factory);
     77  if( next == NULL) setNext( factory);
     78  else next->registerFactory( factory);
    7679}
    7780
    7881const char* grabParameter( TiXmlElement* root, const char* name)
    7982{
    80         TiXmlElement* element;
    81         TiXmlNode* node;
     83  TiXmlElement* element;
     84  TiXmlNode* node;
    8285       
    83         assert( root != NULL);
    84         assert( name != NULL);
     86  assert( root != NULL);
     87  assert( name != NULL);
    8588       
    86         element = root->FirstChildElement( name);
    87         if( element == NULL) return NULL;
     89  element = root->FirstChildElement( name);
     90  if( element == NULL) return NULL;
    8891       
    89         node = element->FirstChild();
    90         while( node != NULL)
    91         {
    92                 if( node->ToText()) return node->Value();
    93                 node = node->NextSibling();
    94         }
    95         return NULL;
     92  node = element->FirstChild();
     93  while( node != NULL)
     94    {
     95      if( node->ToText()) return node->Value();
     96      node = node->NextSibling();
     97    }
     98  return NULL;
    9699}
    97100
Note: See TracChangeset for help on using the changeset viewer.