Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2007, 9:56:47 PM (16 years ago)
Author:
scheusso
Message:

ip address with —ip=address

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/orxonox.cc

    r592 r599  
    226226    //TODO: give config file to Ogre
    227227    std::string mode;
    228     if(argc>=2)
    229       mode = std::string(argv[1]);
    230     else
    231       mode = "";
     228//     if(argc>=2)
     229//       mode = std::string(argv[1]);
     230//     else
     231//       mode = "";
    232232    ArgReader ar = ArgReader(argc, argv);
    233233    ar.checkArgument("mode", mode, false);
    234234    ar.checkArgument("data", this->dataPath_, false);
     235    ar.checkArgument("ip", serverIp_, false);
    235236    if(ar.errorHandling()) die();
    236237
     
    238239    {
    239240      serverInit(path);
    240       mode = SERVER;
     241      mode_ = SERVER;
    241242    }
    242243    else if(mode == std::string("client"))
    243244    {
    244245      clientInit(path);
    245       mode = CLIENT;
     246      mode_ = CLIENT;
    246247    }
    247248    else if(mode == std::string("presentation"))
    248249    {
    249250      serverInit(path);
    250       mode = PRESENTATION;
     251      mode_ = PRESENTATION;
    251252    }
    252253    else{
    253254      standaloneInit(path);
    254       mode = STANDALONE;
     255      mode_ = STANDALONE;
    255256    }
    256257  }
     
    267268    setupScene();
    268269    setupInputSystem();
     270    if(mode_!=CLIENT){ // remove this in future ---- presentation hack
     271    }
     272    else
     273      std::cout << "client here" << std::endl;
    269274    createFrameListener();
    270275    Factory::createClassHierarchy();
     
    273278      server_g->open();
    274279      break;
     280    case CLIENT:
     281      client_g->establishConnection();
     282      break;
    275283    case SERVER:
    276     case CLIENT:
    277284    case STANDALONE:
    278285    default:
     
    356363  void Orxonox::serverInit(std::string path)
    357364  {
     365    COUT(2) << "initialising server" << std::endl;
    358366    ogre_->setConfigPath(path);
    359367    ogre_->setup();
     
    366374  void Orxonox::clientInit(std::string path)
    367375  {
     376    COUT(2) << "initialising client" << std::endl;
    368377    ogre_->setConfigPath(path);
    369378    ogre_->setup();
    370     client_g = new network::Client(); // address here
     379    if(serverIp_.compare("")==0)
     380      client_g = new network::Client();
     381    else
     382      client_g = new network::Client(serverIp_, 55556);
    371383    if(!ogre_->load()) die(/* unable to load */);
    372384    ogre_->getRoot()->addFrameListener(new network::ClientFrameListener());
     
    523535    ogre_->getRoot()->addFrameListener(TimerFL);
    524536
    525     frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_);
     537    //if(mode_!=CLIENT) // just a hack ------- remove this in future
     538      frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_);
    526539    ogre_->getRoot()->addFrameListener(frameListener_);
    527540  }
     
    536549    ogre_->getRoot()->getAutoCreatedWindow()->getMetrics(width, height, depth, left, top);
    537550
    538     const OIS::MouseState &ms = mouse_->getMouseState();
    539     ms.width = width;
    540     ms.height = height;
    541 
     551    if(mode_!=CLIENT){
     552      const OIS::MouseState &ms = mouse_->getMouseState();
     553      ms.width = width;
     554      ms.height = height;
     555    }
    542556    ogre_->getRoot()->startRendering();
    543557  }
Note: See TracChangeset for help on using the changeset viewer.