Changeset 6273 in orxonox.OLD for branches/network/src/world_entities/skybox.cc
- Timestamp:
- Dec 23, 2005, 5:30:22 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/world_entities/skybox.cc
r6142 r6273 22 22 #include "static_model.h" 23 23 #include "material.h" 24 #include "network_game_manager.h" 25 #include "converter.h" 24 26 25 27 using namespace std; … … 210 212 this->setModel(model); 211 213 } 214 215 void SkyBox::writeBytes( const byte * data, int length, int sender ) 216 { 217 setRequestedSync( false ); 218 setIsOutOfSync( false ); 219 220 int flsize = Converter::byteArrayToFloat( data, &size ); 221 Converter::byteArrayToString( data+flsize, textureName, length-flsize ); 222 223 PRINT(0)("GOT DATA: size=%f texture=%s\n", size, textureName); 224 225 this->setSize( size ); 226 this->setTexture( textureName ); 227 this->rebuild(); 228 } 229 230 int SkyBox::readBytes( byte * data, int maxLength, int * reciever ) 231 { 232 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() ) 233 { 234 PRINTF(0)("Requesting sync! %d\n", this->getUniqueID()); 235 (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() ); 236 setRequestedSync( true ); 237 } 238 239 int rec = this->getRequestSync(); 240 if ( rec > 0 ) 241 { 242 PRINTF(0)("Serving client %d which requested sync %d size=%f texture=%s\n", rec, this->getUniqueID(), this->size, this->textureName); 243 *reciever = rec; 244 245 int flsize = Converter::floatToByteArray( this->size, data, maxLength ); 246 247 if ( flsize <= 0 ) 248 { 249 PRINTF(1)("Byte array is too small (%d) to store float\n", maxLength ); 250 return 0; 251 } 252 253 if ( strlen(textureName)+INTSIZE+flsize > maxLength ) 254 { 255 PRINTF(1)("Byte array is too small (%d) to store data\n", maxLength ); 256 return 0; 257 } 258 259 return flsize + Converter::stringToByteArray( textureName, data+flsize, strlen(textureName), maxLength-flsize ); 260 261 } 262 263 *reciever = 0; 264 return 0; 265 } 266 267 void SkyBox::writeDebug( ) const 268 { 269 } 270 271 void SkyBox::readDebug( ) const 272 { 273 }
Note: See TracChangeset
for help on using the changeset viewer.