mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 22:22:45 -04:00
fixed bug causing uninitialised friend average reputation to be shown
This commit is contained in:
parent
338fcee865
commit
59d2ca9c3d
1 changed files with 20 additions and 26 deletions
|
@ -866,8 +866,6 @@ float Reputation::updateReputation(uint32_t average_active_friends)
|
|||
{
|
||||
// the calculation of reputation makes the whole thing
|
||||
|
||||
if(mOwnOpinion == RsReputations::OPINION_NEUTRAL)
|
||||
{
|
||||
int friend_total = 0;
|
||||
|
||||
// accounts for all friends. Neutral opinions count for 1-1=0
|
||||
|
@ -876,16 +874,12 @@ float Reputation::updateReputation(uint32_t average_active_friends)
|
|||
friend_total += it->second - 1;
|
||||
|
||||
if(mOpinions.empty()) // includes the case of no friends!
|
||||
{
|
||||
mReputation = 1.0f;
|
||||
mFriendAverage = 1.0f ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mFriendAverage = 1.0+friend_total / float(std::max(average_active_friends,(uint32_t)mOpinions.size()));
|
||||
|
||||
if(mOwnOpinion == RsReputations::OPINION_NEUTRAL)
|
||||
mReputation = mFriendAverage ;
|
||||
}
|
||||
}
|
||||
else
|
||||
mReputation = (float)mOwnOpinion ;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue