Changeset 1361
- Timestamp:
- May 22, 2008, 2:09:33 PM (17 years ago)
- Location:
- code/branches/merge/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/merge/src/network/ClientInformation.cc
r1355 r1361 51 51 preve=0; 52 52 nexte=0; 53 partialGamestateID_=GAMESTATEID_INITIAL-1;54 53 this->head_=false; 55 54 synched_=false; … … 60 59 preve=0; 61 60 nexte=0; 62 partialGamestateID_=GAMESTATEID_INITIAL-1;63 61 this->head_=head; 64 62 synched_=false; … … 161 159 return true; 162 160 } 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 }171 161 172 162 int ClientInformation::getID() { … … 213 203 if(this) 214 204 return gamestateID_; 215 else216 return -1;217 }218 219 int ClientInformation::getPartialGamestateID() {220 boost::recursive_mutex::scoped_lock lock(mutex_);221 if(this)222 return partialGamestateID_;223 205 else 224 206 return -1; -
code/branches/merge/src/network/ClientInformation.h
r1355 r1361 70 70 bool setPeer(ENetPeer *peer); 71 71 bool setGamestateID(int id); 72 bool setPartialGamestateID(int id);73 72 inline void setShipID(int id){ShipID_=id;} 74 73 … … 77 76 int getID(); 78 77 int getGamestateID(); 79 int getPartialGamestateID();80 78 ENetPeer *getPeer(); 81 79 bool getHead(); … … 109 107 int clientID_; 110 108 int gamestateID_; 111 int partialGamestateID_;112 109 int ShipID_; // this is the unique objectID 113 110 bool synched_; -
code/branches/merge/src/network/ConnectionManager.cc
r1355 r1361 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;*/ 195 197 COUT(5) << "Con.Man: connection event has occured" << std::endl; 196 198 break; … … 208 210 break; 209 211 case ENET_EVENT_TYPE_NONE: 210 receiverThread_->yield();211 212 break; 212 213 } -
code/branches/merge/src/network/GameStateClient.cc
r1355 r1361 47 47 COUT(5) << "this: " << this << std::endl; 48 48 last_diff_=0; 49 last_gamestate_=GAMESTATEID_INITIAL-1;50 49 } 51 50 … … 57 56 printGameStateMap(); 58 57 GameState *gs, *reference; 59 /*if(compstate->id<last_gamestate_){60 // network packets got messed up61 COUT(3) << "received an obsolete gamestate" << std::endl;62 return false;63 }*/64 58 if(compstate->diffed && compstate->base_id!=GAMESTATEID_INITIAL){ 65 59 std::map<int, GameState*>::iterator it = gameStateMap.find(compstate->base_id); … … 83 77 COUT(4) << "adding decoded gs with id: " << gs->id << " diffed from: " << gs->base_id << std::endl; 84 78 last_diff_=gs->base_id; 85 //last_gamestate_=gs->id;86 79 return true; 87 80 }else{ … … 156 149 Synchronisable *no = dynamic_cast<Synchronisable *>(id->fabricate()); 157 150 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 }162 151 no->objectID=sync.objectID; 163 152 no->classID=sync.classID; -
code/branches/merge/src/network/GameStateClient.h
r1355 r1361 71 71 72 72 int last_diff_; 73 int last_gamestate_;74 73 std::map<int, GameState *> gameStateMap; 75 74 -
code/branches/merge/src/network/GameStateManager.cc
r1355 r1361 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 ??231 223 // loop as long as we have some data ;) 232 224 while(data < state->data+state->size){ … … 276 268 ++it; 277 269 } 278 //client->setPartialGamestateID(state->id);270 279 271 return true; 280 272 } … … 436 428 return; 437 429 int curid = temp->getGamestateID(); 438 if(curid > gamestateID)439 // the network packets got messed up440 return;441 430 COUT(4) << "acking gamestate " << gamestateID << " for clientid: " << clientID << " curid: " << curid << std::endl; 442 431 // decrease usage of gamestate and save it -
code/branches/merge/src/network/PacketManager.h
r1355 r1361 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 = 0 ); // we do not want reliability 60 // ENetPacket* acknowledgement( int state, int reliable = 0 ); 61 ENetPacket* acknowledgement( int state, int reliable = ENET_PACKET_FLAG_RELIABLE ); 61 62 ENetPacket* command( int dataLength, void *data, int reliable = ENET_PACKET_FLAG_RELIABLE ); 62 63 ENetPacket* mousem( double x, double y, int reliable = ENET_PACKET_FLAG_RELIABLE ); 63 64 ENetPacket* keystrike( char press, int reliable = ENET_PACKET_FLAG_RELIABLE ); 64 65 ENetPacket* chatMessage( const char* message, int reliable = ENET_PACKET_FLAG_RELIABLE ); 65 ENetPacket* gstate( GameStateCompressed *states, int reliable = 0 ); // we do not want reliability of gamestates 66 ENetPacket* gstate( GameStateCompressed *states, int reliable = ENET_PACKET_FLAG_RELIABLE ); 67 // ENetPacket* gstate( GameStateCompressed *states, int reliable = 0 ); 66 68 ENetPacket* clid( int classid, std::string classname, int reliable = ENET_PACKET_FLAG_RELIABLE ); 67 69 ENetPacket* generateWelcome( int clientID,int shipID, bool allowed, int reliable = ENET_PACKET_FLAG_RELIABLE ); -
code/branches/merge/src/network/Synchronisable.cc
r1355 r1361 156 156 if(classID==0) 157 157 COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl; 158 this->classID=this->getIdentifier()->getNetworkID();158 classID=this->getIdentifier()->getNetworkID(); 159 159 std::list<synchronisableVariable *>::iterator i; 160 160 syncData retVal; -
code/branches/merge/src/orxonox/objects/WorldEntity.cc
r1355 r1361 156 156 registerVar( (void*) &(this->getAcceleration().y), sizeof(this->getAcceleration().y), network::DATA, 0x3); 157 157 registerVar( (void*) &(this->getAcceleration().z), sizeof(this->getAcceleration().z), network::DATA, 0x3); 158 registerVar( (void*) &(this->getMomentum()), sizeof(this->getMomentum()), network::DATA );158 registerVar( (void*) &(this->getMomentum()), sizeof(this->getMomentum()), network::DATA, 0x3); 159 159 } 160 160
Note: See TracChangeset
for help on using the changeset viewer.