Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 29, 2006, 1:57:48 PM (18 years ago)
Author:
rennerc
Message:

new network system implemented. yet with a lot of empty function bodys

File:
1 edited

Legend:

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

    r7230 r7444  
    6565
    6666  this->toList(OM_NULL);
     67 
     68  modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName" ) );
     69  scaling_handle = registerVarId( new SynchronizeableFloat( &scaling, &scaling, "scaling" ) );
    6770}
    6871
     
    123126  this->modelLODName = fileName;
    124127  this->scaling = scaling;
     128 
     129  std::string name = fileName;
     130
     131  if (  name.find( ResourceManager::getInstance()->getDataDir() ) == 0 )
     132  {
     133    name.erase(ResourceManager::getInstance()->getDataDir().size());
     134  }
     135
     136  this->modelFileName = name;
     137 
    125138  if (!fileName.empty())
    126139  {
     
    504517
    505518
    506 
    507 
    508 /********************************************************************************************
    509  NETWORK STUFF
    510  ********************************************************************************************/
    511 
    512 
    513 /**
    514  * Writes data from network containing information about the state
    515  * @param data pointer to data
    516  * @param length length of data
    517  * @param sender hostID of sender
    518  */
    519 int WorldEntity::writeState( const byte * data, int length, int sender )
    520 {
    521   std::string modelFileName;
    522   SYNCHELP_READ_BEGIN();
    523 
    524   SYNCHELP_READ_FKT( PNode::writeState, NWT_WE_PN_WRITESTATE );
    525 
    526   SYNCHELP_READ_STRING( modelFileName, NWT_WE_PN_MODELFILENAME );
    527   SYNCHELP_READ_FLOAT( scaling, NWT_WE_PN_SCALING );
    528   //check if modelFileName is relative to datadir or absolute
    529 
    530 
    531   PRINTF(0)("================ LOADING MODEL %s, %f\n", modelFileName.c_str(), scaling);
    532 
    533   if ( modelFileName != "" )
    534   {
    535     loadModel( modelFileName, scaling);
    536     PRINTF(0)("modelfilename: %s\n", getModel( 0 )->getName());
    537   }
    538 
    539   /*SYNCHELP_READ_STRINGM( modelFileName );
    540 
    541   if ( strcmp(modelFileName, "") )
    542     if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
    543     {
    544       this->md2TextureFileName = new char[strlen(modelFileName)-strlen(ResourceManager::getInstance()->getDataDir())+1];
    545       strcpy((char*)this->md2TextureFileName, modelFileName+strlen(ResourceManager::getInstance()->getDataDir()));
    546     }
    547     else
    548     {
    549       this->md2TextureFileName = modelFileName;
    550     }
    551   */
    552 
    553   return SYNCHELP_READ_N;
    554 }
    555 
    556 
    557 /**
    558  * data copied in data will bee sent to another host
    559  * @param data pointer to data
    560  * @param maxLength max length of data
    561  * @return the number of bytes writen
    562  */
    563 int WorldEntity::readState( byte * data, int maxLength )
    564 {
    565   SYNCHELP_WRITE_BEGIN();
    566 
    567   SYNCHELP_WRITE_FKT( PNode::readState, NWT_WE_PN_WRITESTATE );
    568 
    569   if ( getModel(0) && getModel(0)->getName() != "" )
    570   {
    571     std::string name = getModel( 0 )->getName();
    572 
    573     if (  name.find( ResourceManager::getInstance()->getDataDir() ) == 0 )
    574     {
    575       name.erase(ResourceManager::getInstance()->getDataDir().size());
    576     }
    577 
    578     SYNCHELP_WRITE_STRING( name, NWT_WE_PN_MODELFILENAME );
    579   }
    580   else
    581   {
    582     SYNCHELP_WRITE_STRING("", NWT_WE_PN_MODELFILENAME);
    583   }
    584 
    585   SYNCHELP_WRITE_FLOAT( scaling, NWT_WE_PN_SCALING );
    586   /*if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") )
    587   {
    588     SYNCHELP_WRITE_STRING(this->md2TextureFileName);
    589   }
    590   else
    591   {
    592     SYNCHELP_WRITE_STRING("");
    593   }*/
    594 
    595   return SYNCHELP_WRITE_N;
    596 }
     519/**
     520 * handler for changes on registred vars
     521 * @param id id's which changed
     522 */
     523void WorldEntity::varChangeHandler( std::list< int > & id )
     524{
     525#warning implement this
     526}
Note: See TracChangeset for help on using the changeset viewer.