Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 22, 2009, 10:05:38 PM (14 years ago)
Author:
rgrieder
Message:

Replaced (*it). with it→ where I could find it. Should increased code readability.

File:
1 edited

Legend:

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

    r6387 r6400  
    152152    for(itvec = objectListTemp[gamestateID].begin(); itvec != objectListTemp[gamestateID].end(); itvec++)
    153153      {
    154       if(objectListPerm.find((*itvec).objID) != objectListPerm.end()) // check whether the obj already exists in our lists
    155       {
    156         objectListPerm[(*itvec).objID].objCurGS = gamestateID;
    157         objectListPerm[(*itvec).objID].objValueSched = 0; //set scheduling value back
     154      if(objectListPerm.find(itvec->objID) != objectListPerm.end()) // check whether the obj already exists in our lists
     155      {
     156        objectListPerm[itvec->objID].objCurGS = gamestateID;
     157        objectListPerm[itvec->objID].objValueSched = 0; //set scheduling value back
    158158      }
    159159      else
    160160      {
    161161        assert(0);
    162         objectListPerm[(*itvec).objID].objCurGS = gamestateID;
    163         objectListPerm[(*itvec).objID].objID = (*itvec).objID;
    164         objectListPerm[(*itvec).objID].objCreatorID = (*itvec).objCreatorID;
    165         objectListPerm[(*itvec).objID].objSize = (*itvec).objSize;
     162        objectListPerm[itvec->objID].objCurGS = gamestateID;
     163        objectListPerm[itvec->objID].objID = itvec->objID;
     164        objectListPerm[itvec->objID].objCreatorID = itvec->objCreatorID;
     165        objectListPerm[itvec->objID].objSize = itvec->objSize;
    166166      }
    167167      }
     
    205205    for(itvec = list.begin(); itvec != list.end();)
    206206    {
    207       assert( (*itvec).objSize < 1000);
    208       if ( ( size + (*itvec).objSize ) < targetsize )
    209       {
    210         size += (*itvec).objSize;//objSize is given in bytes
     207      assert( itvec->objSize < 1000);
     208      if ( ( size + itvec->objSize ) < targetsize )
     209      {
     210        size += itvec->objSize;//objSize is given in bytes
    211211        ++itvec;
    212212      }
    213213      else
    214214      {
    215         clientListPerm_[currentClientID][(*itvec).objID].objValueSched += SCHED_PRIORITY_OFFSET; // NOTE: SCHED_PRIORITY_OFFSET is negative
     215        clientListPerm_[currentClientID][itvec->objID].objValueSched += SCHED_PRIORITY_OFFSET; // NOTE: SCHED_PRIORITY_OFFSET is negative
    216216        list.erase(itvec, list.end());
    217217        break;
     
    241241      for( itvec=list.begin(); itvec != list.end(); itvec++)
    242242      {
    243         if ( objectListPerm.find( (*itvec).objID) != objectListPerm.end() )
     243        if ( objectListPerm.find( itvec->objID) != objectListPerm.end() )
    244244        {
    245245        // we already have the object in our map
    246246        //obj bleibt in liste und permanente prio wird berechnet
    247           objectListPerm[(*itvec).objID].objDiffGS = currentGamestateID - objectListPerm[(*itvec).objID].objCurGS;
     247          objectListPerm[itvec->objID].objDiffGS = currentGamestateID - objectListPerm[itvec->objID].objCurGS;
    248248          continue;//check next objId
    249249        }
     
    289289    COUT(0) << "=========== Objectlist ===========" << endl;
    290290    for( it=list.begin(); it!=list.end(); it++)
    291       COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << " size: " << (*it).objSize << endl;
     291      COUT(0) << "ObjectID: " << it->objID << " creatorID: " << it->objCreatorID << " Priority: " << clientListPerm_[clientID][it->objID].objValuePerm + clientListPerm_[clientID][it->objID].objValueSched << " size: " << it->objSize << endl;
    292292  }
    293293
    294294  void TrafficControl::fixCreatorDependencies(std::list<obj>::iterator it1, std::list<obj>& list, unsigned int clientID)
    295295  {
    296     if ( (*it1).objCreatorID == OBJECTID_UNKNOWN )
    297       return;
    298     if( clientListPerm_[clientID][(*it1).objCreatorID].objCurGS != GAMESTATEID_INITIAL )
     296    if ( it1->objCreatorID == OBJECTID_UNKNOWN )
     297      return;
     298    if( clientListPerm_[clientID][it1->objCreatorID].objCurGS != GAMESTATEID_INITIAL )
    299299      return;
    300300    std::list<obj>::iterator it2, it3=it1;
    301301    for( it2 = ++it3; it2 != list.end(); it2++ )
    302302    {
    303       if( (*it2).objID == (*it1).objCreatorID )
     303      if( it2->objID == it1->objCreatorID )
    304304      {
    305305        it3 = list.insert(it1, *it2); //insert creator before it1
Note: See TracChangeset for help on using the changeset viewer.