Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6654 in orxonox.OLD for branches/network/src/lib


Ignore:
Timestamp:
Jan 23, 2006, 12:08:34 PM (19 years ago)
Author:
patrick
Message:

network: synchronizeable and network manager start of new concept implementation

Location:
branches/network/src/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/graphics/importer/vertex_array_model.cc

    r6519 r6654  
    305305    this->addColor(.125,.436,.246); ///FIXME
    306306  }
     307
    307308  for (unsigned int loopNumber = 0; loopNumber <= loops; ++loopNumber)
    308309  {
     
    326327    }
    327328  }
     329
    328330  for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
    329331  {
     
    331333    this->addIndice(segmentsPerLoop + loopSegmentNumber);
    332334  }
     335
    333336  for (unsigned int loopNumber = 0; loopNumber < loops; ++loopNumber)
    334337  {
  • branches/network/src/lib/network/network_manager.cc

    r6341 r6654  
    4949  this->netStreamList = NULL;
    5050  this->syncList = NULL;
    51   this->tmpStream = NULL;
     51  this->defaultSyncStream = NULL;
    5252
    5353  this->hostID = -1;
     
    9898  }
    9999
    100   this->tmpStream = new NetworkStream(ipAddress);
     100  this->defaultSyncStream = new NetworkStream(ipAddress);
    101101  return 1;
    102102}
     
    111111  this->hostID = 0;
    112112  this->bGameServer = true;
    113   this->tmpStream = new NetworkStream(port);
     113  this->defaultSyncStream = new NetworkStream(port);
    114114  this->bGameServer = true;
    115115  SDL_Delay(20);
     
    126126{
    127127  /* creating a new network stream, it will register itself automaticaly to the class list */
    128   this->tmpStream = new NetworkStream(address);
    129   this->tmpStream->connectSynchronizeable(sync);
     128  this->defaultSyncStream = new NetworkStream(address);
     129  this->defaultSyncStream->connectSynchronizeable(sync);
    130130}
    131131
     
    142142void NetworkManager::connectSynchronizeable(Synchronizeable& sync)
    143143{
    144   this->tmpStream->connectSynchronizeable(sync);
     144  this->defaultSyncStream->connectSynchronizeable(sync);
    145145}
    146146
  • branches/network/src/lib/network/network_manager.h

    r6341 r6654  
    5151    void synchronize();
    5252
     53    inline NetworkStream* getDefaultSyncStream() { return this->defaultSyncStream; }
     54
     55
    5356  private:
    5457    NetworkManager();
     
    5962    const std::list<BaseObject*>*    syncList;                // list of synchronizeables
    6063    static NetworkManager*           singletonRef;            //!< Pointer to the only instance of this Class
    61     NetworkStream*                   tmpStream;               //!< FIXME: this is only for testing purposes
     64    NetworkStream*                   defaultSyncStream;       //!< FIXME: this is only for testing purposes
    6265    int                              hostID;                  //!< The Host-ID of the Manager
    6366    bool                             bGameServer;             //!< true if it is a server
  • branches/network/src/lib/network/synchronizeable.h

    r6341 r6654  
    163163
    164164class Synchronizeable : virtual public BaseObject
    165   {
     165{
     166
    166167  public:
    167168    Synchronizeable();
     
    179180    bool isOutOfSync();
    180181    bool requestedSync();
     182
    181183    inline void setUniqueID( int id ){ uniqueID = id; }
    182     inline int  getUniqueID() const { return uniqueID; };
     184    inline int  getUniqueID() const { return uniqueID; }
     185    inline int getHostID() { return this->hostID; }
     186
     187    inline int getOwner(){ return owner; }
     188    inline void setOwner(int owner){ this->owner = owner; }
     189
     190    /** @returns true if this Synchronizeable has to be synchronized over network */
     191    inline bool beSynchronized() { return this->bSynchronize; }
     192    /** @param bSynchronize sets the Synchronizeable to be sunchronized or not */
     193    inline void setSynchronized(bool bSynchronize) { this->bSynchronize = bSynchronize; }
     194
    183195    inline void requestSync( int hostID ){ this->synchronizeRequests.push_back( hostID ); }
    184196    inline int getRequestSync( void ){ if ( this->synchronizeRequests.size()>0 ){ int n = *(synchronizeRequests.begin()); synchronizeRequests.pop_front(); return n; } else { return -1; } };
    185     inline int getHostID() { return this->hostID; }
    186 
    187     inline int getOwner(){ return owner; }
    188     inline void setOwner(int owner){ this->owner = owner; }
    189197
    190198    inline void setNetworkStream(NetworkStream* stream) { this->networkStream = stream; }
    191199
     200
     201  protected:
     202    NetworkStream*    networkStream;
     203    int               state;
     204
     205
    192206  private:
    193 
    194207    int               uniqueID;
    195 
    196 
    197 
    198     //static std::vector<Synchronizeable*> classList;
    199     int owner;
    200     int hostID;
     208    int               owner;
     209    int               hostID;
     210    bool              bSynchronize;
    201211
    202212    std::list<int> synchronizeRequests;
    203213
    204   protected:
    205     NetworkStream* networkStream;
    206     int state;
    207 
    208   };
     214};
    209215#endif /* _SYNCHRONIZEABLE_H */
Note: See TracChangeset for help on using the changeset viewer.