Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6239 in orxonox.OLD for branches/network/src/util


Ignore:
Timestamp:
Dec 21, 2005, 3:29:38 PM (19 years ago)
Author:
patrick
Message:

network: singleton fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/util/loading/factory.cc

    r5984 r6239  
    127127}
    128128
     129BaseObject* Factory::fabricate(ClassID classID)
     130{
     131  if (Factory::factoryList == NULL)
     132    return NULL;
     133
     134  std::list<Factory*>::const_iterator factory;
     135  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
     136    if (*(*factory) == classID)
     137      break;
     138
     139  if (factory != Factory::factoryList->end())
     140  {
     141    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
     142    return (*factory)->fabricateObject(NULL);
     143  }
     144  else
     145  {
     146    PRINTF(2)("Could not Fabricate an Object of ClassID '%h'\n", classID);
     147    return NULL;
     148  }
     149}
     150
    129151
    130152/**
     
    160182 * @returns a new Object of Type classID on match, NULL otherwise
    161183 */
    162 BaseObject* Factory::fabricate(ClassID classID)
    163 {
    164   if (Factory::factoryList == NULL)
    165     return NULL;
    166184
    167   std::list<Factory*>::const_iterator factory;
    168   for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
    169     if (*(*factory) == classID)
    170       break;
    171 
    172   if (factory != Factory::factoryList->end())
    173   {
    174     PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
    175     return (*factory)->fabricateObject(NULL);
    176   }
    177   else
    178   {
    179     PRINTF(2)("Could not Fabricate an Object of ClassID '%h'\n", classID);
    180     return NULL;
    181   }
    182 }
Note: See TracChangeset for help on using the changeset viewer.