Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 14, 2005, 10:50:33 PM (18 years ago)
Author:
rennerc
Message:

handshake now sends NetworkGameManagerId

File:
1 edited

Legend:

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

    r6090 r6115  
    2222#include "handshake.h"
    2323
    24 Handshake::Handshake( bool server, int clientId )
     24Handshake::Handshake( bool server, int clientId, int entityManagerId )
    2525{
    2626  /* set the class id for the base object */
    2727  this->setClassID(CL_HANDSHAKE, "Handshake");
    2828
     29  if ( clientId > 255 )
     30  {
     31    PRINTF(1)("clientId is too big for type byte (%d)! connection to client %d will not work!", clientId, clientId);
     32  }
     33
     34  if ( entityManagerId > 255 )
     35  {
     36    PRINTF(1)("entityManagerId is too big for type byte (%d)! connection to client %d will not work!", entityManagerId, clientId);
     37  }
     38
    2939  this->setIsServer(server);
    3040  this->clientId = clientId;
     41  this->entityManagerId = entityManagerId;
    3142  this->state = 0;
    3243  this->isOk = false;
     
    8899  if ( !isServer() && hasState( HS_RECVD_VER ) && !hasState( HS_RECVD_HID ) )
    89100  {
    90     if ( length != 1 )
     101    if ( length != 2 )
    91102    {
    92103      PRINTF(0)("hostID packet has wrong size %d instead of %d\n", length, 1);
     
    99110    this->isOk = true;
    100111    this->newHostId = data[0];
     112    this->newEntityManagerId = data[1];
    101113
    102114    if ( newHostId == 0 )
     
    156168  if ( isServer() && hasState( HS_RECVD_VER) && hasState( HS_SENT_VER ) && !hasState( HS_SENT_HID ) )
    157169  {
    158     if ( maxLength < 4 )
     170    if ( maxLength < 2 )
    159171    {
    160172      PRINTF(0)("buffer too small for ID");
     
    177189      //memcpy(data, &clientId, 4);
    178190      data[0] = (byte)clientId;
     191      data[1] = (byte)entityManagerId;
    179192    }
    180193    *reciever = clientId;
    181     return 1;
     194    return 2;
    182195  }
    183196
Note: See TracChangeset for help on using the changeset viewer.