Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6695 in orxonox.OLD for trunk/src/lib/network/synchronizeable.cc


Ignore:
Timestamp:
Jan 25, 2006, 2:39:53 PM (18 years ago)
Author:
patrick
Message:

merged the network branche to the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/synchronizeable.cc

    r6424 r6695  
    1717#define DEBUG_MODULE_NETWORK
    1818
     19#include "shared_network_data.h"
     20#include "network_stream.h"
     21#include "netdefs.h"
     22
     23#include "state.h"
     24
     25#include "assert.h"
     26
    1927#include "synchronizeable.h"
    20 #include "netdefs.h"
    21 #include "network_manager.h"
    22 #include "network_stream.h"
     28
    2329
    2430
     
    2935{
    3036  this->setClassID(CL_SYNCHRONIZEABLE, "Synchronizeable");
    31   owner = 0;
    32   state = 0;
    33   hostID = NetworkManager::getInstance()->getHostID();
     37  this->owner = 0;
     38  this->state = 0;
     39  this->hostID = SharedNetworkData::getInstance()->getHostID();
    3440  this->setIsServer(this->hostID == 0);
    35   uniqueID = -1;
     41  this->uniqueID = NET_UID_UNASSIGNED;
    3642  this->networkStream = NULL;
    3743  this->setRequestedSync( false );
    3844  this->setIsOutOfSync( !(this->isServer()) );
     45  this->bSynchronize = false;
     46
     47  if( State::isOnline())
     48  {
     49    NetworkStream* nd = SharedNetworkData::getInstance()->getDefaultSyncStream();
     50    assert(nd != NULL);
     51    nd->connectSynchronizeable(*this);
     52    this->setUniqueID(SharedNetworkData::getInstance()->getNewUniqueID());
     53  }
    3954}
    4055
     
    5065}
    5166
     67
    5268/**
    5369 *  write data to NetworkStream
     
    5773  PRINTF(5)("Synchronizeable::writeBytes was called\n");
    5874}
     75
    5976
    6077/**
     
    87104}
    88105
     106
    89107/**
    90108 * Sets the outofsync flag to a given value
     
    100118}
    101119
     120
    102121/**
    103122 * Determines if the server flag is set
     
    108127  return (this->state & STATE_SERVER) >0;
    109128}
     129
    110130
    111131/**
     
    118138}
    119139
     140
    120141/**
    121142 * Determines if the requestedSync flag is set
     
    126147  return (this->state & STATE_REQUESTEDSYNC) >0;
    127148}
     149
    128150
    129151/**
Note: See TracChangeset for help on using the changeset viewer.