Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6277 in orxonox.OLD


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

terrain loads now

Location:
branches/network/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/synchronizeable.h

    r6275 r6277  
    110110                                      return; \
    111111} \
     112                                    __synchelp_read_i += __synchelp_read_n; \
    112113}
    113114#define SYNCHELP_READ_BYTE(b)      { \
  • branches/network/src/world_entities/skybox.cc

    r6275 r6277  
    238238  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
    239239  {
    240     //PRINTF(0)("Requesting sync! %d\n", this->getUniqueID());
    241240    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
    242241    setRequestedSync( true );
     
    246245  if ( rec > 0 )
    247246  {
    248     //PRINTF(0)("Serving client %d which requested sync %d size=%f texture=%s\n", rec, this->getUniqueID(), this->size, this->textureName);
    249247    *reciever = rec;
    250248
  • 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  }
  • branches/network/src/world_entities/terrain.h

    r6275 r6277  
    4949   Model*              vegetation;
    5050   int                 objectList;
    51    char                vegetationFile[1024];
    52    char                terrainFile[1024];
     51
    5352};
    5453
  • branches/network/src/world_entities/world_entity.cc

    r6142 r6277  
    5858
    5959  this->toList(OM_NULL);
     60
     61  strncpy( modelFileName, "", 1024 );
    6062}
    6163
     
    101103void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber)
    102104{
    103   if (fileName != NULL)
    104   {
     105  if ( fileName != NULL && strcmp(fileName, "") )
     106  {
     107    strncpy( modelFileName, fileName, 1024 );
    105108    // search for the special character # in the LoadParam
    106109    if (strchr(fileName, '#') != NULL)
     
    129132  }
    130133  else
     134  {
     135    strncpy( modelFileName, "", 1024 );
    131136    this->setModel(NULL);
     137  }
    132138}
    133139
  • branches/network/src/world_entities/world_entity.h

    r6142 r6277  
    7474 protected:
    7575  //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
     76   char                   modelFileName[1024];  //!< the filename of the loaded model
    7677
    7778 private:
     
    8586  std::list<WorldEntity*>::iterator objectListIterator; //!< The iterator position of this Entity in the given list of the ObjectManager.
    8687
     88
    8789};
    8890
Note: See TracChangeset for help on using the changeset viewer.