Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2008, 6:01:13 PM (16 years ago)
Author:
landauf
Message:

Merged objecthierarchy2 into presentation branch

Couln't merge 2 lines in Gamestate.cc and a whole block of code in GSDedicated.cc (it seems like oli implemented in both branches something like a network-tick-limiter but with different approaches)

Not yet tested in network mode and with bots
The SpaceShips movement is also not yet fully adopted to the new physics (see Engine class)

Location:
code/branches/presentation
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/network/packet/Acknowledgement.h

    r2171 r2485  
    3232#include "Packet.h"
    3333
     34const unsigned int ACKID_NACK = 0;
    3435
    3536namespace orxonox {
  • code/branches/presentation/src/network/packet/Gamestate.cc

    r2476 r2485  
    3131#include "../synchronisable/Synchronisable.h"
    3232#include "../TrafficControl.h"
     33#include "core/Core.h"
    3334#include "core/CoreIncludes.h"
    3435#include "core/Iterator.h"
     
    151152    if(!s)
    152153    {
    153       Synchronisable::fabricate(mem, mode);
     154      if (!Core::isMaster())
     155        Synchronisable::fabricate(mem, mode);
     156      else
     157        mem += objectheader->size;
    154158//         COUT(0) << "could not fabricate synchronisable: " << objectheader->objectID << " classid: " << objectheader->classID << " creator: " << objectheader->creatorID << endl;
    155159//       else
     
    170174      if (it->objectMode_ != 0x0) {
    171175        COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
     176        COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
    172177        assert(false);
    173178      }
     
    384389  //call TrafficControl
    385390  TrafficControl::getInstance()->processObjectList( clientID, HEADER->id, &dataMap_ );
    386  
     391
    387392  //copy in the zeros
    388393  for(it=dataMap_.begin(); it!=dataMap_.end();){
    389394//    if((*it).objSize==0)
    390395//      continue;
     396//    if(it->second->getSize(HEADER->id)==0) // merged from objecthierarchy2, doesn't work anymore; TODO: change this
     397//      continue;                            // merged from objecthierarchy2, doesn't work anymore; TODO: change this
    391398    oldobjectheader = (synchronisableHeader*)origdata;
    392399    newobjectheader = (synchronisableHeader*)newdata;
  • code/branches/presentation/src/network/packet/Packet.cc

    r2171 r2485  
    129129      return false;
    130130    }
    131     // Assures we don't create a packet and destroy it right after in another thread
    132     // without having a reference in the packetMap_
    133     boost::recursive_mutex::scoped_lock lock(Packet::packetMap_mutex);
    134131    // We deliver ENet the data address so that it doesn't memcpy everything again.
    135132    // --> We have to delete data_ ourselves!
     
    138135    // Add the packet to a global list so we can access it again once enet calls our
    139136    // deletePacket method. We can of course only give a one argument function to the ENet C library.
    140     packetMap_[(size_t)(void*)enetPacket_] = this;
     137    {
     138      // Assures we don't create a packet and destroy it right after in another thread
     139      // without having a reference in the packetMap_
     140      boost::recursive_mutex::scoped_lock lock(Packet::packetMap_mutex);
     141      packetMap_[(size_t)(void*)enetPacket_] = this;
     142    }
    141143  }
    142144#ifndef NDEBUG
  • code/branches/presentation/src/network/packet/Welcome.cc

    r2483 r2485  
    4343#define _CLIENTID             _PACKETID + sizeof(ENUM::Type)
    4444#define _ENDIANTEST           _CLIENTID + sizeof(uint32_t)
    45  
     45
    4646  Welcome::Welcome( uint32_t clientID, uint32_t shipID )
    4747 : Packet()
     
    7474
    7575bool Welcome::process(){
    76   uint32_t shipID, clientID;
     76  uint32_t clientID;
    7777  clientID = *(uint32_t *)(data_ + _CLIENTID );
    7878  assert(*(uint32_t *)(data_ + _ENDIANTEST ) == 0xFEDC4321);
Note: See TracChangeset for help on using the changeset viewer.