Changeset 6273 in orxonox.OLD for branches/network/src/lib/network/synchronizeable.h
- Timestamp:
- Dec 23, 2005, 5:30:22 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/synchronizeable.h
r6250 r6273 9 9 #include "base_object.h" 10 10 #include "netdefs.h" 11 #include "converter.h" 11 12 12 13 … … 18 19 #define STATE_SERVER 1 19 20 #define STATE_OUTOFSYNC 2 21 #define STATE_REQUESTEDSYNC 4 22 23 //macros to help writing data in byte buffer 24 #define SYNCHELP_WRITE_BEGIN() { int __synchelp_write_i = 0; \ 25 bool __synchelp_write_err = false; \ 26 int __synchelp_write_n; } 27 #define SYNCHELP_WRITE_RESET() { __synchelp_write_i = 0; __synchelp_write_err = false; } 28 #define SYNCHELP_WRITE_INT(i) { __synchelp_write_n = } 29 #define SYNCHELP_WIRTE_FLOAT() 30 #define SYNCHELP_WRITE_BYTE() 31 #define SYNCHELP_WRITE_STRING() 20 32 21 33 class NetworkStream; … … 35 47 void setIsServer( bool isServer ); 36 48 void setIsOutOfSync( bool outOfSync ); 49 void setRequestedSync( bool requestedSync ); 37 50 bool isServer(); 38 51 bool isOutOfSync(); 39 void setUniqueID( int id ){ uniqueID = id; } 40 int getUniqueID() const { return uniqueID; }; 41 void requestSync( int hostID ){ this->synchronizeRequests.push_back( hostID ); } 52 bool requestedSync(); 53 inline void setUniqueID( int id ){ uniqueID = id; } 54 inline int getUniqueID() const { return uniqueID; }; 55 inline void requestSync( int hostID ){ this->synchronizeRequests.push_back( hostID ); } 56 inline int getRequestSync( void ){ if ( this->synchronizeRequests.size()>0 ){ int n = *(synchronizeRequests.begin()); synchronizeRequests.pop_front(); return n; } else { return -1; } }; 57 inline int getHostID() { return this->hostID; } 42 58 43 59 inline int getOwner(){ return owner; } … … 55 71 int owner; 56 72 int hostID; 57 int state; 73 58 74 std::list<int> synchronizeRequests; 59 75 60 76 protected: 61 77 NetworkStream* networkStream; 78 int state; 62 79 63 80 };
Note: See TracChangeset
for help on using the changeset viewer.