Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 12, 2008, 10:43:48 AM (16 years ago)
Author:
scheusso
Message:

some improvement in diffing (after trimming the objectlist we sort the list after the datastream again)

Location:
code/branches/presentation/src/network
Files:
2 edited

Legend:

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

    r2415 r2416  
    8080        */
    8181        TrafficControl::~TrafficControl()
    82         {
    83           //was macht das genau? da instance ja gleich this ist im moment
     82        {
    8483          instance_=0;
    85           //muss ich alles deallozieren was ich im constructor aufgebaut habe?
    8684        }
    8785
     
    9290  void TrafficControl::setConfigValues()
    9391  {
     92    SetConfigValue ( bActive_, true );
    9493    SetConfigValue ( targetSize, 5000 );
    9594  }
     
    108107 
    109108  /**
    110   * eigener sortieralgorithmus
     109  * sort-algorithm for sorting the objectlist after priorities
    111110  */
    112   bool TrafficControl::priodiffer(uint32_t clientID, obj i, obj j)
     111  bool TrafficControl::prioritySort(uint32_t clientID, obj i, obj j)
    113112  {
    114113    assert(clientListPerm_.find(clientID) != clientListPerm_.end());  //make sure the client exists in our list
     
    118117    int prio1 = clientListPerm_[clientID][i.objID].objValuePerm + clientListPerm_[clientID][i.objID].objValueSched;
    119118    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 better
    123119    return prio1 < prio2;
    124120  }
    125121
     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 
    126133
    127134        void TrafficControl::processObjectList(unsigned int clientID, unsigned int gamestateID, std::list<obj> *list)
     
    354361    //sort copied list aufgrund der objprioperm in clientlistperm
    355362    // use boost bind here because we need to pass a memberfunction to stl sort
    356     list->sort(boost::bind(&TrafficControl::priodiffer, this, clientID, _1, _2) );
     363    list->sort(boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) );
    357364   
    358365    //now we check, that the creator of an object always exists on a client
     
    366373    //now the cutting, work the same obj out in processobjectlist and copiedlist, compression rate muss noch festgelegt werden.
    367374    cut(list, targetSize);
     375   
     376    //now sort again after objDataOffset
     377    list->sort(boost::bind(&TrafficControl::dataSort, this, _1, _2) );
    368378//     printList(list, clientID);
    369379    //diese Funktion updateClientList muss noch gemacht werden
  • code/branches/presentation/src/network/TrafficControl.h

    r2413 r2416  
    123123    unsigned int currentClientID;
    124124    unsigned int targetSize;
     125    bool         bActive_;
    125126    /**
    126127    *copiedVector is a copy of the given Vector by the GSmanager, on this list all manipulations are performed
     
    169170    void deleteObject(unsigned int objectID);                           // this function gets called when an object has been deleted (in order to clean up lists and maps)
    170171   
    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);
    172174    void printList(std::list<obj> *list, unsigned int clientID);
    173175    void fixCreatorDependencies(std::list<obj>::iterator it, std::list<obj> *list, unsigned int clientID);
Note: See TracChangeset for help on using the changeset viewer.