Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 10, 2006, 1:13:49 PM (18 years ago)
Author:
rennerc
Message:

reimplemented NetworkStream

File:
1 edited

Legend:

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

    r7444 r7565  
    4141  error_handler = registerVarId( new SynchronizeableInt( &localState.error, &remoteState.error, "error" ) );
    4242  errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString" ) );
    43 
     43 
     44  localState.completed = false;
     45  localState.error = 0;
     46  localState.errorString = "";
     47  localState.hostId = clientId;
     48  localState.networkManagerId = networkGameManagerId;
     49  localState.orxId = _ORXONOX_ID;
     50  localState.version = _ORXONOX_VERSION;
     51 
     52  remoteState.completed = false;
     53  remoteState.error = 0;
     54  remoteState.errorString = "";
     55  remoteState.hostId = -1;
     56  remoteState.networkManagerId = -1;
     57  remoteState.orxId = 0;
     58  remoteState.version = 0;
    4459
    4560  this->setSynchronized(true);
     
    5368void Handshake::varChangeHandler( std::list< int > & id )
    5469{
     70  for ( std::list<int>::iterator it = id.begin(); it != id.end(); it++ )
     71  {
     72    if ( *it == orxId_handler )
     73    {
     74      if ( remoteState.orxId != _ORXONOX_ID )
     75      {
     76        localState.error = 1;
     77        localState.completed = true;
     78        localState.errorString = "Seems not to be orxonox!";
     79        return;
     80      }
     81    }
     82     
     83    if ( *it == version_handler )
     84    {
     85      if ( remoteState.version != _ORXONOX_VERSION )
     86      {
     87        localState.error = 2;
     88        localState.completed = true;
     89        localState.errorString = "Versions of server and client do not match!";
     90        return;
     91      }
     92    }
     93   
     94  }
    5595}
    5696
Note: See TracChangeset for help on using the changeset viewer.