Changeset 6337 in orxonox.OLD for branches/network
- Timestamp:
- Dec 30, 2005, 1:32:46 AM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/coord/p_node.cc
r6336 r6337 1016 1016 SYNCHELP_READ_BEGIN(); 1017 1017 1018 char * name; 1019 SYNCHELP_READ_STRINGM( name ); 1018 SYNCHELP_READ_FKT( BaseObject::writeState ); 1019 1020 PRINTF(0)("name = %s\n", this->getName()); 1020 1021 1021 1022 char * parentName = NULL; … … 1036 1037 SYNCHELP_READ_INT( parentMode ); 1037 1038 this->setParentMode((PARENT_MODE)parentMode); 1038 1039 if ( strcmp(name, "")==0 )1040 {1041 this->setName( NULL );1042 }1043 else1044 {1045 this->setName( name );1046 }1047 delete name;1048 name = NULL;1049 1039 1050 1040 float f1, f2, f3, f4; … … 1056 1046 //this->setRelCoor( 10, 0, 0 ); 1057 1047 1058 PRINTF(0)("%f %f %f\n", f1, f2, f3);1059 1060 1048 SYNCHELP_READ_FLOAT( f1 ); 1061 1049 SYNCHELP_READ_FLOAT( f2 ); 1062 1050 SYNCHELP_READ_FLOAT( f3 ); 1063 1051 //this->setAbsCoor( f1, f2, f3 ); 1064 1065 PRINTF(0)("%f %f %f\n", f1, f2, f3);1066 1052 1067 1053 SYNCHELP_READ_FLOAT( f1 ); … … 1085 1071 { 1086 1072 SYNCHELP_READ_STRINGM( childName ); 1073 PRINTF(0)("childname = %s\n", childName); 1087 1074 addChild( childName ); 1088 1075 delete childName; … … 1103 1090 SYNCHELP_WRITE_BEGIN(); 1104 1091 1105 SYNCHELP_WRITE_STRING( this->getName() ); 1092 SYNCHELP_WRITE_FKT( BaseObject::readState ); 1093 1094 PRINTF(0)("name = %s\n", this->getName()); 1106 1095 1107 1096 if ( this->parent ) … … 1143 1132 for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++) 1144 1133 { 1134 PRINTF(0)("childname = %s\n", (*it)->getName() ); 1145 1135 SYNCHELP_WRITE_STRING( (*it)->getName() ); 1146 1136 } -
branches/network/src/lib/lang/base_object.cc
r6275 r6337 22 22 #include "compiler.h" 23 23 #include "class_list.h" 24 25 #include "synchronizeable.h" 24 26 25 27 using namespace std; … … 194 196 PRINT(0)(" -Weapon-"); 195 197 PRINT(0)("\n"); 196 } 197 } 198 } 199 } 200 201 /** 202 * Writes data from network containing information about the state 203 * @param data pointer to data 204 * @param length length of data 205 * @param sender hostID of sender 206 */ 207 int BaseObject::writeState( const byte * data, int length, int sender ) 208 { 209 SYNCHELP_READ_BEGIN(); 210 211 if ( objectName ) 212 { 213 delete[] objectName; 214 objectName = NULL; 215 } 216 SYNCHELP_READ_STRINGM( this->objectName ); 217 218 return SYNCHELP_READ_N; 219 } 220 221 /** 222 * data copied in data will bee sent to another host 223 * @param data pointer to data 224 * @param maxLength max length of data 225 * @return the number of bytes writen 226 */ 227 int BaseObject::readState( byte * data, int maxLength ) 228 { 229 SYNCHELP_WRITE_BEGIN(); 230 231 SYNCHELP_WRITE_STRING( this->objectName ); 232 233 return SYNCHELP_WRITE_N; 234 } -
branches/network/src/lib/lang/base_object.h
r6275 r6337 15 15 #define NULL 0 //!< NULL 16 16 #endif 17 18 #include "stdincl.h" 17 19 18 20 class TiXmlElement; … … 44 46 bool operator==(ClassID classID) { return this->isA(classID); }; 45 47 48 int writeState(const byte* data, int length, int sender); 49 int readState(byte* data, int maxLength ); 46 50 protected: 47 51 void setClassID(ClassID classID, const char* className); -
branches/network/src/world_entities/world_entity.cc
r6331 r6337 121 121 122 122 PRINTF(4)("fetching %s\n", fileName); 123 this->scaling = scaling; 123 124 if (scaling == 1.0) 124 125 this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN), modelNumber); … … 343 344 344 345 SYNCHELP_READ_STRINGM( modelFileName ); 346 SYNCHELP_READ_FLOAT( scaling ); 345 347 //check if modelFileName is relative to datadir or absolute 346 348 if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) ) 347 349 { 348 loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()) );350 loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling ); 349 351 } 350 352 else 351 353 { 352 loadModel( modelFileName );354 loadModel( modelFileName, scaling ); 353 355 } 354 356 delete[] modelFileName; … … 370 372 371 373 SYNCHELP_WRITE_STRING( getModel( 0 )->getName() ); 372 PRINTF(0)("%s\n", getModel( 0 )->getName());374 SYNCHELP_WRITE_FLOAT( scaling ); 373 375 return SYNCHELP_WRITE_N; 374 376 } -
branches/network/src/world_entities/world_entity.h
r6331 r6337 89 89 std::list<WorldEntity*>::iterator objectListIterator; //!< The iterator position of this Entity in the given list of the ObjectManager. 90 90 91 float scaling; 92 91 93 92 94 };
Note: See TracChangeset
for help on using the changeset viewer.