Changeset 2416
- Timestamp:
- Dec 12, 2008, 10:43:48 AM (16 years ago)
- Location:
- code/branches/presentation/src/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/network/TrafficControl.cc
r2415 r2416 80 80 */ 81 81 TrafficControl::~TrafficControl() 82 { 83 //was macht das genau? da instance ja gleich this ist im moment 82 { 84 83 instance_=0; 85 //muss ich alles deallozieren was ich im constructor aufgebaut habe?86 84 } 87 85 … … 92 90 void TrafficControl::setConfigValues() 93 91 { 92 SetConfigValue ( bActive_, true ); 94 93 SetConfigValue ( targetSize, 5000 ); 95 94 } … … 108 107 109 108 /** 110 * eigener sortieralgorithmus109 * sort-algorithm for sorting the objectlist after priorities 111 110 */ 112 bool TrafficControl::prio differ(uint32_t clientID, obj i, obj j)111 bool TrafficControl::prioritySort(uint32_t clientID, obj i, obj j) 113 112 { 114 113 assert(clientListPerm_.find(clientID) != clientListPerm_.end()); //make sure the client exists in our list … … 118 117 int prio1 = clientListPerm_[clientID][i.objID].objValuePerm + clientListPerm_[clientID][i.objID].objValueSched; 119 118 int prio2 = clientListPerm_[clientID][j.objID].objValuePerm + clientListPerm_[clientID][j.objID].objValueSched; 120 // int prio1 = clientListPerm_[clientID][i.objID].objID;121 // int prio2 = clientListPerm_[clientID][j.objID].objID;122 // NOTE: smaller priority is better123 119 return prio1 < prio2; 124 120 } 125 121 122 /** 123 * sort-algorithm for sorting the objectList after position in original data stream 124 */ 125 bool TrafficControl::dataSort(obj i, obj j) 126 { 127 int pos1 = i.objDataOffset; 128 int pos2 = j.objDataOffset; 129 return pos1 < pos2; 130 } 131 132 126 133 127 134 void TrafficControl::processObjectList(unsigned int clientID, unsigned int gamestateID, std::list<obj> *list) … … 354 361 //sort copied list aufgrund der objprioperm in clientlistperm 355 362 // use boost bind here because we need to pass a memberfunction to stl sort 356 list->sort(boost::bind(&TrafficControl::prio differ, this, clientID, _1, _2) );363 list->sort(boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) ); 357 364 358 365 //now we check, that the creator of an object always exists on a client … … 366 373 //now the cutting, work the same obj out in processobjectlist and copiedlist, compression rate muss noch festgelegt werden. 367 374 cut(list, targetSize); 375 376 //now sort again after objDataOffset 377 list->sort(boost::bind(&TrafficControl::dataSort, this, _1, _2) ); 368 378 // printList(list, clientID); 369 379 //diese Funktion updateClientList muss noch gemacht werden -
code/branches/presentation/src/network/TrafficControl.h
r2413 r2416 123 123 unsigned int currentClientID; 124 124 unsigned int targetSize; 125 bool bActive_; 125 126 /** 126 127 *copiedVector is a copy of the given Vector by the GSmanager, on this list all manipulations are performed … … 169 170 void deleteObject(unsigned int objectID); // this function gets called when an object has been deleted (in order to clean up lists and maps) 170 171 171 bool priodiffer(uint32_t clientID, obj i, obj j); 172 bool prioritySort(uint32_t clientID, obj i, obj j); 173 bool dataSort(obj i, obj j); 172 174 void printList(std::list<obj> *list, unsigned int clientID); 173 175 void fixCreatorDependencies(std::list<obj>::iterator it, std::list<obj> *list, unsigned int clientID);
Note: See TracChangeset
for help on using the changeset viewer.