Changeset 1355 for code/branches/merge/src/network
- Timestamp:
- May 22, 2008, 11:53:19 AM (17 years ago)
- Location:
- code/branches/merge/src/network
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/merge/src/network/ClientInformation.cc
r1318 r1355 51 51 preve=0; 52 52 nexte=0; 53 partialGamestateID_=GAMESTATEID_INITIAL-1; 53 54 this->head_=false; 54 55 synched_=false; … … 59 60 preve=0; 60 61 nexte=0; 62 partialGamestateID_=GAMESTATEID_INITIAL-1; 61 63 this->head_=head; 62 64 synched_=false; … … 159 161 return true; 160 162 } 163 164 bool ClientInformation::setPartialGamestateID(int id){ 165 boost::recursive_mutex::scoped_lock lock(mutex_); 166 if(!this) 167 return false; 168 partialGamestateID_=id; 169 return true; 170 } 161 171 162 172 int ClientInformation::getID() { … … 203 213 if(this) 204 214 return gamestateID_; 215 else 216 return -1; 217 } 218 219 int ClientInformation::getPartialGamestateID() { 220 boost::recursive_mutex::scoped_lock lock(mutex_); 221 if(this) 222 return partialGamestateID_; 205 223 else 206 224 return -1; -
code/branches/merge/src/network/ClientInformation.h
r1318 r1355 70 70 bool setPeer(ENetPeer *peer); 71 71 bool setGamestateID(int id); 72 bool setPartialGamestateID(int id); 72 73 inline void setShipID(int id){ShipID_=id;} 73 74 … … 76 77 int getID(); 77 78 int getGamestateID(); 79 int getPartialGamestateID(); 78 80 ENetPeer *getPeer(); 79 81 bool getHead(); … … 107 109 int clientID_; 108 110 int gamestateID_; 111 int partialGamestateID_; 109 112 int ShipID_; // this is the unique objectID 110 113 bool synched_; -
code/branches/merge/src/network/ConnectionManager.cc
r1318 r1355 193 193 addClient(event); 194 194 //this is a workaround to ensure thread safety 195 /*if(!addFakeConnectRequest(&event))196 COUT(3) << "Problem pushing fakeconnectRequest to queue" << std::endl;*/197 195 COUT(5) << "Con.Man: connection event has occured" << std::endl; 198 196 break; … … 210 208 break; 211 209 case ENET_EVENT_TYPE_NONE: 210 receiverThread_->yield(); 212 211 break; 213 212 } -
code/branches/merge/src/network/GameStateClient.cc
r1333 r1355 47 47 COUT(5) << "this: " << this << std::endl; 48 48 last_diff_=0; 49 last_gamestate_=GAMESTATEID_INITIAL-1; 49 50 } 50 51 … … 56 57 printGameStateMap(); 57 58 GameState *gs, *reference; 59 /*if(compstate->id<last_gamestate_){ 60 // network packets got messed up 61 COUT(3) << "received an obsolete gamestate" << std::endl; 62 return false; 63 }*/ 58 64 if(compstate->diffed && compstate->base_id!=GAMESTATEID_INITIAL){ 59 65 std::map<int, GameState*>::iterator it = gameStateMap.find(compstate->base_id); … … 77 83 COUT(4) << "adding decoded gs with id: " << gs->id << " diffed from: " << gs->base_id << std::endl; 78 84 last_diff_=gs->base_id; 85 //last_gamestate_=gs->id; 79 86 return true; 80 87 }else{ … … 149 156 Synchronisable *no = dynamic_cast<Synchronisable *>(id->fabricate()); 150 157 COUT(4) << "loadsnapshot: classid: " << sync.classID << " objectID: " << sync.objectID << " length: " << sync.length << std::endl; 158 if(!no){ 159 COUT(2) << "coudl not frabricate classid: " << sync.classID << " objectID: " << sync.objectID << " identifier: " << id << std::endl; 160 break; 161 } 151 162 no->objectID=sync.objectID; 152 163 no->classID=sync.classID; -
code/branches/merge/src/network/GameStateClient.h
r1264 r1355 71 71 72 72 int last_diff_; 73 int last_gamestate_; 73 74 std::map<int, GameState *> gameStateMap; 74 75 -
code/branches/merge/src/network/GameStateManager.cc
r1299 r1355 221 221 orxonox::Iterator<Synchronisable> it=orxonox::ObjectList<Synchronisable>::start(); 222 222 syncData sync; 223 /*ClientInformation *client = head_->findClient(clientID); 224 if(client) 225 if(client->getPartialGamestateID()>state->id){ 226 COUT(3) << "we received an obsolete partial gamestate" << std::endl; 227 return false; 228 } 229 else;*/ 230 //what should we do now ?? 223 231 // loop as long as we have some data ;) 224 232 while(data < state->data+state->size){ … … 268 276 ++it; 269 277 } 270 278 //client->setPartialGamestateID(state->id); 271 279 return true; 272 280 } … … 428 436 return; 429 437 int curid = temp->getGamestateID(); 438 if(curid > gamestateID) 439 // the network packets got messed up 440 return; 430 441 COUT(4) << "acking gamestate " << gamestateID << " for clientid: " << clientID << " curid: " << curid << std::endl; 431 442 // decrease usage of gamestate and save it -
code/branches/merge/src/network/PacketManager.h
r1336 r1355 58 58 PacketGenerator(); 59 59 //call one of this functions out of an instance of PacketGenerator to create a packet 60 ENetPacket* acknowledgement( int state, int reliable = ENET_PACKET_FLAG_RELIABLE );60 ENetPacket* acknowledgement( int state, int reliable = 0 ); // we do not want reliability 61 61 ENetPacket* command( int dataLength, void *data, int reliable = ENET_PACKET_FLAG_RELIABLE ); 62 62 ENetPacket* mousem( double x, double y, int reliable = ENET_PACKET_FLAG_RELIABLE ); 63 63 ENetPacket* keystrike( char press, int reliable = ENET_PACKET_FLAG_RELIABLE ); 64 64 ENetPacket* chatMessage( const char* message, int reliable = ENET_PACKET_FLAG_RELIABLE ); 65 ENetPacket* gstate( GameStateCompressed *states, int reliable = ENET_PACKET_FLAG_RELIABLE );65 ENetPacket* gstate( GameStateCompressed *states, int reliable = 0 ); // we do not want reliability of gamestates 66 66 ENetPacket* clid( int classid, std::string classname, int reliable = ENET_PACKET_FLAG_RELIABLE ); 67 67 ENetPacket* generateWelcome( int clientID,int shipID, bool allowed, int reliable = ENET_PACKET_FLAG_RELIABLE ); -
code/branches/merge/src/network/Synchronisable.cc
r1306 r1355 156 156 if(classID==0) 157 157 COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl; 158 classID=this->getIdentifier()->getNetworkID();158 this->classID=this->getIdentifier()->getNetworkID(); 159 159 std::list<synchronisableVariable *>::iterator i; 160 160 syncData retVal;
Note: See TracChangeset
for help on using the changeset viewer.