Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

network: singleton fix

Location:
branches/network/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_manager.cc

    r6238 r6239  
    3535
    3636
    37 
    38 
     37NetworkManager* NetworkManager::singletonRef = NULL;
    3938
    4039/**
  • branches/network/src/story_entities/network_world.cc

    r6238 r6239  
    338338  // find WorldEntities //
    339339  ////////////////////////
    340   if( NetworkManager::getInstance()->isGameServer())
    341   {}
    342 
    343340  element = root->FirstChildElement("WorldEntities");
    344341  if( element == NULL)
     
    356353          || !strcmp( element->Value(), "SpaceShip"))
    357354      {
     355
    358356        BaseObject* created = Factory::fabricate(element);
    359357        if( created != NULL )
  • 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.