Changeset 6341 in orxonox.OLD for trunk/src/world_entities/world_entity.cc
- Timestamp:
- Dec 30, 2005, 1:57:12 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/world_entity.cc
r6281 r6341 105 105 void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber) 106 106 { 107 if ( fileName != NULL)107 if ( fileName != NULL && strcmp(fileName, "") ) 108 108 { 109 109 // search for the special character # in the LoadParam … … 144 144 } 145 145 else 146 { 146 147 this->setModel(NULL); 148 } 147 149 } 148 150 … … 340 342 glPopMatrix(); 341 343 } 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 */ 351 int 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 */ 380 int 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.