Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 14, 2005, 1:39:37 AM (18 years ago)
Author:
patrick
Message:

network: game server world loadin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/story_entities/network_world.cc

    r6093 r6095  
    341341  // find WorldEntities //
    342342  ////////////////////////
    343   element = root->FirstChildElement("WorldEntities");
    344   if( element == NULL)
     343  if( NetworkManager::getInstance()->isGameServer())
     344  {
     345    element = root->FirstChildElement("WorldEntities");
     346    if( element == NULL)
    345347    {
    346348      PRINTF(1)("NetworkWorld is missing 'WorldEntities'\n");
    347349    }
    348   else
     350    else
    349351    {
    350352      element = element->FirstChildElement();
     
    352354      PRINTF(4)("Loading NetworkWorldEntities\n");
    353355      while( element != NULL)
     356      {
     357        BaseObject* created = Factory::fabricate(element);
     358        if( created != NULL )
    354359        {
    355           BaseObject* created = Factory::fabricate(element);
    356           if( created != NULL )
    357           {
    358             if(created->isA(CL_WORLD_ENTITY))
    359               this->spawn(dynamic_cast<WorldEntity*>(created));
    360             printf("Created a %s: %s\n", created->getClassName(), created->getName());
    361           }
     360          if(created->isA(CL_WORLD_ENTITY))
     361            this->spawn(dynamic_cast<WorldEntity*>(created));
     362          printf("Created a %s: %s\n", created->getClassName(), created->getName());
     363        }
    362364
    363365          // if we load a 'Player' we use it as localPlayer
     
    365367
    366368          //todo do this more elegant
    367           if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
    368             sky = dynamic_cast<SkyBox*>(created);
    369           if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    370           {
    371             terrain = dynamic_cast<Terrain*>(created);
    372             CDEngine::getInstance()->setTerrain(terrain);
    373           }
    374           element = element->NextSiblingElement();
    375           glmis->step(); //! @todo temporary
     369        if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
     370          sky = dynamic_cast<SkyBox*>(created);
     371        if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
     372        {
     373          terrain = dynamic_cast<Terrain*>(created);
     374          CDEngine::getInstance()->setTerrain(terrain);
    376375        }
     376        element = element->NextSiblingElement();
     377        glmis->step(); //! @todo temporary
     378      }
    377379      PRINTF(4)("Done loading NetworkWorldEntities\n");
    378380    }
     381  }
    379382
    380383    //////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.