Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2666 in orxonox.OLD for orxonox/branches/chris/src/data_tank.cc


Ignore:
Timestamp:
Oct 27, 2004, 7:49:25 PM (20 years ago)
Author:
chris
Message:

orxonox/branches/chris: implemented missing DataTank code, precaching implemented, possibility to specify a function to document the precaching process visually added - doxygen tags still missing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/chris/src/data_tank.cc

    r2665 r2666  
    283283                {
    284284                        // return placeholder
     285                        return loader->get_placeholder( type);
    285286                }
    286287                else
     
    305306}
    306307
    307 void DataTank::precache( char* resfile, void(*pfunc)(int, float, char*, char*))
    308 {
     308void DataTank::precache( char* resfile, void(*pfunc)(int, float, char*))
     309{
     310        FILE* source;
     311        int total, done;
     312        char file[256];
     313        char* s;
     314       
     315        source = fopen( resfile, "r");
     316        if( source == NULL) return;
     317       
     318        total = done = 0;
     319       
     320        while( !feof( source))
     321        {
     322                fgets( file, 256, source);
     323                if( (s = strchr( file, '\n')) != NULL) *s = 0;
     324                if( strlen( file) > 1) total++;
     325        }
     326       
     327        rewind( source);
     328       
     329        while( !feof( source))
     330        {
     331                fgets( file, 256, source);
     332                if( (s = strchr( file, '\n')) != NULL) *s = 0;
     333                if( strlen( file) > 1)
     334                {
     335                        if( pfunc) pfunc( total, ((float)done)/((float)total), file);
     336                        get( file);
     337                        done++;
     338                }
     339        }
     340       
     341        fclose( source);
    309342}
    310343
Note: See TracChangeset for help on using the changeset viewer.