Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2009, 10:23:58 PM (15 years ago)
Author:
rgrieder
Message:

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
Location:
code/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/network/packet/Acknowledgement.cc

    r5781 r6417  
    3838#define _PACKETID           0
    3939#define _ACKID              _PACKETID + sizeof(packet::Type::Value)
    40  
     40
    4141Acknowledgement::Acknowledgement( unsigned int id, unsigned int clientID )
    4242 : Packet()
  • code/trunk/src/libraries/network/packet/Chat.cc

    r5781 r6417  
    3535namespace orxonox {
    3636namespace packet {
    37  
     37
    3838#define   PACKET_FLAGS_CHAT PacketFlag::Reliable
    3939#define   _PACKETID         0
  • code/trunk/src/libraries/network/packet/ClassID.cc

    r5929 r6417  
    4848ClassID::ClassID( ) : Packet(){
    4949  Identifier *id;
    50   std::string classname;
    5150  unsigned int nrOfClasses=0;
    5251  unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nrofclasses
     
    5857  std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapBegin();
    5958  for(;it != Identifier::getStringIdentifierMapEnd();++it){
    60     id = (*it).second;
     59    id = it->second;
    6160    if(id == NULL || !id->hasFactory())
    6261      continue;
    63     classname = id->getName();
     62    const std::string& classname = id->getName();
    6463    network_id = id->getNetworkID();
    6564    // now push the network id and the classname to the stack
  • code/trunk/src/libraries/network/packet/ClassID.h

    r6073 r6417  
    3636namespace packet {
    3737
    38  
     38
    3939/**
    4040    @author
  • code/trunk/src/libraries/network/packet/DeleteObjects.cc

    r5781 r6417  
    4141#define _QUANTITY           _PACKETID + sizeof(Type::Value)
    4242#define _OBJECTIDS          _QUANTITY + sizeof(uint32_t)
    43  
     43
    4444DeleteObjects::DeleteObjects()
    4545 : Packet()
     
    7171  for(unsigned int i=0; i<number; i++){
    7272    unsigned int temp = Synchronisable::popDeletedObject();
    73 //     assert(temp<10000); //ugly hack
    7473    *reinterpret_cast<uint32_t*>(tdata) = temp;
    75     COUT(4) << temp << " ";
     74    COUT(4) << temp << ' ';
    7675    tdata += sizeof(uint32_t);
    7776  }
  • code/trunk/src/libraries/network/packet/FunctionCalls.cc

    r5781 r6417  
    3636namespace orxonox {
    3737namespace packet {
    38  
     38
    3939#define   PACKET_FLAGS_FUNCTIONCALLS PacketFlag::Reliable
    4040#define   _PACKETID         0
    4141const unsigned int FUNCTIONCALLS_MEM_ALLOCATION = 1000;
    42    
     42
    4343FunctionCalls::FunctionCalls()
    4444 : Packet()
     
    171171void FunctionCalls::addCallStatic( uint32_t networkID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){
    172172  assert(!isDataENetAllocated());
    173  
     173
    174174  // first determine the size that has to be reserved for this call
    175175  uint32_t callsize = 2*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and for bool isStatic
     
    200200    }
    201201  }
    202  
     202
    203203  // now allocated mem if neccessary
    204204  if( currentSize_ + callsize > currentMemBlocks_*FUNCTIONCALLS_MEM_ALLOCATION )
     
    210210    data_ = temp;
    211211  }
    212  
     212
    213213  // now serialise the mt values and copy the function id and isStatic
    214214  uint8_t* temp = data_+currentSize_;
     
    240240  //currentSize_ += callsize;
    241241  currentSize_ = temp-data_;
    242  
     242
    243243}
    244244
    245245void FunctionCalls::addCallMember( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){
    246246  assert(!isDataENetAllocated());
    247  
     247
    248248  // first determine the size that has to be reserved for this call
    249249  uint32_t callsize = 3*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and the objectID
     
    274274    }
    275275  }
    276  
     276
    277277  // now allocated mem if neccessary
    278278  if( currentSize_ + callsize > currentMemBlocks_*FUNCTIONCALLS_MEM_ALLOCATION )
     
    284284    data_ = temp;
    285285  }
    286  
     286
    287287  // now serialise the mt values and copy the function id
    288288  uint8_t* temp = data_+currentSize_;
     
    314314  }
    315315  currentSize_ += callsize;
    316  
     316
    317317}
    318318
  • code/trunk/src/libraries/network/packet/FunctionIDs.cc

    r5781 r6417  
    4747
    4848FunctionIDs::FunctionIDs( ) : Packet(){
    49   std::string functionname;
    50   unsigned int nrOfFunctions=0;
     49  unsigned int nrOfFunctions=0;
    5150  unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nroffunctions
    5251  uint32_t networkID;
    5352  flags_ = flags_ | PACKET_FLAGS_FUNCTIONIDS;
    5453  std::queue<std::pair<uint32_t, std::string> > tempQueue;
    55  
     54
    5655  //calculate total needed size (for all strings and integers)
    5756  ObjectList<NetworkFunctionBase>::iterator it;
    5857  for(it = ObjectList<NetworkFunctionBase>::begin(); it; ++it){
    59     functionname = it->getName();
     58    const std::string& functionname = it->getName();
    6059    networkID = it->getNetworkID();
    6160    // now push the network id and the classname to the stack
     
    6463    packetSize += (functionname.size()+1)+sizeof(uint32_t)+sizeof(uint32_t); // reserver size for the functionname string, the functionname length and the networkID
    6564  }
    66  
     65
    6766  this->data_=new uint8_t[ packetSize ];
    6867  //set the appropriate packet id
    6968  assert(this->data_);
    7069  *(Type::Value *)(this->data_ + _PACKETID ) = Type::FunctionIDs;
    71  
     70
    7271  uint8_t *temp=data_+sizeof(uint32_t);
    7372  // save the number of all classes
    7473  *(uint32_t*)temp = nrOfFunctions;
    7574  temp += sizeof(uint32_t);
    76  
     75
    7776  // now save all classids and classnames
    7877  std::pair<uint32_t, std::string> tempPair;
     
    8584    temp+=2*sizeof(uint32_t)+tempPair.second.size()+1;
    8685  }
    87  
     86
    8887  COUT(5) << "FunctionIDs packetSize is " << packetSize << endl;
    89  
     88
    9089}
    9190
     
    106105  temp += sizeof(uint32_t);
    107106  totalsize += sizeof(uint32_t); // storage size for nr of all classes
    108  
     107
    109108  for(unsigned int i=0; i<nrOfFunctions; i++){
    110109    totalsize += 2*sizeof(uint32_t) + *(uint32_t*)(temp + sizeof(uint32_t)); // for each network function add size for id, sizeof(string) and length of string itself to totalsize
     
    121120  uint32_t stringsize;
    122121  unsigned char *functionname;
    123  
     122
    124123  COUT(4) << "=== processing functionids: " << endl;
    125124  std::pair<uint32_t, std::string> tempPair;
     
    127126  nrOfFunctions = *(uint32_t*)temp;
    128127  temp += sizeof(uint32_t);
    129  
     128
    130129  for( int i=0; i<nrOfFunctions; i++){
    131130    networkID = *(uint32_t*)temp;
  • code/trunk/src/libraries/network/packet/FunctionIDs.h

    r6073 r6417  
    3636namespace packet {
    3737
    38  
     38
    3939/**
    4040    @author
  • code/trunk/src/libraries/network/packet/Gamestate.cc

    r5929 r6417  
    9595    return false;
    9696  }
    97  
     97
    9898  // create the header object
    9999  assert( header_ == 0 );
     
    105105  ObjectList<Synchronisable>::iterator it;
    106106  for(it = ObjectList<Synchronisable>::begin(); it; ++it){
    107    
     107
    108108//     tempsize=it->getSize(id, mode);
    109109
     
    111111    if ( tempsize != 0 )
    112112      dataVector_.push_back( obj(it->getObjectID(), it->getCreatorID(), tempsize, mem-data_) );
    113    
     113
    114114#ifndef NDEBUG
    115115    if(currentsize+tempsize > size){
     
    362362  assert(!header_->isCompressed() && !base->header_->isCompressed());
    363363  assert(!header_->isDiffed());
    364  
     364
    365365  uint8_t *basep = GAMESTATE_START(base->data_);
    366366  uint8_t *gs = GAMESTATE_START(this->data_);
    367367  uint32_t dest_length = header_->getDataSize();
    368  
     368
    369369  if(dest_length==0)
    370370    return NULL;
    371  
     371
    372372  uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
    373373  uint8_t *dest = GAMESTATE_START(ndata);
    374  
     374
    375375  rawDiff( dest, gs, basep, header_->getDataSize(), base->header_->getDataSize() );
    376376#ifndef NDEBUG
     
    398398  assert(!header_->isCompressed() && !base->header_->isCompressed());
    399399  assert(header_->isDiffed());
    400  
     400
    401401  uint8_t *basep = GAMESTATE_START(base->data_);
    402402  uint8_t *gs = GAMESTATE_START(this->data_);
    403403  uint32_t dest_length = header_->getDataSize();
    404  
     404
    405405  if(dest_length==0)
    406406    return NULL;
    407  
     407
    408408  uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
    409409  uint8_t *dest = ndata + GamestateHeader::getSize();
    410  
     410
    411411  rawDiff( dest, gs, basep, header_->getDataSize(), base->header_->getDataSize() );
    412  
     412
    413413  Gamestate *g = new Gamestate(ndata, getClientID());
    414414  assert(g->header_);
     
    437437//   uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
    438438//   uint8_t *dest = ndata + GamestateHeader::getSize();
    439 //   
    440 //   
     439//
     440//
    441441//   // LOOP-UNROLLED DIFFING
    442442//   uint32_t *dest32 = (uint32_t*)dest, *base32 = (uint32_t*)basep, *gs32 = (uint32_t*)gs;
     
    465465//     }
    466466//   }
    467 // 
     467//
    468468//   Gamestate *g = new Gamestate(ndata, getClientID());
    469469//   *(g->header_) = *header_;
     
    481481  uint64_t* bd = (uint64_t*)basedata;
    482482  uint64_t* nd = (uint64_t*)newdata;
    483  
     483
    484484  unsigned int i;
    485485  for( i=0; i<datalength/8; i++ )
     
    529529//   COUT(0) << "myvector contains:";
    530530//   for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ )
    531 //     COUT(0) << " " << (*itt).objID;
     531//     COUT(0) << ' ' << (*itt).objID;
    532532//   COUT(0) << endl;
    533533  for(it=dataVector_.begin(); it!=dataVector_.end();){
    534534    SynchronisableHeader oldobjectheader(origdata);
    535535    SynchronisableHeader newobjectheader(newdata);
    536     if ( (*it).objSize == 0 )
     536    if ( it->objSize == 0 )
    537537    {
    538538      ++it;
     
    541541    objectsize = oldobjectheader.getDataSize();
    542542    objectOffset=SynchronisableHeader::getSize(); //skip the size and the availableData variables in the objectheader
    543     if ( (*it).objID == oldobjectheader.getObjectID() ){
     543    if ( it->objID == oldobjectheader.getObjectID() ){
    544544      memcpy(newdata, origdata, objectsize);
    545545      assert(newobjectheader.isDataAvailable()==true);
  • code/trunk/src/libraries/network/packet/Packet.cc

    r6105 r6417  
    101101@brief
    102102    Destroys a packet completely.
    103    
    104     That also means destroying the ENetPacket if one exists. There 
     103
     104    That also means destroying the ENetPacket if one exists. There
    105105*/
    106106Packet::~Packet(){
Note: See TracChangeset for help on using the changeset viewer.