Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4739 in orxonox.OLD for orxonox/trunk/src/util/loading/factory.cc


Ignore:
Timestamp:
Jun 30, 2005, 4:05:23 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: factory is now registered in Factory, not in Gameloader

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/loading/factory.cc

    r4730 r4739  
    3535  this->setName(factoryName);
    3636
    37   if (Factory::first == NULL)
    38     Factory::first = this;
    39   next = NULL;
     37  this->next = NULL;
    4038
    41   initialize();
     39  Factory::registerFactory(this);
    4240}
    4341
     42/** a reference to the First Factory */
    4443Factory* Factory::first = NULL;
    4544
     
    5958
    6059/**
    61    \brief make this particular factory known to the LevelFactory
    62 */
    63 void Factory::initialize()
    64 {
    65   GameLoader::getInstance()->registerFactory( this);
    66 }
    67 
    68 /**
    69    \brief add a Factory to the Q
     60   \brief add a Factory to the Factory Queue
     61   \param factory a Factory to be registered
    7062*/
    7163void Factory::registerFactory( Factory* factory)
    7264{
    73   if( next == NULL) setNext( factory);
    74   else next->registerFactory( factory);
     65  assert( factory != NULL);
     66
     67  PRINTF(4)("Registered factory for '%s'\n", factory->getName());
     68
     69  if( Factory::first == NULL)
     70    Factory::first = factory;
     71  else
     72  {
     73    Factory* tmpFac = Factory::first;
     74    while( tmpFac->next != NULL)
     75    {
     76      tmpFac = tmpFac->next;
     77    }
     78    tmpFac->setNext(factory);
     79  }
    7580}
    76 
Note: See TracChangeset for help on using the changeset viewer.