Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 12:13:42 PM (9 years ago)
Author:
landauf
Message:

merged branch multiplayerFS15

Location:
code/branches/presentationFS15merge
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS15merge

  • code/branches/presentationFS15merge/src/libraries/network/WANDiscoverable.cc

    r9667 r10612  
    4444    /* debugging output */
    4545    orxout(verbose, context::master_server) << "Creating WANDiscoverable." << endl;
    46  
     46
    4747    /* register object in orxonox */
    4848    RegisterObject(WANDiscoverable);
     
    5050    /* check for the masterserver address option in orxonox.ini */
    5151    this->setConfigValues();
    52    
     52
    5353  }
    5454
    5555  void WANDiscoverable::setConfigValues()
    5656  {
    57     /* update msaddress string from orxonox.ini config file, if it 
    58      * has changed. 
     57    /* update msaddress string from orxonox.ini config file, if it
     58     * has changed.
    5959     */
    60     SetConfigValueExternal(msaddress, "WANDiscovery", "msaddress", "orxonox.net");
    61 //     SetConfigValue( msaddress, "orxonox.net");
    62   } 
     60    SetConfigValueExternal(msaddress, "Discovery", "msaddress", "orxonox.net");
     61    SetConfigValueExternal(ownName, "Discovery", "ownName", "OrxServer");
     62  }
    6363
    6464  WANDiscoverable::~WANDiscoverable()
     
    6767      this->disconnect();
    6868  }
    69  
     69
    7070  void WANDiscoverable::setActivity(bool bActive)
    7171  {
    7272    if( bActive==this->bActive_ )
    7373      return;
    74    
     74
    7575    if( bActive )
    7676    {
     
    8484    }
    8585  }
    86  
     86
    8787  bool WANDiscoverable::connect()
    8888  {
     
    9393      return false;
    9494    }
    95    
     95
    9696    /* connect and see if it worked */
    9797    if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
    9898    {
    99       orxout(internal_error, context::master_server) << "Could not connect to master server at " 
     99      orxout(internal_error, context::master_server) << "Could not connect to master server at "
    100100                 << this->msaddress << endl;
    101101      return false;
    102102    }
    103                  
     103
    104104    /* debugging output */
    105105    orxout(verbose, context::master_server) << "Initialization of WANDiscoverable complete." << endl;
    106    
    107    
     106
    108107    // Now register the server at the master server
    109108    this->msc.sendRequest( MSPROTO_GAME_SERVER " " MSPROTO_REGISTER_SERVER );
    110    
     109
     110    std::string request = MSPROTO_GAME_SERVER " " MSPROTO_SET_NAME " ";
     111    request += this->ownName;
     112    this->msc.sendRequest( request );
     113
    111114    return true;
    112115  }
     
    118121  }
    119122
     123  void WANDiscoverable::updateClientNumber(int clientNumber)
     124  {
     125    orxout(verbose, context::master_server) << "Sending new number of clients: " << clientNumber << endl;
     126    std::string request = MSPROTO_GAME_SERVER " " MSPROTO_SET_CLIENTS " ";
     127    request += Ogre::StringConverter::toString(clientNumber);
     128
     129    this->msc.sendRequest( request );
     130  }
    120131
    121132
    122  
     133
     134
    123135} // namespace orxonox
Note: See TracChangeset for help on using the changeset viewer.