Changeset 6277 in orxonox.OLD for branches/network/src/world_entities/terrain.cc
- Timestamp:
- Dec 24, 2005, 3:27:23 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.