Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9452 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 25, 2006, 10:52:37 AM (18 years ago)
Author:
patrick
Message:

switched another interface funciton

Location:
branches/proxy/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/monitor/network_monitor.cc

    r9451 r9452  
    143143  if( pInfo->isClient())
    144144    this->localNode->addClient(pInfo);
    145   else if( pInfo->isProxyServer())
     145  else if( pInfo->isProxyServerActive())
    146146  {
    147147    this->localNode->addActiveProxyServer(pInfo);
     
    169169  if( pInfo->isClient())
    170170    node->addClient(pInfo);
    171   else if( pInfo->isProxyServer())
     171  else if( pInfo->isProxyServerActive())
    172172    node->addActiveProxyServer(pInfo);
    173173  else if( pInfo->isMasterServer())
  • branches/proxy/src/lib/network/network_game_manager.cc

    r9406 r9452  
    9191bool NetworkGameManager::signalNewPlayer( int userId )
    9292{
    93   assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer());
     93  assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive());
    9494  assert( State::getGameRules() );
    9595  assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
     
    168168bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    169169{
    170   if ( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer())
     170  if ( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive())
    171171  {
    172172    PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId);
     
    229229bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    230230{
    231   assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer());
     231  assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive());
    232232
    233233  int teamId = 0;
     
    261261void NetworkGameManager::prefereTeam( int teamId )
    262262{
    263   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     263  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    264264    setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId );
    265265  else
     
    305305{
    306306  PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() );
    307   if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) && userId !=  SharedNetworkData::getInstance()->getHostID() )
     307  if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) && userId !=  SharedNetworkData::getInstance()->getHostID() )
    308308  {
    309309    MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
     
    347347  assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE );
    348348
    349   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     349  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    350350    MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH );
    351351  else
  • branches/proxy/src/lib/network/network_manager.cc

    r9450 r9452  
    129129  NetworkSettings::getInstance()->loadData();
    130130
    131   // create the network stream
     131  // create the network stream af
    132132  this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE);
     133  // first connect to the master server for synchronization
     134  this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999);
     135  // start the handshake with the master server
     136  this->networkStream->startHandshake(NET_ID_MASTER_SERVER);
     137  // then start the server
    133138  this->networkStream->createServer( port);
    134   // and connect to the master server for synchronization
    135   this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999);
    136139  // and to the other proxy servers also, this would be very nice if its works
    137140
  • branches/proxy/src/lib/network/network_stream.cc

    r9450 r9452  
    7979    case NET_MASTER_SERVER:
    8080      // init the shared network data
    81       SharedNetworkData::getInstance()->setHostID(0);
     81      SharedNetworkData::getInstance()->setHostID(NET_ID_MASTER_SERVER);
    8282      break;
    8383
    8484    case NET_PROXY_SERVER_ACTIVE:
    8585      // init the shared network data
    86       SharedNetworkData::getInstance()->setHostID(0);
     86      SharedNetworkData::getInstance()->setHostID(NET_ID_PROXY_SERVER_01);
    8787      break;
    8888    case NET_PROXY_SERVER_PASSIVE:
    8989      // init the shared network data
    90       SharedNetworkData::getInstance()->setHostID(0);
     90      SharedNetworkData::getInstance()->setHostID(NET_ID_PROXY_SERVER_01);
    9191      break;
    9292    case NET_CLIENT:
     93      SharedNetworkData::getInstance()->setHostID(NET_ID_UNASSIGNED);
    9394      break;
    9495  }
     
    312313    this->updateConnectionList();
    313314  }
    314   else if( this->pInfo->isProxyServer())
     315  else if( this->pInfo->isProxyServerActive())
    315316  {
    316317    // execute everything the proxy server should do
     
    464465    PRINT(0)(" Host ist Master Server with ID: %i\n", this->pInfo->userId);
    465466  }
    466   else if( SharedNetworkData::getInstance()->isProxyServer()) {
     467  else if( SharedNetworkData::getInstance()->isProxyServerActive()) {
    467468    PRINT(0)(" Host ist Proxy Server with ID: %i\n", this->pInfo->userId);
    468469  }
     
    568569                }
    569570              }
    570               else if ( this->pInfo->isProxyServer() )
     571              else if ( this->pInfo->isProxyServerActive() )
    571572              {
    572573                it->second.nodeType = it->second.handshake->getRemoteNodeType();
     
    714715
    715716      // if we are a server (both master and proxy servers) and this is not our handshake
    716       if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
     717      if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
    717718        continue;
    718719
     
    728729
    729730      // server fakes uniqueid == 0 for handshake
    730       if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) &&
     731      if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) &&
    731732             sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it
    732733        n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
     
    780781    // now compress the data with the zip library
    781782    int compLength = 0;
    782     if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     783    if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    783784      compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer );
    784785    else
  • branches/proxy/src/lib/network/network_stream.h

    r9450 r9452  
    5757    inline bool isUserIdActive( int userID ) { return (peers.find(userID) != peers.end()); }
    5858    inline bool isUserMasterServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isMasterServer(); }
    59     inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServer(); }
     59    inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServerActive(); }
    6060    inline bool isUserClient( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isClient(); }
    6161
  • branches/proxy/src/lib/network/peer_info.h

    r9445 r9452  
    2323
    2424    inline bool isMasterServer() const { return this->nodeType == NET_MASTER_SERVER; }
    25     inline bool isProxyServer() const { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }
    26     inline bool isProxyServerPassive() const { return this->nodeType == NET_PROXY_SERVER_PASSIVE; }
     25    inline bool isProxyServerActive() const { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }
     26    inline bool isProxyServerActivePassive() const { return this->nodeType == NET_PROXY_SERVER_PASSIVE; }
    2727    inline bool isClient() const { return this->nodeType == NET_CLIENT; }
    2828
  • branches/proxy/src/lib/network/player_stats.cc

    r9406 r9452  
    191191void PlayerStats::setNickName( std::string nick )
    192192{
    193   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() )
     193  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() )
    194194  {
    195195    this->nickName = nick;
  • branches/proxy/src/lib/network/shared_network_data.h

    r9406 r9452  
    3535    inline bool isMasterServer() { return this->nodeType == NET_MASTER_SERVER; }
    3636    /** @returns true is this node is a proxy server */
    37     inline bool isProxyServer() { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }
     37    inline bool isProxyServerActive() { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }
    3838    /** @returns true is this node is a client*/
    3939    inline bool isClient() { return this->nodeType == NET_CLIENT; }
  • branches/proxy/src/lib/network/synchronizeable.cc

    r9406 r9452  
    7272    this->networkStream->disconnectSynchronizeable(*this);
    7373
    74     if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() )
     74    if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() )
    7575           && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
    7676      NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() );
     
    213213      hasPermission = true;
    214214    // now check PROXY_SERVER permissions
    215     else if( SharedNetworkData::getInstance()->isProxyServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
     215    else if( SharedNetworkData::getInstance()->isProxyServerActive() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
    216216      hasPermission = true;
    217217    // now check OWNER permissions
     
    225225      hasPermission = true;
    226226    // SPECIAL: get write permissions if i am proxy server and i am able to overwrite the client stuff
    227     else if( SharedNetworkData::getInstance()->isProxyServer()  && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
     227    else if( SharedNetworkData::getInstance()->isProxyServerActive()  && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
    228228      hasPermission = true;
    229229    else
  • branches/proxy/src/story_entities/multi_player_world_data.cc

    r9406 r9452  
    112112  const TiXmlElement* element = NULL;
    113113
    114   if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     114  if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    115115  {
    116116    /* load the spawning points */
     
    148148    element = element->FirstChildElement();
    149149
    150     if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     150    if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    151151    {
    152152      while( element != NULL)
     
    206206
    207207
    208     if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     208    if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    209209    {
    210210      this->localPlayer = new Player();
     
    284284
    285285  // create server playable
    286   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     286  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    287287  {
    288288    NetworkGameManager::getInstance()->signalNewPlayer( 0 );
  • branches/proxy/src/world_entities/creatures/fps_player.cc

    r9406 r9452  
    287287  //dealing damage
    288288
    289   if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()))
     289  if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()))
    290290  {
    291291    this->damageTicker -= time;
  • branches/proxy/src/world_entities/space_ships/space_ship.cc

    r9406 r9452  
    314314  if( entity->isA(CL_PROJECTILE) && entity != ref)
    315315  {
    316     if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     316    if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    317317    {
    318318      //TODO handle this
  • branches/proxy/src/world_entities/spawning_point.cc

    r9406 r9452  
    178178      }
    179179
    180       if ( found && SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     180      if ( found && SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    181181        this->sendRespawnMessage( it->entity->getUniqueID() );
    182182
     
    218218bool SpawningPoint::respawnMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    219219{
    220   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     220  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
    221221  {
    222222    PRINTF(2)("server received spawn message!\n");
Note: See TracChangeset for help on using the changeset viewer.