Changeset 6115 in orxonox.OLD for branches/network/src/lib/network/handshake.cc
- Timestamp:
- Dec 14, 2005, 10:50:33 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/handshake.cc
r6090 r6115 22 22 #include "handshake.h" 23 23 24 Handshake::Handshake( bool server, int clientId )24 Handshake::Handshake( bool server, int clientId, int entityManagerId ) 25 25 { 26 26 /* set the class id for the base object */ 27 27 this->setClassID(CL_HANDSHAKE, "Handshake"); 28 28 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 29 39 this->setIsServer(server); 30 40 this->clientId = clientId; 41 this->entityManagerId = entityManagerId; 31 42 this->state = 0; 32 43 this->isOk = false; … … 88 99 if ( !isServer() && hasState( HS_RECVD_VER ) && !hasState( HS_RECVD_HID ) ) 89 100 { 90 if ( length != 1)101 if ( length != 2 ) 91 102 { 92 103 PRINTF(0)("hostID packet has wrong size %d instead of %d\n", length, 1); … … 99 110 this->isOk = true; 100 111 this->newHostId = data[0]; 112 this->newEntityManagerId = data[1]; 101 113 102 114 if ( newHostId == 0 ) … … 156 168 if ( isServer() && hasState( HS_RECVD_VER) && hasState( HS_SENT_VER ) && !hasState( HS_SENT_HID ) ) 157 169 { 158 if ( maxLength < 4)170 if ( maxLength < 2 ) 159 171 { 160 172 PRINTF(0)("buffer too small for ID"); … … 177 189 //memcpy(data, &clientId, 4); 178 190 data[0] = (byte)clientId; 191 data[1] = (byte)entityManagerId; 179 192 } 180 193 *reciever = clientId; 181 return 1;194 return 2; 182 195 } 183 196
Note: See TracChangeset
for help on using the changeset viewer.