Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 26, 2008, 5:00:33 PM (15 years ago)
Author:
chpeter
Message:

network traffic current progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/TrafficControl.cc

    r2230 r2276  
    6161*/
    6262
    63 TrafficControl::processObjectList(unsigned int clientID, unsigned int gamestateID, std::vector<unsigned> *list)
     63TrafficControl::processObjectList(unsigned int clientID, unsigned int gamestateID, std::vector<obj> *list)
    6464{
    6565  currentClientID=clientID;
     
    136136  copyList(list);
    137137  updateReferenceList(listToProcess_);
    138 
     138 
    139139  //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
    140182 
     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
    141200  //end of sorting
    142201  return evaluatedList_;
Note: See TracChangeset for help on using the changeset viewer.