Changeset 6341 in orxonox.OLD for trunk/src/lib/network/synchronizeable.cc
- Timestamp:
- Dec 30, 2005, 1:57:12 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/synchronizeable.cc
r6145 r6341 28 28 Synchronizeable::Synchronizeable() 29 29 { 30 30 this->setClassID(CL_SYNCHRONIZEABLE, "Synchronizeable"); 31 31 owner = 0; 32 state = 0; 32 33 hostID = NetworkManager::getInstance()->getHostID(); 34 this->setIsServer(this->hostID == 0); 33 35 uniqueID = -1; 34 36 this->networkStream = NULL; 35 //state = ?; 36 37 this->setRequestedSync( false ); 37 38 } 38 39 39 /**40 * default constructor41 */42 Synchronizeable::Synchronizeable(const char* name)43 {44 this->setName(name);45 this->networkStream = NULL;46 }47 40 48 41 … … 59 52 * write data to NetworkStream 60 53 */ 61 void Synchronizeable::writeBytes(const byte* data, int length)54 int Synchronizeable::writeBytes(const byte* data, int length, int sender) 62 55 { 63 PRINTF( 1)("Synchronizeable::writeBytes was called\n");56 PRINTF(5)("Synchronizeable::writeBytes was called\n"); 64 57 } 65 58 … … 69 62 int Synchronizeable::readBytes(byte* data, int maxLength, int * reciever) 70 63 { 71 PRINTF( 1)("Synchronizeable::readBytes was called\n");64 PRINTF(5)("Synchronizeable::readBytes was called\n"); 72 65 } 73 66 … … 103 96 else 104 97 this->state = this->state & (~STATE_OUTOFSYNC); 98 //PRINTF(0)("isoutofsync %s %d\n", this->getClassName(), state); 105 99 } 106 100 … … 111 105 bool Synchronizeable::isServer() 112 106 { 113 return this->state & STATE_SERVER == STATE_SERVER;107 return (this->state & STATE_SERVER) >0; 114 108 } 115 109 … … 120 114 bool Synchronizeable::isOutOfSync() 121 115 { 122 return this->state & STATE_OUTOFSYNC == STATE_OUTOFSYNC; 116 return (this->state & STATE_OUTOFSYNC) >0; 117 } 118 119 /** 120 * Determines if the requestedSync flag is set 121 * @return true, if the requestedSync flag is true, false else 122 */ 123 bool Synchronizeable::requestedSync() 124 { 125 return (this->state & STATE_REQUESTEDSYNC) >0; 126 } 127 128 /** 129 * Sets the requestedsync flag to a given value 130 * @param requestedSync: the boolean value which the requestedsync flag is to set to 131 */ 132 void Synchronizeable::setRequestedSync( bool requestedSync ) 133 { 134 if( requestedSync ) 135 this->state = this->state | STATE_REQUESTEDSYNC; 136 else 137 this->state = this->state & (~STATE_REQUESTEDSYNC); 123 138 } 124 139
Note: See TracChangeset
for help on using the changeset viewer.