(trunk libT) #4083 "Wrong shades of progress in Inspector pieces view." -- fixed.

The problem was reported by Rolcol and tracked down by livings124. It's flashing orange because the completion in "availability" doesn't match the completion in in "progress", which corresponds with tr_torrentAvailability() and tr_torrentAmountFinished(). tr_cpGetAmountDone() was recently reworked in r12012 for #4048, which caused the problem. Both functions need to sample the torrent using the same methodology so that their results can be used together.
This commit is contained in:
Jordan Lee 2011-03-05 03:51:57 +00:00
parent 5b3c1c46d7
commit f015bafdbf
1 changed files with 11 additions and 4 deletions

View File

@ -304,11 +304,18 @@ tr_cpSizeWhenDone( const tr_completion * ccp )
void
tr_cpGetAmountDone( const tr_completion * cp, float * tab, int tabCount )
{
int i, b;
const int span = cp->tor->blockCount / tabCount;
int i;
const float interval = cp->tor->info.pieceCount / (float)tabCount;
const tr_bool seed = isSeed( cp );
for( i=b=0; i<tabCount; ++i, b+=span )
tab[i] = tr_bitsetCountRange(&cp->blockBitset,b,b+span) / (float)span;
for( i=0; i<tabCount; ++i ) {
if( seed )
tab[i] = 1.0f;
else {
const tr_piece_index_t piece = (tr_piece_index_t)i * interval;
tab[i] = getCompleteBlocks(cp)[piece] / (float)countBlocksInPiece( cp->tor, piece );
}
}
}
int