Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6341 in orxonox.OLD for trunk/src/world_entities/skybox.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/skybox.cc

    r6307 r6341  
    2222#include "static_model.h"
    2323#include "material.h"
     24#include "network_game_manager.h"
     25#include "converter.h"
    2426
    2527using namespace std;
     
    7779    }
    7880  this->setParentMode(PNODE_MOVEMENT);
     81
     82  this->textureName = NULL;
    7983}
    8084
     
    208212  this->setModel(model);
    209213}
     214
     215int SkyBox::writeBytes( const byte * data, int length, int sender )
     216{
     217  setRequestedSync( false );
     218  setIsOutOfSync( false );
     219
     220  SYNCHELP_READ_BEGIN();
     221
     222  SYNCHELP_READ_FKT( WorldEntity::writeState );
     223
     224  SYNCHELP_READ_FLOAT( size );
     225  if ( textureName )
     226  {
     227    delete[] textureName;
     228    textureName = NULL;
     229  }
     230  SYNCHELP_READ_STRINGM( textureName );
     231
     232  PRINT(0)("GOT DATA: size=%f texture='%s'\n", size, textureName);
     233
     234  this->setSize( size );
     235  this->setTextureAndType( textureName, "jpg" );
     236  this->rebuild();
     237
     238  return SYNCHELP_READ_N;
     239}
     240
     241
     242
     243int SkyBox::readBytes( byte * data, int maxLength, int * reciever )
     244{
     245  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
     246  {
     247    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
     248    setRequestedSync( true );
     249  }
     250
     251  int rec = this->getRequestSync();
     252  if ( rec > 0 )
     253  {
     254    PRINT(0)("SEND DATA: size=%f texture='%s'\n", size, textureName);
     255    *reciever = rec;
     256
     257    SYNCHELP_WRITE_BEGIN();
     258
     259    SYNCHELP_WRITE_FKT( WorldEntity::readState );
     260
     261    SYNCHELP_WRITE_FLOAT(this->size);
     262    SYNCHELP_WRITE_STRING(this->textureName);
     263
     264    return SYNCHELP_WRITE_N;
     265  }
     266
     267  *reciever = 0;
     268  return 0;
     269}
     270
     271void SkyBox::writeDebug( ) const
     272{
     273}
     274
     275void SkyBox::readDebug( ) const
     276{
     277}
Note: See TracChangeset for help on using the changeset viewer.