Changeset 1730 for code/branches/network
- Timestamp:
- Sep 7, 2008, 3:30:52 PM (16 years ago)
- Location:
- code/branches/network/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/Client.cc
r1711 r1730 151 151 if(client_connection.isConnected() && isSynched_){ 152 152 COUT(4) << "popping partial gamestate: " << std::endl; 153 packet::Gamestate *gs = gamestate.getGamestate();153 /*packet::Gamestate *gs = gamestate.getGamestate(); 154 154 if(gs){ 155 155 COUT(4) << "client tick: sending gs " << gs << std::endl; … … 157 157 COUT(3) << "Problem adding partial gamestate to queue" << std::endl; 158 158 // gs gets automatically deleted by enet callback 159 } 159 }*/ 160 160 } 161 161 ENetEvent *event; … … 168 168 } 169 169 int gameStateID = gamestate.processGamestates(); 170 if(gameStateID==GAMESTATEID_INITIAL)170 /*if(gameStateID==GAMESTATEID_INITIAL) 171 171 if(gameStateFailure_){ 172 172 packet::Acknowledgement ack(GAMESTATEID_INITIAL, 0); … … 186 186 if(!ack.send()) 187 187 COUT(3) << "could not ack gamestate" << std::endl; 188 } // otherwise we had no gamestate to load188 }*/// otherwise we had no gamestate to load 189 189 gamestate.cleanup(); 190 190 return; -
code/branches/network/src/network/GamestateManager.cc
r1712 r1730 62 62 bool GamestateManager::update(){ 63 63 cleanup(); 64 getSnapshot(); 65 return true; 64 return getSnapshot(); 66 65 } 67 66 -
code/branches/network/src/network/Server.cc
r1712 r1730 259 259 //std::cout << "adding gamestate" << std::endl; 260 260 gs->setClientID(cid); 261 assert(gs->compressData()); 261 262 if ( !gs->send() ){ 262 263 COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl; -
code/branches/network/src/network/Synchronisable.cc
r1699 r1730 90 90 bool Synchronisable::fabricate(unsigned char*& mem, int mode) 91 91 { 92 int size, objectID, classID;93 size = *( int *)mem;94 objectID = *( int*)(mem+sizeof(int));95 classID = *( int*)(mem+2*sizeof(int));96 97 orxonox::Identifier* id = ID( (unsigned int)classID);92 unsigned int size, objectID, classID; 93 size = *(unsigned int *)mem; 94 objectID = *(unsigned int*)(mem+sizeof(unsigned int)); 95 classID = *(unsigned int*)(mem+2*sizeof(unsigned int)); 96 97 orxonox::Identifier* id = ID(classID); 98 98 if(!id){ 99 99 COUT(3) << "We could not identify a new object; classid: " << classID << " uint: " << (unsigned int)classID << " objectID: " << objectID << " size: " << size << std::endl; 100 100 return false; // most probably the gamestate is corrupted 101 101 } 102 Synchronisable *no = dynamic_cast<Synchronisable *>(id->fabricate()); 103 if(!no){ 104 COUT(2) << "coudl not frabricate classid: " << classID << " objectID: " << objectID << " identifier: " << id << std::endl; 105 return false; 106 } 102 orxonox::BaseObject *bo = id->fabricate(); 103 Synchronisable *no = dynamic_cast<Synchronisable *>(bo); 104 assert(no); 107 105 no->objectID=objectID; 108 106 no->classID=classID; 107 COUT(3) << "fabricate objectID: " << no->objectID << " classID: " << no->classID << std::endl; 109 108 // update data and create object/entity... 110 109 if( !no->updateData(mem, mode) ){ -
code/branches/network/src/network/packet/Gamestate.cc
r1715 r1730 128 128 while(mem < data_+sizeof(GamestateHeader)+HEADER->normsize){ 129 129 // extract synchronisable header 130 size = *( int *)mem;131 objectID = *( int*)(mem+sizeof(int));132 classID = *( int*)(mem+2*sizeof(int));133 134 if(!it || it->objectID!=objectID ){130 size = *(unsigned int *)mem; 131 objectID = *(unsigned int*)(mem+sizeof(unsigned int)); 132 classID = *(unsigned int*)(mem+2*sizeof(unsigned int)); 133 134 if(!it || it->objectID!=objectID || it->classID!=classID){ 135 135 // bad luck ;) 136 136 // delete the synchronisable (obviously seems to be deleted on the server) … … 141 141 //fabricate the new synchronisable 142 142 if(!Synchronisable::fabricate(mem, mode)) 143 return false;143 /*return false*/; 144 144 it=orxonox::ObjectList<Synchronisable>::end(); 145 145 } … … 208 208 //save new data 209 209 data_ = ndata; 210 assert(HEADER->compressed); 211 COUT(3) << "gamestate compress normsize: " << HEADER->normsize << " compsize: " << HEADER->compsize << std::endl; 210 212 return true; 211 213 } -
code/branches/network/src/network/packet/Packet.cc
r1715 r1730 82 82 enetPacket_=p.enetPacket_; 83 83 flags_=p.flags_; 84 packetDirection_ = p.packetDirection_; 85 clientID_ = p.clientID_; 84 86 if(p.data_){ 85 87 data_ = new unsigned char[p.getSize()]; … … 97 99 98 100 bool Packet::send(){ 99 /*if(packetDirection_ != ENUM::Outgoing && packetDirection_ != ENUM::Bidirectional ){101 if(packetDirection_ != ENUM::Outgoing && packetDirection_ != ENUM::Bidirectional ){ 100 102 assert(0); 101 103 return false; 102 } */104 } 103 105 if(!enetPacket_){ 104 106 if(!data_){ -
code/branches/network/src/orxonox/objects/SpaceShip.cc
r1669 r1730 244 244 this->chFarNode_->setScale(0.4, 0.4, 0.4); 245 245 } 246 // END of testing crosshair 246 247 247 248 createCamera(); 248 // END of testing crosshair249 249 } 250 250 … … 322 322 this->setBacksync(true); 323 323 //CameraHandler::getInstance()->requestFocus(cam_); 324 if(this->isExactlyA(Class(SpaceShip))) 324 if(this->isExactlyA(Class(SpaceShip))){ 325 325 getFocus(); 326 } 326 COUT(3) << "getting focus for obj id: " << objectID << std::endl; 327 }else 328 COUT(3) << "not getting focus (not exactly spaceship) for obj id: " << objectID << std::endl; 329 }else 330 COUT(3) << "not getting focus (not my ship) for obj id: " << objectID << std::endl; 327 331 328 332 }
Note: See TracChangeset
for help on using the changeset viewer.