Changeset 2276 for code/branches/network/src
- Timestamp:
- Nov 26, 2008, 5:00:33 PM (16 years ago)
- Location:
- code/branches/network/src/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/TrafficControl.cc
r2230 r2276 61 61 */ 62 62 63 TrafficControl::processObjectList(unsigned int clientID, unsigned int gamestateID, std::vector< unsigned> *list)63 TrafficControl::processObjectList(unsigned int clientID, unsigned int gamestateID, std::vector<obj> *list) 64 64 { 65 65 currentClientID=clientID; … … 136 136 copyList(list); 137 137 updateReferenceList(listToProcess_); 138 138 139 139 //now the sorting 140 141 //compare listToProcess vs clientListPerm 142 map<unsigned int, objInfo>::iterator itproc; 143 map<unsigned int,std::map<unsigned int, objInfo>>::iterator itperm; 144 map<unsigned int, objInfo>::iterator itpermobj; 145 map<unsigned int, unsigned int>::iterator itpermprio 146 for(itproc=listToProcess_->begin(); itproc != listToProcess_->end();it++) 147 { 148 itperm=clientListPerm->find(currentClientID); 149 itpermobj=itperm->find(itproc->first); 150 if(currentGamestateID < (itpermobj->second).objCurGS) 151 { 152 //obj bleibt in liste und permanente prio wird berechnet 153 (itpermobj->second).objDiffGS = (itpermobj->second).objCurGS - currentGamestateID; 154 itpermprio = permObjPrio_->find(itproc->first); 155 (itpermobj->second).objValuePerm = (itpermobj->second).objDiffGS * itpermprio->second; 156 continue;//check next objId 157 } 158 else 159 { 160 listToProcess_->erase (itproc); 161 } 162 } 163 //end compare listToProcess vs clientListPerm 164 165 //listToProc vs clientListTemp 166 map<unsigned int, std::map<unsigned int, unsigned int>>::iterator ittemp; 167 map<unsigned int, unsigned int>::iterator ittempgs; 168 for(itproc=listToProcess_->begin(); itproc != listToProcess_->end();it++) 169 { 170 ittemp = clientListTemp_->find(currentClientID); 171 if(ittempgs = ittemp->find(currentGamestateID)) 172 { 173 if(itproc->first == ittempgs->find(itproc->first)) 174 { 175 listToProcess_->erase (itproc); 176 } 177 else continue; 178 } 179 else continue; 180 } 181 //end listToProc vs clientListTemp 140 182 183 //listToProcess contains obj to send now, shorten copiedvector therefor too. 184 vector<obj>::iterator itvec; 185 for(itvec = copiedvector.begin(); itvec < copiedvector.end(); itvec++) 186 { 187 if(listToProcess_->find(itvec->objID)) 188 { 189 continue; 190 } 191 else 192 { 193 copiedvector.remove(itvec); 194 } 195 } 196 //sort copied vector aufgrund der objprioperm in clientlistperm 197 sort(copiedvector.begin(),copiedvector.end(),priodiffer); 198 //swappen aufgrund von creator oder ganz rausnehmen!? 199 141 200 //end of sorting 142 201 return evaluatedList_; -
code/branches/network/src/network/TrafficControl.h
r2231 r2276 33 33 #include <map> 34 34 #include <utility> 35 #include <algorithm> 35 36 36 37 #include "NetworkPrereqs.h" … … 40 41 41 42 // Synchronisable *bla = Synchronisable::getSynchronisable(objectID); 43 44 //stuff to iterate through: map<unsigned int, objInfo>::iterator itproc; 45 // map<unsigned int, Synchronisable>::iterator itref; 46 // for(it=listToProcess_->begin(); it != listToProcess_->end();it++) 47 // { 48 // 49 // itref=referenceList_->find((*itproc).first); 50 // refCurObj=(*itref).second; 42 51 43 52 /** … … 50 59 unsigned int objDiffGS;//difference between current and latest GameState 51 60 unsigned int objSize; 61 unsigned int objValuePerm; 62 unsigned int objValueSched; 52 63 }; 53 64 … … 62 73 }; 63 74 75 /** 76 *eigener sortieralgorithmus 77 */ 78 bool priodiffer(obj i, obj j) 79 { 80 map<unsigned int, objInfo>::iterator iti; 81 map<unsigned int, objInfo>::iterator itj; 82 iti=listToProcess_->find(i.objID); 83 itj=listToProcess_->find(j.objID); 84 return iti->second.objValuePerm < itj->second.objValuePerm; 85 } 64 86 65 87 /** … … 77 99 *reference list: contains object ids and the reference belonging to this id. 78 100 */ 79 std::map<unsigned int, Synchronisable*> *referenceList_;//has to be created with constructor and then needs to be updated by evaluateList().101 // std::map<unsigned int, Synchronisable*> *referenceList_;//has to be created with constructor and then needs to be updated by evaluateList(). 80 102 /** 81 103 *permanent client list: contains client ids, gamestate ids and object ids (in this order) 82 104 */ 83 std::map<unsigned int, objInfo> *clientListPerm_; //has to be created with constructor and then needs to be updated by evaluateList(). 105 std::map<unsigned int, std::map<unsigned int, objInfo>> *clientListPerm_; 106 //has to be created with constructor and then needs to be updated by evaluateList(). 107 84 108 /** 85 109 *temporary client list: contains client ids, gamestate ids and object ids (in this order) 86 110 */ 87 std::map<unsigned int, std::map<unsigned int, unsigned int>> *clientListTemp_;111 std::map<unsigned int, std::map<unsigned int, std::vector<obj>>> *clientListTemp_; 88 112 /** 89 113 *static priority list: contains obj id, basic priority (in this order) … … 101 125 unsigned int currentGamestateID; 102 126 unsigned int currentClientID; 127 Synchronisable *refCurObj;//reference to current object, uninitialized yet, do I have to or can I just set refCurObj=...; later on? 128 //not used yet anyway 129 std::vector<obj> copiedVector; //copy of original that I get from GSmanager 103 130 104 131 void updateReferenceList(std::map<unsigned int, objInfo> *list);
Note: See TracChangeset
for help on using the changeset viewer.