Changeset 7954 in orxonox.OLD for trunk/src/world_entities/skybox.cc
- Timestamp:
- May 29, 2006, 3:28:41 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/skybox.cc
r7919 r7954 95 95 { 96 96 this->rebuild(); 97 98 textureName_handle = registerVarId( new SynchronizeableString( &textureName, &textureName, "textureName") ); 99 size_handle = registerVarId( new SynchronizeableFloat( &size, &size, "size" ) ); 97 100 } 98 101 … … 290 293 } 291 294 292 int SkyBox::writeBytes( const byte * data, int length, int sender ) 293 { 294 setRequestedSync( false ); 295 setIsOutOfSync( false ); 296 297 SYNCHELP_READ_BEGIN(); 298 299 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SB_WE_STATE ); 300 301 SYNCHELP_READ_FLOAT( size, NWT_SB_SIZE ); 302 if ( !this->textureName.empty() ) 295 void SkyBox::varChangeHandler( std::list< int > & id ) 296 { 297 bool somethinChanged = false; 298 299 if ( std::find( id.begin(), id.end(), textureName_handle ) != id.end() ) 303 300 { 304 textureName = ""; 301 somethinChanged = true; 302 setTexture( textureName ); 305 303 } 306 std::string texName; 307 SYNCHELP_READ_STRING( texName, NWT_SB_TEXTURENAME ); 308 309 this->setSize( size ); 310 this->setTextureAndType( texName, "jpg" ); 311 this->rebuild(); 312 313 return SYNCHELP_READ_N; 314 } 315 316 317 318 int SkyBox::readBytes( byte * data, int maxLength, int * reciever ) 319 { 320 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() ) 304 305 if ( std::find( id.begin(), id.end(), size_handle ) != id.end() ) 321 306 { 322 (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() ); 323 setRequestedSync( true ); 307 somethinChanged = true; 324 308 } 325 326 int rec = this->getRequestSync(); 327 if ( rec > 0 ) 328 { 329 *reciever = rec; 330 331 SYNCHELP_WRITE_BEGIN(); 332 333 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_SB_WE_STATE ); 334 335 SYNCHELP_WRITE_FLOAT(this->size, NWT_SB_SIZE); 336 SYNCHELP_WRITE_STRING(this->textureName, NWT_SB_TEXTURENAME); 337 338 return SYNCHELP_WRITE_N; 339 } 340 341 *reciever = 0; 342 return 0; 343 } 344 345 void SkyBox::writeDebug( ) const 346 { 347 } 348 349 void SkyBox::readDebug( ) const 350 { 351 } 309 310 rebuild(); 311 312 WorldEntity::varChangeHandler( id ); 313 }
Note: See TracChangeset
for help on using the changeset viewer.