Changeset 5833 in orxonox.OLD for branches/network
- Timestamp:
- Nov 30, 2005, 11:09:18 AM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/defs/debug.h
r5822 r5833 107 107 #endif 108 108 #ifndef NO_SHELL 109 #define PRINT_EXEC ShellBuffer::addBufferLineStatic109 #define PRINT_EXEC printf //ShellBuffer::addBufferLineStatic 110 110 #else /* NO_SHELL */ 111 111 #define PRINT_EXEC printf -
branches/network/src/lib/network/network_stream.cc
r5829 r5833 44 44 this->init(); 45 45 /* initialize the references */ 46 this->type = NET_CLIENT; 46 47 this->networkSocket = new NetworkSocket(); 47 48 this->networkProtocol = new NetworkProtocol(); … … 52 53 NetworkStream::NetworkStream(IPaddress& address, NodeType type) 53 54 { 55 this->type = type; 54 56 this->init(); 55 57 this->networkSocket = new NetworkSocket(address); … … 62 64 NetworkStream::NetworkStream(unsigned int port, NodeType type) 63 65 { 66 this->type = type; 64 67 this->init(); 65 68 this->networkSocket = new NetworkSocket(); … … 74 77 : DataStream() 75 78 { 79 this->type = type; 76 80 this->init(); 77 81 this->networkSocket = new NetworkSocket(address); … … 86 90 : DataStream() 87 91 { 92 this->type = type; 88 93 this->init(); 89 94 this->networkSocket = new NetworkSocket(); … … 134 139 PRINT(0)("============= DOWNSTREAM:===============\n"); 135 140 /* first of all read the synchronizeable's data: */ 136 //if(this->isServer())137 dataLength = this->synchronizeables->readBytes((byte*)downBuffer);141 if( this->isServer()) 142 dataLength = this->synchronizeables->readBytes((byte*)downBuffer); 138 143 139 144 if( dataLength > 0) … … 181 186 if( dataLength == this->packetHeader.length) 182 187 { 183 printf("NetworkStream::processData() - Got Data: \n");188 printf("NetworkStream::processData() - Got Data: %i bytes\n", dataLength); 184 189 /* send the received data to connectionMonitor */ 185 190 this->connectionMonitor->processPacket((byte*)upBuffer, this->packetHeader.length); 186 191 /* now pass the data to the sync object */ 187 //if(!this->isServer())188 this->synchronizeables->writeBytes((byte*)upBuffer, this->packetHeader.length);192 if( !this->isServer()) 193 this->synchronizeables->writeBytes((byte*)upBuffer, this->packetHeader.length); 189 194 190 195 this->state = NET_REC_HEADER; -
branches/network/src/world_entities/player.cc
r5829 r5833 445 445 void Player::writeBytes(const byte* data, int length) 446 446 { 447 PRINTF(0)("Player: got %i bytes of data\n", length);447 // PRINTF(0)("Player: got %i bytes of data\n", length); 448 448 this->inLength = length; 449 449 … … 476 476 for( int i = 0; i < length; i++) 477 477 { 478 478 479 code = data[i]; 479 480 481 //PRINTF(0)("got byte: %u\n", data[i]); 480 482 /* is it a time code? */ 481 483 if( code == TIME) 482 484 { 483 485 /* is it the first time */ 484 if( time > 0.0f ) 485 { 486 /* apply movement */ 487 Vector move = accel * time; 488 489 if (accel.z < 0) 490 this->setRelDirSoft(Quaternion(-.4, Vector(1,0,0)), 5); 491 else if (accel.z > 0) 492 this->setRelDirSoft(Quaternion(.4, Vector(1,0,0)), 5); 493 else 494 this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5); 495 this->shiftCoor (move); 496 } 486 497 487 /* read out new movement */ 498 488 time = (float)(data[++i] / 100.0f); 499 PRINTF(0)("Got time: %f msec\n", time);489 //PRINTF(0)("Got time: %f msec\n", time); 500 490 } 491 501 492 else if( code == UP && this->getRelCoor().x < 20) 502 493 accel = accel+(direction*acceleration); … … 507 498 else if( code == RIGHT && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2) 508 499 accel = accel + (orthDirection*acceleration); 509 } 510 500 501 if( time > 0.0f ) 502 { 503 /* apply movement */ 504 Vector move = accel * time; 505 506 if (accel.z < 0) 507 this->setRelDirSoft(Quaternion(-.4, Vector(1,0,0)), 5); 508 else if (accel.z > 0) 509 this->setRelDirSoft(Quaternion(.4, Vector(1,0,0)), 5); 510 else 511 this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5); 512 this->shiftCoor (move); 513 } 514 515 } 516 517 511 518 512 519 … … 522 529 int Player::readBytes(byte* data) 523 530 { 524 PRINTF(0)("Player: sent %i bytes of data\n", this->sentLength);531 // PRINTF(0)("Player: sent %i bytes of data\n", this->sentLength); 525 532 526 533 /* copy data */
Note: See TracChangeset
for help on using the changeset viewer.