|
楼主 |
发表于 2003-10-27 13:59:50
|
显示全部楼层
来自 中国–江西–南昌
哈哈!找到了源代码,一下就明朗了
void RankSystem::loadRank( const char* filename )
{
FILE *bfp = fopen( filename , "rb" );
if ( !bfp ) return;
short int i = 0;
fread(&i, 1 , sizeof(short int) , bfp);
if (i == RANK_VERSION)
{
Stats d;
char unique[64], name[64];
fread(&i , 1, sizeof(short int), bfp);
while( i )
{
fread(name , i,sizeof(char) , bfp);
fread(&i , 1, sizeof(short int), bfp);
fread(unique , i,sizeof(char) , bfp);
fread(&d.tks, 1,sizeof(int), bfp);
fread(&d.damage, 1,sizeof(int), bfp);
fread(&d.deaths, 1,sizeof(int), bfp);
fread(&d.kills, 1,sizeof(int), bfp);
fread(&d.shots, 1,sizeof(int), bfp);
fread(&d.hits, 1,sizeof(int), bfp);
fread(&d.hs, 1,sizeof(int), bfp);
fread(d.bodyHits, 1,sizeof(d.bodyHits), bfp);
fread(&i , 1, sizeof(short int), bfp);
RankSystem::RankStats* a = findEntryInRank( unique , name );
if ( a ) a->updatePosition( &d );
}
}
fclose(bfp);
} |
|