Changeset 6868 in orxonox.OLD for trunk/src/lib/network
- Timestamp:
- Jan 30, 2006, 4:41:19 PM (19 years ago)
- Location:
- trunk/src/lib/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/network_game_manager.cc
r6815 r6868 575 575 if ( (*it)->getUniqueID() == uniqueID ) 576 576 { 577 delete *it; 577 assert((*it)->isA(CL_WORLD_ENTITY)); 578 dynamic_cast<WorldEntity*>(*it)->toList(OM_DEAD); 578 579 break; 579 580 } -
trunk/src/lib/network/network_stream.cc
r6737 r6868 263 263 if ( reciever!=0 ) 264 264 { 265 if ( networkSockets[reciever] != NULL ) 266 { 267 PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever); 268 networkSockets[reciever]->writePacket(downBuffer, dataLength); 265 if ( reciever < 0) 266 { 267 for ( int i = 0; i<networkSockets.size(); i++) 268 { 269 if ( i!=-reciever && networkSockets[i] != NULL ) 270 { 271 PRINTF(5)("write %d bytes to socket %d\n", dataLength, i); 272 networkSockets[i]->writePacket(downBuffer, dataLength); 273 } 274 } 269 275 } 270 276 else 271 277 { 272 PRINTF(1)("networkSockets[reciever] == NULL\n"); 278 if ( networkSockets[reciever] != NULL ) 279 { 280 PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever); 281 networkSockets[reciever]->writePacket(downBuffer, dataLength); 282 } 283 else 284 { 285 PRINTF(1)("networkSockets[reciever] == NULL\n"); 286 } 273 287 } 274 288 } -
trunk/src/lib/network/synchronizeable.h
r6815 r6868 33 33 NWT_SS_VELY, 34 34 NWT_SS_VELZ, 35 NWT_SS_PL_SYNC, 35 36 36 37 NWT_HS_HOST_ID, 37 38 NWT_HS_NGM_ID, 39 40 NWT_PL_FLAGS, 38 41 39 42 NWT_PN_BO_WRITESTATE, … … 101 104 * with the same argument names! 102 105 * 106 * id is one int out of that enum on top of this comment it is used to identify 107 * read/write. when you read a value you have to use exactly the same as you used 108 * to write or you will see an assertion failing. 109 * 103 110 * SYNCHELP_WRITE_BEGIN() 104 * SYNCHELP_WRITE_INT(i )105 * SYNCHELP_WRITE_FLOAT(f )106 * SYNCHELP_WRITE_BYTE(b )107 * SYNCHELP_WRITE_STRING(s )111 * SYNCHELP_WRITE_INT(i,id) 112 * SYNCHELP_WRITE_FLOAT(f,id) 113 * SYNCHELP_WRITE_BYTE(b,id) 114 * SYNCHELP_WRITE_STRING(s,id) 108 115 * SYNCHELP_WRITE_N 109 116 * 110 117 * SYNCHELP_READ_BEGIN() 111 * SYNCHELP_READ_INT(i) 112 * SYNCHELP_READ_FLOAT(f) 113 * SYNCHELP_READ_STRING(s,l) l = size of buffer s 114 * SYNCHELP_READ_STRINGM(s) allocates memory for string! you have to free this after 115 * SYNCHELP_READ_BYTE(b) 118 * SYNCHELP_READ_INT(i,id) 119 * SYNCHELP_READ_FLOAT(f,id) 120 * SYNCHELP_READ_STRING(s,l,id) l = size of buffer s 121 * SYNCHELP_READ_STRINGM(s,id) allocates memory for string! you have to delete this later 122 * SYNCHELP_READ_BYTE(b,id) 123 * SYNCHELP_READ_REMAINING() returns the remaining buffer size 124 * SYNCHELP_READ_NEXTBYTE() reads the next byte but it is not removed from the buffer 116 125 * SYNCHELP_READ_N 117 126 * … … 122 131 * SYNCHELP_READ_FLOAT(size); 123 132 * SYNCHELP_READ_STRING( textureName, 1024 ); //1024 is the length of textureName 133 * delete[] textureName; 134 * textureName = NULL; 135 * SYNCHELP_READ_STRINGM( texturename ); //this will call new char[strlen()+1] 124 136 * 125 137 * Example 2: … … 130 142 * 131 143 */ 144 132 145 #define SYNCHELP_WRITE_DEBUG(n) {\ 133 146 __synchelp_write_n = Converter::intToByteArray( n, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \
Note: See TracChangeset
for help on using the changeset viewer.