Changeset 6331 in orxonox.OLD for branches/network
- Timestamp:
- Dec 29, 2005, 5:37:00 PM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/coord/p_node.cc
r6142 r6331 27 27 #include "glincl.h" 28 28 #include "color.h" 29 30 #include "synchronizeable.h" 29 31 30 32 using namespace std; … … 1003 1005 return (PNODE_ROTATE_AND_MOVE); 1004 1006 } 1007 1008 /** 1009 * Writes data from network containing information about the state 1010 * @param data pointer to data 1011 * @param length length of data 1012 * @param sender hostID of sender 1013 */ 1014 int PNode::writeState( const byte * data, int length, int sender ) 1015 { 1016 SYNCHELP_READ_BEGIN(); 1017 1018 char * name; 1019 SYNCHELP_READ_STRINGM( name ); 1020 1021 char * parentName = NULL; 1022 SYNCHELP_READ_STRINGM( parentName ); 1023 1024 if ( strcmp(parentName, "")==0 ) 1025 { 1026 setParent( (char*)NULL ); 1027 } 1028 else 1029 { 1030 setParent( parentName ); 1031 } 1032 1033 delete[] parentName; 1034 1035 int parentMode; 1036 SYNCHELP_READ_INT( parentMode ); 1037 this->setParentMode((PARENT_MODE)parentMode); 1038 1039 if ( strcmp(name, "")==0 ) 1040 { 1041 this->setName( NULL ); 1042 } 1043 else 1044 { 1045 this->setName( name ); 1046 } 1047 delete name; 1048 name = NULL; 1049 1050 float f1, f2, f3, f4; 1051 1052 SYNCHELP_READ_FLOAT( f1 ); 1053 SYNCHELP_READ_FLOAT( f2 ); 1054 SYNCHELP_READ_FLOAT( f3 ); 1055 this->setRelCoor( f1, f2, f3 ); 1056 1057 PRINTF(0)("%f %f %f\n", f1, f2, f3); 1058 1059 SYNCHELP_READ_FLOAT( f1 ); 1060 SYNCHELP_READ_FLOAT( f2 ); 1061 SYNCHELP_READ_FLOAT( f3 ); 1062 this->setAbsCoor( f1, f2, f3 ); 1063 1064 PRINTF(0)("%f %f %f\n", f1, f2, f3); 1065 1066 SYNCHELP_READ_FLOAT( f1 ); 1067 SYNCHELP_READ_FLOAT( f2 ); 1068 SYNCHELP_READ_FLOAT( f3 ); 1069 SYNCHELP_READ_FLOAT( f4 ); 1070 this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) ); 1071 1072 SYNCHELP_READ_FLOAT( f1 ); 1073 SYNCHELP_READ_FLOAT( f2 ); 1074 SYNCHELP_READ_FLOAT( f3 ); 1075 SYNCHELP_READ_FLOAT( f4 ); 1076 this->setAbsDir( Quaternion( Vector(f2, f3, f4), f1 ) ); 1077 1078 int n; 1079 char * childName; 1080 1081 SYNCHELP_READ_INT( n ); 1082 1083 for (int i = 0; i<n; i++) 1084 { 1085 SYNCHELP_READ_STRINGM( childName ); 1086 addChild( childName ); 1087 delete childName; 1088 childName = NULL; 1089 } 1090 1091 return SYNCHELP_READ_N; 1092 } 1093 1094 /** 1095 * data copied in data will bee sent to another host 1096 * @param data pointer to data 1097 * @param maxLength max length of data 1098 * @return the number of bytes writen 1099 */ 1100 int PNode::readState( byte * data, int maxLength ) 1101 { 1102 SYNCHELP_WRITE_BEGIN(); 1103 1104 SYNCHELP_WRITE_STRING( this->getName() ); 1105 1106 if ( this->parent ) 1107 { 1108 SYNCHELP_WRITE_STRING( parent->getName() ); 1109 } 1110 else 1111 { 1112 SYNCHELP_WRITE_STRING( "" ); 1113 } 1114 1115 SYNCHELP_WRITE_INT( this->parentMode ); 1116 1117 SYNCHELP_WRITE_FLOAT( this->relCoordinate.x ); 1118 SYNCHELP_WRITE_FLOAT( this->relCoordinate.y ); 1119 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z ); 1120 1121 PRINTF(0)("%s, %f, %f, %f\n", getClassName(), relCoordinate.x, relCoordinate.y, relCoordinate.z); 1122 1123 SYNCHELP_WRITE_FLOAT( this->absCoordinate.x ); 1124 SYNCHELP_WRITE_FLOAT( this->absCoordinate.y ); 1125 SYNCHELP_WRITE_FLOAT( this->absCoordinate.z ); 1126 1127 PRINTF(0)("%s, %f, %f, %f\n", getClassName(), absCoordinate.x, absCoordinate.y, absCoordinate.z); 1128 1129 SYNCHELP_WRITE_FLOAT( this->relDirection.w ); 1130 SYNCHELP_WRITE_FLOAT( this->relDirection.v.x ); 1131 SYNCHELP_WRITE_FLOAT( this->relDirection.v.y ); 1132 SYNCHELP_WRITE_FLOAT( this->relDirection.v.z ); 1133 1134 SYNCHELP_WRITE_FLOAT( this->absDirection.w ); 1135 SYNCHELP_WRITE_FLOAT( this->absDirection.v.x ); 1136 SYNCHELP_WRITE_FLOAT( this->absDirection.v.y ); 1137 SYNCHELP_WRITE_FLOAT( this->absDirection.v.z ); 1138 1139 int n = children.size(); 1140 SYNCHELP_WRITE_INT( n ); 1141 1142 for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++) 1143 { 1144 SYNCHELP_WRITE_STRING( (*it)->getName() ); 1145 } 1146 return SYNCHELP_WRITE_N; 1147 } -
branches/network/src/lib/coord/p_node.h
r6142 r6331 178 178 static PARENT_MODE charToParentingMode(const char* parentingMode); 179 179 180 int writeState(const byte* data, int length, int sender); 181 int readState(byte* data, int maxLength ); 180 182 181 183 private: -
branches/network/src/lib/network/converter.cc
r6328 r6331 317 317 return -1; 318 318 } 319 320 //handle 0 else function will loop for ever 321 if ( x == 0 ) 322 { 323 for ( int i = 0; i<FLOATSIZE; i++) 324 a[i] = 0; 325 return FLOATSIZE; 326 } 327 319 328 int mantisse = 0; 320 329 int exponent = 128; … … 376 385 int Converter::byteArrayToFloat(const byte* a, float* x) 377 386 { 387 //handle 0 388 for (int i = 0; i<FLOATSIZE; i++) 389 { 390 if (a[i]!=0) 391 break; 392 if ( i==FLOATSIZE-1 ) 393 { 394 *x = 0.0f; 395 return FLOATSIZE; 396 } 397 } 398 399 378 400 int hmant = a[0] + a[1] * 256 + a[2] * 65536; 379 401 int mantisse = hmant % expmult; … … 441 463 int n = Converter::byteArrayToInt( a, &length ); 442 464 465 443 466 if ( length+1 > maxLength ) 444 467 { -
branches/network/src/lib/network/handshake.cc
r6190 r6331 37 37 } 38 38 39 voidHandshake::writeBytes( const byte * data, int length, int sender)39 int Handshake::writeBytes( const byte * data, int length, int sender) 40 40 { 41 41 PRINTF(5)("Handshake::writeBytes states = %d %d %d %d (%d)\n", hasState( HS_RECVD_INIT ), hasState( HS_RECVD_VER ), hasState( HS_RECVD_HID ), hasState( HS_COMPLETED ), state); 42 42 43 SYNCHELP_READ_BEGIN(); 44 43 45 if ( hasState( HS_COMPLETED ) ) 44 return ;46 return 0; 45 47 46 48 if ( !hasState( HS_RECVD_INIT ) ) … … 50 52 PRINTF(0)("initial packet has wrong size %d instead of %d\n", length, _INITIAL_DATA_LENGTH); 51 53 setState( HS_COMPLETED ); 52 return ;54 return 0; 53 55 } 54 56 … … 57 59 PRINTF(0)("initial packed does not match\n"); 58 60 setState( HS_COMPLETED ); 59 return ;61 return length; 60 62 } 61 63 62 64 setState( HS_RECVD_INIT ); 63 65 PRINTF(0)("got valid initial packet from client %d\n", clientId); 64 return ;66 return length; 65 67 } 66 68 … … 71 73 PRINTF(0)("version number packet has wrong size %d instead of %d\n", length, _ORXONOX_VERSION_LENGTH); 72 74 setState( HS_COMPLETED ); 73 return ;75 return 0; 74 76 } 75 77 … … 78 80 PRINTF(0)("versions do not match\n"); 79 81 setState( HS_COMPLETED ); 80 return ;82 return length; 81 83 } 82 84 … … 84 86 85 87 PRINTF(0)("client %d's version does match\n", clientId); 86 return ;88 return length; 87 89 } 88 90 89 91 if ( !isServer() && hasState( HS_RECVD_VER ) && !hasState( HS_RECVD_HID ) ) 90 92 { 91 if ( length != 2)93 if ( length != INTSIZE+INTSIZE ) 92 94 { 93 95 PRINTF(0)("hostID packet has wrong size %d instead of %d\n", length, 1); 94 96 setState( HS_COMPLETED ); 95 return ;97 return 0; 96 98 } 97 99 … … 99 101 setState( HS_RECVD_HID ); 100 102 this->isOk = true; 101 this->newHostId = data[0];102 this->newNetworkGameManagerId = data[1];103 SYNCHELP_READ_INT( this->newHostId ); 104 SYNCHELP_READ_INT( this->newNetworkGameManagerId ); 103 105 104 106 if ( newHostId == 0 ) … … 112 114 PRINTF(0)("got my hostID: %d and networkGameManagerId: %d\n", newHostId, newNetworkGameManagerId); 113 115 } 114 return ;116 return SYNCHELP_READ_N; 115 117 } 116 118 … … 120 122 { 121 123 PRINTF(5)("Handshake::readBytes states = %d %d %d %d (%d)\n", hasState( HS_SENT_INIT ), hasState( HS_SENT_VER ), hasState( HS_SENT_HID ), hasState( HS_COMPLETED ), state); 124 125 SYNCHELP_WRITE_BEGIN(); 122 126 123 127 if ( hasState( HS_COMPLETED ) ) … … 172 176 isOk = false; 173 177 //memcpy(data, (byte*)0, 4); 174 data[0] = 0; 178 SYNCHELP_WRITE_INT( 0 ); 179 SYNCHELP_WRITE_INT( 0 ); 175 180 } 176 181 else … … 178 183 isOk = true; 179 184 //memcpy(data, &clientId, 4); 180 data[0] = (byte)clientId;181 data[1] = (byte)networkGameManagerId;185 SYNCHELP_WRITE_INT( clientId ); 186 SYNCHELP_WRITE_INT( networkGameManagerId ); 182 187 } 183 188 *reciever = clientId; 184 return 2;189 return SYNCHELP_WRITE_N; 185 190 } 186 191 -
branches/network/src/lib/network/handshake.h
r6190 r6331 42 42 inline void doReject(){ setState(HS_DO_REJECT); } 43 43 44 virtual voidwriteBytes(const byte* data, int length, int sender);44 virtual int writeBytes(const byte* data, int length, int sender); 45 45 virtual int readBytes(byte* data, int maxLength, int * reciever); 46 46 virtual void writeDebug() const; -
branches/network/src/lib/network/network_game_manager.cc
r6326 r6331 41 41 42 42 /* set the class id for the base object */ 43 this->setClassID(CL_NETWORK_GAME_MANAGER, " EntityManager");43 this->setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager"); 44 44 45 45 allOutBuffer.length = 0; … … 70 70 71 71 72 voidNetworkGameManager::writeBytes(const byte* data, int length, int sender)72 int NetworkGameManager::writeBytes(const byte* data, int length, int sender) 73 73 { 74 74 int i = 0; … … 86 86 { 87 87 if ( !handleRequestCreate( i, data, length, sender ) ) 88 return ;88 return i; 89 89 continue; 90 90 } … … 92 92 { 93 93 if ( !handleRequestRemove( i, data, length, sender ) ) 94 return ;94 return i; 95 95 continue; 96 96 } … … 101 101 { 102 102 if ( !handleCreateEntity( i, data, length, sender ) ) 103 return ;103 return i; 104 104 continue; 105 105 } … … 107 107 { 108 108 if ( !handleRemoveEntity( i, data, length, sender ) ) 109 return ;109 return i; 110 110 continue; 111 111 } … … 113 113 { 114 114 if ( !handleCreateEntityList( i, data, length, sender ) ) 115 return ;115 return i; 116 116 continue; 117 117 } … … 119 119 { 120 120 if ( !handleRemoveEntityList( i, data, length, sender ) ) 121 return ;121 return i; 122 122 continue; 123 123 } … … 125 125 { 126 126 if ( !handleYouAreEntity( i, data, length, sender ) ) 127 return ;127 return i; 128 128 continue; 129 129 } … … 133 133 { 134 134 if ( !handleRequestSync( i, data, length, sender ) ) 135 return ;135 return i; 136 136 continue; 137 137 } … … 146 146 //if we get her something with data is wrong 147 147 PRINTF(1)("Data is not in the right format! i=%d\n", i); 148 return; 149 } 148 return i; 149 } 150 151 return i; 150 152 } 151 153 -
branches/network/src/lib/network/network_game_manager.h
r6301 r6331 69 69 { if (!NetworkGameManager::singletonRef) NetworkGameManager::singletonRef = new NetworkGameManager(); return NetworkGameManager::singletonRef; } 70 70 71 virtual voidwriteBytes(const byte* data, int length, int sender);71 virtual int writeBytes(const byte* data, int length, int sender); 72 72 virtual int readBytes(byte* data, int maxLength, int * reciever); 73 73 virtual void writeDebug() const; -
branches/network/src/lib/network/network_stream.cc
r6326 r6331 303 303 { 304 304 if ( *it && (*it)->getUniqueID()==header.synchronizeableID ) 305 (*it)->writeBytes(upBuffer+sizeof(header), dataLength, i); 305 { 306 if ( (*it)->writeBytes(upBuffer+sizeof(header), dataLength, i) != header.length ) 307 { 308 PRINTF(1)("%s did not read all the data!\n", (*it)->getClassName()); 309 break; 310 } 311 continue; 312 } 306 313 } 307 314 -
branches/network/src/lib/network/synchronizeable.cc
r6273 r6331 52 52 * write data to NetworkStream 53 53 */ 54 voidSynchronizeable::writeBytes(const byte* data, int length, int sender)54 int Synchronizeable::writeBytes(const byte* data, int length, int sender) 55 55 { 56 56 PRINTF(5)("Synchronizeable::writeBytes was called\n"); -
branches/network/src/lib/network/synchronizeable.h
r6285 r6331 42 42 * SYNCHELP_READ_STRINGM(s) allocates memory for string! you have to free this after 43 43 * SYNCHELP_READ_BYTE(b) 44 * SYNCHELP_READ_N 44 45 * 45 46 * … … 86 87 __synchelp_write_i++; \ 87 88 } 88 #define SYNCHELP_WRITE_STRING(s) { __synchelp_write_n = \ 89 #define SYNCHELP_WRITE_STRING(s) { if (s!=NULL) \ 90 __synchelp_write_n = \ 89 91 Converter::stringToByteArray( s, data+__synchelp_write_i, strlen(s), maxLength-__synchelp_write_i ); \ 92 else \ 93 __synchelp_write_n = \ 94 Converter::stringToByteArray( "", data+__synchelp_write_i, strlen(""), maxLength-__synchelp_write_i ); \ 90 95 if ( __synchelp_write_n <= 0) \ 91 96 { \ … … 95 100 __synchelp_write_i += __synchelp_write_n; \ 96 101 } 97 #define SYNCHELP_WRITE_N __synchelp_write_i 102 #define SYNCHELP_WRITE_N __synchelp_write_i 103 #define SYNCHELP_WRITE_FKT(f) { \ 104 __synchelp_write_i += \ 105 f( data+__synchelp_write_i, maxLength-__synchelp_write_i ); \ 106 } 98 107 99 108 … … 105 114 { \ 106 115 PRINTF(1)("There is not enough data to read an int\n"); \ 107 return ; \116 return 0; \ 108 117 } \ 109 118 __synchelp_read_i += Converter::byteArrayToInt( data+__synchelp_read_i, &i ); \ … … 113 122 { \ 114 123 PRINTF(1)("There is not enough data to read a flaot\n"); \ 115 return ; \124 return 0; \ 116 125 } \ 117 126 __synchelp_read_i += Converter::byteArrayToFloat( data+__synchelp_read_i, &f ); \ … … 122 131 { \ 123 132 PRINTF(1)("There is not enough data to read string\n"); \ 124 return ; \133 return 0; \ 125 134 } \ 126 135 __synchelp_read_i += __synchelp_read_n; \ … … 131 140 { \ 132 141 PRINTF(1)("There is not enough data to read string\n"); \ 133 return ; \142 return 0; \ 134 143 } \ 135 144 __synchelp_read_i += __synchelp_read_n; \ … … 139 148 { \ 140 149 PRINTF(1)("There is not enough data to read a byte\n"); \ 141 return ; \150 return 0; \ 142 151 } \ 143 152 b = data[__synchelp_read_i]; \ 144 153 __synchelp_read_i ++; \ 145 154 } 155 #define SYNCHELP_READ_FKT(f) { \ 156 __synchelp_read_i += \ 157 f( data+__synchelp_read_i, length-__synchelp_read_i, sender); \ 158 } 159 #define SYNCHELP_READ_N __synchelp_read_i 146 160 147 161 class NetworkStream; … … 154 168 ~Synchronizeable(); 155 169 156 virtual voidwriteBytes(const byte* data, int length, int sender);170 virtual int writeBytes(const byte* data, int length, int sender); 157 171 virtual int readBytes(byte* data, int maxLength, int * reciever); 158 172 virtual void writeDebug() const; -
branches/network/src/subprojects/network/read_sync.cc
r6190 r6331 60 60 * write data to Synchronizeable 61 61 */ 62 voidReadSync::writeBytes(const byte* data, int length, int sender)62 int ReadSync::writeBytes(const byte* data, int length, int sender) 63 63 { 64 64 PRINTF(0)("ReadSync: got %i bytes of data\n", length); -
branches/network/src/subprojects/network/read_sync.h
r6190 r6331 16 16 ~ReadSync(); 17 17 18 virtual voidwriteBytes(const byte* data, int length, int sender);18 virtual int writeBytes(const byte* data, int length, int sender); 19 19 virtual int readBytes(byte* data, int maxLength, int * reciever); 20 20 -
branches/network/src/subprojects/network/simple_sync.cc
r6190 r6331 66 66 * write data to Synchronizeable 67 67 */ 68 voidSimpleSync::writeBytes(const byte* data, int length, int sender)68 int SimpleSync::writeBytes(const byte* data, int length, int sender) 69 69 { 70 70 PRINTF(0)("SimpleSync: got %i bytes of data\n", length); -
branches/network/src/subprojects/network/simple_sync.h
r6190 r6331 16 16 ~SimpleSync(); 17 17 18 virtual voidwriteBytes(const byte* data, int length, int sender);18 virtual int writeBytes(const byte* data, int length, int sender); 19 19 virtual int readBytes(byte* data, int maxLength, int * reciever); 20 20 -
branches/network/src/subprojects/network/write_sync.cc
r6190 r6331 66 66 * write data to Synchronizeable 67 67 */ 68 voidWriteSync::writeBytes(const byte* data, int length, int sender)68 int WriteSync::writeBytes(const byte* data, int length, int sender) 69 69 { 70 70 PRINTF(0)("WriteSync: got %i bytes of data\n", length); -
branches/network/src/subprojects/network/write_sync.h
r6190 r6331 16 16 ~WriteSync(); 17 17 18 virtual voidwriteBytes(const byte* data, int length, int sender);18 virtual int writeBytes(const byte* data, int length, int sender); 19 19 virtual int readBytes(byte* data, int maxLength, int * reciever); 20 20 -
branches/network/src/world_entities/skybox.cc
r6328 r6331 220 220 } 221 221 222 voidSkyBox::writeBytes( const byte * data, int length, int sender )222 int SkyBox::writeBytes( const byte * data, int length, int sender ) 223 223 { 224 224 setRequestedSync( false ); … … 226 226 227 227 SYNCHELP_READ_BEGIN(); 228 229 SYNCHELP_READ_FKT( WorldEntity::writeState ); 230 228 231 SYNCHELP_READ_FLOAT( size ); 229 232 if ( textureName ) … … 239 242 this->setTextureAndType( textureName, "jpg" ); 240 243 this->rebuild(); 244 245 return SYNCHELP_READ_N; 241 246 } 242 247 … … 258 263 259 264 SYNCHELP_WRITE_BEGIN(); 265 266 SYNCHELP_WRITE_FKT( WorldEntity::readState ); 267 260 268 SYNCHELP_WRITE_FLOAT(this->size); 261 269 SYNCHELP_WRITE_STRING(this->textureName); -
branches/network/src/world_entities/skybox.h
r6328 r6331 41 41 const char* right, const char* front, const char* back); 42 42 43 virtual voidwriteBytes(const byte* data, int length, int sender);43 virtual int writeBytes(const byte* data, int length, int sender); 44 44 virtual int readBytes(byte* data, int maxLength, int * reciever); 45 45 virtual void writeDebug() const; -
branches/network/src/world_entities/terrain.cc
r6291 r6331 319 319 } 320 320 321 voidTerrain::writeBytes( const byte * data, int length, int sender )321 int Terrain::writeBytes( const byte * data, int length, int sender ) 322 322 { 323 323 setRequestedSync( false ); 324 324 setIsOutOfSync( false ); 325 325 326 WorldEntity::writeState(data, length, sender); 326 SYNCHELP_READ_BEGIN(); 327 SYNCHELP_READ_FKT( WorldEntity::writeState ); 328 329 return SYNCHELP_READ_N; 327 330 } 328 331 -
branches/network/src/world_entities/terrain.h
r6277 r6331 30 30 virtual ~Terrain(); 31 31 32 virtual voidwriteBytes(const byte* data, int length, int sender);32 virtual int writeBytes(const byte* data, int length, int sender); 33 33 virtual int readBytes(byte* data, int maxLength, int * reciever); 34 34 virtual void writeDebug() const; -
branches/network/src/world_entities/weapons/ground_turret.cc
r6142 r6331 19 19 20 20 #include "factory.h" 21 #include "network_game_manager.h" 21 22 #include "load_param.h" 22 23 … … 168 169 169 170 } 171 172 /** 173 * Writes data from network containing information about the state 174 * @param data pointer to data 175 * @param length length of data 176 * @param sender hostID of sender 177 */ 178 int GroundTurret::writeBytes( const byte * data, int length, int sender ) 179 { 180 setRequestedSync( false ); 181 setIsOutOfSync( false ); 182 183 SYNCHELP_READ_BEGIN(); 184 185 SYNCHELP_READ_FKT( WorldEntity::writeState ); 186 187 return SYNCHELP_READ_N; 188 } 189 190 /** 191 * data copied in data will bee sent to another host 192 * @param data pointer to data 193 * @param maxLength max length of data 194 * @return the number of bytes writen 195 */ 196 int GroundTurret::readBytes( byte * data, int maxLength, int * reciever ) 197 { 198 SYNCHELP_WRITE_BEGIN(); 199 200 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() ) 201 { 202 (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() ); 203 setRequestedSync( true ); 204 } 205 206 int rec = this->getRequestSync(); 207 if ( rec > 0 ) 208 { 209 *reciever = rec; 210 211 SYNCHELP_WRITE_FKT( WorldEntity::readState ); 212 213 } 214 215 *reciever = 0; 216 return SYNCHELP_WRITE_N; 217 } -
branches/network/src/world_entities/weapons/ground_turret.h
r5819 r6331 30 30 virtual void collidesWith (WorldEntity* entity, const Vector& location); 31 31 32 virtual int writeBytes(const byte* data, int length, int sender); 33 virtual int readBytes(byte* data, int maxLength, int * reciever); 34 32 35 private: 33 36 Weapon *left, *right; -
branches/network/src/world_entities/world_entity.cc
r6328 r6331 335 335 * @param sender hostID of sender 336 336 */ 337 voidWorldEntity::writeState( const byte * data, int length, int sender )337 int WorldEntity::writeState( const byte * data, int length, int sender ) 338 338 { 339 339 char* modelFileName; 340 340 SYNCHELP_READ_BEGIN(); 341 342 SYNCHELP_READ_FKT( PNode::writeState ); 343 341 344 SYNCHELP_READ_STRINGM( modelFileName ); 342 345 //check if modelFileName is relative to datadir or absolute … … 350 353 } 351 354 delete[] modelFileName; 355 356 return SYNCHELP_READ_N; 352 357 } 353 358 … … 361 366 { 362 367 SYNCHELP_WRITE_BEGIN(); 368 369 SYNCHELP_WRITE_FKT( PNode::readState ); 370 363 371 SYNCHELP_WRITE_STRING( getModel( 0 )->getName() ); 364 372 PRINTF(0)("%s\n", getModel( 0 )->getName()); -
branches/network/src/world_entities/world_entity.h
r6293 r6331 73 73 std::list<WorldEntity*>::iterator& getEntityIterator() { return this->objectListIterator; } 74 74 75 virtual voidwriteState(const byte* data, int length, int sender);76 virtualint readState(byte* data, int maxLength );75 int writeState(const byte* data, int length, int sender); 76 int readState(byte* data, int maxLength ); 77 77 protected: 78 78 // CharacterAttributes* charAttr; //!< the character attributes of a world_entity
Note: See TracChangeset
for help on using the changeset viewer.