Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2381


Ignore:
Timestamp:
Dec 10, 2008, 3:02:14 PM (16 years ago)
Author:
scheusso
Message:

corrected some problem with scheduling and cutting (in trafficcontrol)

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

Legend:

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

    r2371 r2381  
    184184    }
    185185    temp->setGamestateID(gamestateID);
     186    TrafficControl::processAck(clientID, gamestateID);
    186187    return true;
    187188  }
  • code/branches/presentation/src/network/TrafficControl.cc

    r2378 r2381  
    128128        }
    129129       
    130         void TrafficControl::processAck(unsigned int clientID, unsigned int gamestateID)
     130        void TrafficControl::ack(unsigned int clientID, unsigned int gamestateID)
    131131        {
    132132          std::list<obj>::iterator itvec;  // iterator to iterate through the acked objects
     
    146146      else
    147147      {
     148        assert(0);
    148149        clientListPerm_[clientID][(*itvec).objID].objCurGS = gamestateID;
    149150        clientListPerm_[clientID][(*itvec).objID].objID = (*itvec).objID;
     
    226227//     for(itvec = list.begin(); itvec!=list.end(), itvec++)
    227228//     {
    228 //       ittempgs.insert(itvec);
     229//       ittempgs.insert(itvec);static
    229230//     }
    230231  }
     
    237238  {
    238239    unsigned int size=0;
    239     std::list<obj>::iterator itvec;
     240    std::list<obj>::iterator itvec, ittemp;
    240241    assert(!list->empty());
    241     itvec = list->begin();
    242     for(itvec = list->begin(); ( itvec != list->end() ) && ( size<targetsize ); itvec++)
     242    for(itvec = list->begin(); itvec != list->end();)
    243243    {
    244244      assert( (*itvec).objSize < 1000);
    245       COUT(0) << "==targetsize==  " << targetsize << endl;
     245//       COUT(0) << "==targetsize==  " << targetsize << endl;
    246246      if ( ( size + (*itvec).objSize ) < targetsize )
    247247      {
     248//         COUT(0) << "no cut" << endl;
    248249        size += (*itvec).objSize;//objSize is given in bytes
     250        ++itvec;
    249251      }
    250252      else
    251253      {
    252         clientListPerm_[currentClientID][(*itvec).objID].objValueSched -= SCHED_PRIORITY_OFFSET;
     254//         COUT(0) << "cut" << endl;
     255        clientListPerm_[currentClientID][(*itvec).objID].objValueSched += SCHED_PRIORITY_OFFSET; // NOTE: SCHED_PRIORITY_OFFSET is negative
     256//         ittemp = itvec;
    253257        list->erase(itvec++);
    254       }
     258//         itvec = ittemp;
     259      }
     260//       printList(list, currentClientID);
    255261    }
    256262    assert(!list->empty());
     
    361367    COUT(0) << "=========== Objectlist ===========" << endl;
    362368    for( it=list->begin(); it!=list->end(); it++)
    363       COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << endl;
     369      COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << " size: " << (*it).objSize << endl;
    364370  }
    365371 
  • code/branches/presentation/src/network/TrafficControl.h

    r2371 r2381  
    5252      uint32_t objDiffGS;//difference between current and latest GameState
    5353      uint32_t objSize;
    54       unsigned int objValuePerm;
    55       unsigned int objValueSched;
     54      int objValuePerm;
     55      int objValueSched;
    5656      objInfo(uint32_t ID, uint32_t creatorID, int32_t curGsID, int32_t diffGsID, uint32_t size, unsigned int prioperm, unsigned int priosched);
    5757      objInfo();
     
    139139    */
    140140    void evaluateList(unsigned int clientID, std::list<obj> *list);//done   
     141    void ack(unsigned int clientID, unsigned int gamestateID);  // this function gets called when the server receives an ack from the client
    141142
    142143  protected:
     
    154155    void processObjectList(unsigned int clientID, unsigned int gamestateID, std::list<obj>* list); //gets a pointer to the list (containing objectIDs) and sorts it
    155156    //done
    156     void processAck(unsigned int clientID, unsigned int gamestateID);   // this function gets called when the server receives an ack from the client
     157    static void processAck(unsigned int clientID, unsigned int gamestateID)
     158    { return instance_->ack(clientID, gamestateID); }
    157159    //done
    158160    void deleteObject(unsigned int objectID);                           // this function gets called when an object has been deleted (in order to clean up lists and maps)
Note: See TracChangeset for help on using the changeset viewer.