Changeset 6277 in orxonox.OLD for branches/network/src/world_entities
- Timestamp:
- Dec 24, 2005, 3:27:23 PM (19 years ago)
- Location:
- branches/network/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/world_entities/skybox.cc
r6275 r6277 238 238 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() ) 239 239 { 240 //PRINTF(0)("Requesting sync! %d\n", this->getUniqueID());241 240 (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() ); 242 241 setRequestedSync( true ); … … 246 245 if ( rec > 0 ) 247 246 { 248 //PRINTF(0)("Serving client %d which requested sync %d size=%f texture=%s\n", rec, this->getUniqueID(), this->size, this->textureName);249 247 *reciever = rec; 250 248 -
branches/network/src/world_entities/terrain.cc
r6275 r6277 59 59 { 60 60 this->loadModel(fileName); 61 strncpy( terrainFile, fileName, 1024 );62 61 } 63 62 else … … 101 100 this->ssp = NULL; 102 101 this->vegetation = NULL; 103 strncpy( this->vegetationFile, "", 1024 );104 strncpy( this->terrainFile, "", 1024 );105 102 } 106 103 … … 123 120 PRINTF(4)("fetching %s\n", vegetationFile); 124 121 this->vegetation = (Model*)ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN); 125 strncpy( this->vegetationFile, vegetationFile, 1024);126 122 } 127 123 else … … 328 324 setIsOutOfSync( false ); 329 325 330 int n = Converter::byteArrayToString( data, vegetationFile, length ); 331 Converter::byteArrayToString( data+n, terrainFile, length-n ); 332 333 //PRINT(0)("GOT DATA: size=%f texture=%s\n", size, textureName); 334 335 if ( strcmp(vegetationFile, "") ) 336 this->loadVegetation( vegetationFile ); 337 if ( strcmp(terrainFile, "") ) 338 this->loadModel( terrainFile ); 326 SYNCHELP_READ_BEGIN(); 327 SYNCHELP_READ_STRING( modelFileName, 1024 ); 328 329 if ( strcmp(modelFileName, "") ) 330 this->loadModel( modelFileName ); 339 331 340 332 } … … 344 336 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() ) 345 337 { 346 //PRINTF(0)("Requesting sync! %d\n", this->getUniqueID());347 338 (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() ); 348 339 setRequestedSync( true ); … … 352 343 if ( rec > 0 ) 353 344 { 354 //PRINTF(0)("Serving client %d which requested sync %d size=%f texture=%s\n", rec, this->getUniqueID(), this->size, this->textureName);355 345 *reciever = rec; 356 346 357 if ( strlen(vegetationFile)+INTSIZE > maxLength ) 358 { 359 PRINTF(1)("Byte array is too small (%d) to store data\n", maxLength ); 360 return 0; 361 } 362 363 int n = Converter::stringToByteArray( vegetationFile, data, strlen(vegetationFile), maxLength ); 364 365 return n + Converter::stringToByteArray( terrainFile, data+n, strlen(terrainFile), maxLength-n ); 347 SYNCHELP_WRITE_BEGIN(); 348 SYNCHELP_WRITE_STRING( modelFileName ); 349 350 return SYNCHELP_WRITE_N; 366 351 367 352 } -
branches/network/src/world_entities/terrain.h
r6275 r6277 49 49 Model* vegetation; 50 50 int objectList; 51 char vegetationFile[1024]; 52 char terrainFile[1024]; 51 53 52 }; 54 53 -
branches/network/src/world_entities/world_entity.cc
r6142 r6277 58 58 59 59 this->toList(OM_NULL); 60 61 strncpy( modelFileName, "", 1024 ); 60 62 } 61 63 … … 101 103 void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber) 102 104 { 103 if (fileName != NULL) 104 { 105 if ( fileName != NULL && strcmp(fileName, "") ) 106 { 107 strncpy( modelFileName, fileName, 1024 ); 105 108 // search for the special character # in the LoadParam 106 109 if (strchr(fileName, '#') != NULL) … … 129 132 } 130 133 else 134 { 135 strncpy( modelFileName, "", 1024 ); 131 136 this->setModel(NULL); 137 } 132 138 } 133 139 -
branches/network/src/world_entities/world_entity.h
r6142 r6277 74 74 protected: 75 75 // CharacterAttributes* charAttr; //!< the character attributes of a world_entity 76 char modelFileName[1024]; //!< the filename of the loaded model 76 77 77 78 private: … … 85 86 std::list<WorldEntity*>::iterator objectListIterator; //!< The iterator position of this Entity in the given list of the ObjectManager. 86 87 88 87 89 }; 88 90
Note: See TracChangeset
for help on using the changeset viewer.