Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6341 in orxonox.OLD for trunk/src/world_entities/world_entity.cc


Ignore:
Timestamp:
Dec 30, 2005, 1:57:12 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the network branche back to the trunk, so we do not get away from each other to fast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/world_entity.cc

    r6281 r6341  
    105105void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber)
    106106{
    107   if (fileName != NULL)
     107  if ( fileName != NULL && strcmp(fileName, "") )
    108108  {
    109109   // search for the special character # in the LoadParam
     
    144144  }
    145145  else
     146  {
    146147    this->setModel(NULL);
     148  }
    147149}
    148150
     
    340342  glPopMatrix();
    341343}
     344
     345/**
     346 * Writes data from network containing information about the state
     347 * @param data pointer to data
     348 * @param length length of data
     349 * @param sender hostID of sender
     350 */
     351int WorldEntity::writeState( const byte * data, int length, int sender )
     352{
     353  char* modelFileName;
     354  SYNCHELP_READ_BEGIN();
     355
     356  SYNCHELP_READ_FKT( PNode::writeState );
     357
     358  SYNCHELP_READ_STRINGM( modelFileName );
     359  SYNCHELP_READ_FLOAT( scaling );
     360  //check if modelFileName is relative to datadir or absolute
     361  if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
     362  {
     363    loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling );
     364  }
     365  else
     366  {
     367    loadModel( modelFileName, scaling );
     368  }
     369  delete[] modelFileName;
     370
     371  return SYNCHELP_READ_N;
     372}
     373
     374/**
     375 * data copied in data will bee sent to another host
     376 * @param data pointer to data
     377 * @param maxLength max length of data
     378 * @return the number of bytes writen
     379 */
     380int WorldEntity::readState( byte * data, int maxLength )
     381{
     382  SYNCHELP_WRITE_BEGIN();
     383
     384  SYNCHELP_WRITE_FKT( PNode::readState );
     385
     386  SYNCHELP_WRITE_STRING( getModel( 0 )->getName() );
     387  SYNCHELP_WRITE_FLOAT( scaling );
     388  return SYNCHELP_WRITE_N;
     389}
Note: See TracChangeset for help on using the changeset viewer.