Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6240 in orxonox.OLD for branches/network


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

network: singleton fix

File:
1 edited

Legend:

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

    r6239 r6240  
    127127}
    128128
    129 BaseObject* 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 
    151129
    152130/**
     
    182160 * @returns a new Object of Type classID on match, NULL otherwise
    183161 */
     162BaseObject* Factory::fabricate(ClassID classID)
     163{
     164  if (Factory::factoryList == NULL)
     165    return NULL;
    184166
     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.