Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 24, 2005, 3:27:23 PM (19 years ago)
Author:
rennerc
Message:

terrain loads now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/terrain.cc

    r6275 r6277  
    5959    {
    6060      this->loadModel(fileName);
    61       strncpy( terrainFile, fileName, 1024 );
    6261    }
    6362  else
     
    101100  this->ssp = NULL;
    102101  this->vegetation = NULL;
    103   strncpy( this->vegetationFile, "", 1024 );
    104   strncpy( this->terrainFile, "", 1024 );
    105102}
    106103
     
    123120    PRINTF(4)("fetching %s\n", vegetationFile);
    124121    this->vegetation = (Model*)ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN);
    125     strncpy( this->vegetationFile, vegetationFile, 1024);
    126122  }
    127123  else
     
    328324  setIsOutOfSync( false );
    329325
    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 );
    339331
    340332}
     
    344336  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
    345337  {
    346     //PRINTF(0)("Requesting sync! %d\n", this->getUniqueID());
    347338    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
    348339    setRequestedSync( true );
     
    352343  if ( rec > 0 )
    353344  {
    354     //PRINTF(0)("Serving client %d which requested sync %d size=%f texture=%s\n", rec, this->getUniqueID(), this->size, this->textureName);
    355345    *reciever = rec;
    356346
    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;
    366351
    367352  }
Note: See TracChangeset for help on using the changeset viewer.