Changeset 2381 for code/branches/presentation/src
- Timestamp:
- Dec 10, 2008, 3:02:14 PM (16 years ago)
- Location:
- code/branches/presentation/src/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/network/GamestateManager.cc
r2371 r2381 184 184 } 185 185 temp->setGamestateID(gamestateID); 186 TrafficControl::processAck(clientID, gamestateID); 186 187 return true; 187 188 } -
code/branches/presentation/src/network/TrafficControl.cc
r2378 r2381 128 128 } 129 129 130 void TrafficControl:: processAck(unsigned int clientID, unsigned int gamestateID)130 void TrafficControl::ack(unsigned int clientID, unsigned int gamestateID) 131 131 { 132 132 std::list<obj>::iterator itvec; // iterator to iterate through the acked objects … … 146 146 else 147 147 { 148 assert(0); 148 149 clientListPerm_[clientID][(*itvec).objID].objCurGS = gamestateID; 149 150 clientListPerm_[clientID][(*itvec).objID].objID = (*itvec).objID; … … 226 227 // for(itvec = list.begin(); itvec!=list.end(), itvec++) 227 228 // { 228 // ittempgs.insert(itvec); 229 // ittempgs.insert(itvec);static 229 230 // } 230 231 } … … 237 238 { 238 239 unsigned int size=0; 239 std::list<obj>::iterator itvec ;240 std::list<obj>::iterator itvec, ittemp; 240 241 assert(!list->empty()); 241 itvec = list->begin(); 242 for(itvec = list->begin(); ( itvec != list->end() ) && ( size<targetsize ); itvec++) 242 for(itvec = list->begin(); itvec != list->end();) 243 243 { 244 244 assert( (*itvec).objSize < 1000); 245 COUT(0) << "==targetsize== " << targetsize << endl;245 // COUT(0) << "==targetsize== " << targetsize << endl; 246 246 if ( ( size + (*itvec).objSize ) < targetsize ) 247 247 { 248 // COUT(0) << "no cut" << endl; 248 249 size += (*itvec).objSize;//objSize is given in bytes 250 ++itvec; 249 251 } 250 252 else 251 253 { 252 clientListPerm_[currentClientID][(*itvec).objID].objValueSched -= SCHED_PRIORITY_OFFSET; 254 // COUT(0) << "cut" << endl; 255 clientListPerm_[currentClientID][(*itvec).objID].objValueSched += SCHED_PRIORITY_OFFSET; // NOTE: SCHED_PRIORITY_OFFSET is negative 256 // ittemp = itvec; 253 257 list->erase(itvec++); 254 } 258 // itvec = ittemp; 259 } 260 // printList(list, currentClientID); 255 261 } 256 262 assert(!list->empty()); … … 361 367 COUT(0) << "=========== Objectlist ===========" << endl; 362 368 for( it=list->begin(); it!=list->end(); it++) 363 COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << endl;369 COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << " size: " << (*it).objSize << endl; 364 370 } 365 371 -
code/branches/presentation/src/network/TrafficControl.h
r2371 r2381 52 52 uint32_t objDiffGS;//difference between current and latest GameState 53 53 uint32_t objSize; 54 unsignedint objValuePerm;55 unsignedint objValueSched;54 int objValuePerm; 55 int objValueSched; 56 56 objInfo(uint32_t ID, uint32_t creatorID, int32_t curGsID, int32_t diffGsID, uint32_t size, unsigned int prioperm, unsigned int priosched); 57 57 objInfo(); … … 139 139 */ 140 140 void evaluateList(unsigned int clientID, std::list<obj> *list);//done 141 void ack(unsigned int clientID, unsigned int gamestateID); // this function gets called when the server receives an ack from the client 141 142 142 143 protected: … … 154 155 void processObjectList(unsigned int clientID, unsigned int gamestateID, std::list<obj>* list); //gets a pointer to the list (containing objectIDs) and sorts it 155 156 //done 156 void processAck(unsigned int clientID, unsigned int gamestateID); // this function gets called when the server receives an ack from the client 157 static void processAck(unsigned int clientID, unsigned int gamestateID) 158 { return instance_->ack(clientID, gamestateID); } 157 159 //done 158 160 void deleteObject(unsigned int objectID); // this function gets called when an object has been deleted (in order to clean up lists and maps)
Note: See TracChangeset
for help on using the changeset viewer.