mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-01 02:46:20 -05:00
fixed bug causing uninitialised friend average reputation to be shown
This commit is contained in:
parent
338fcee865
commit
59d2ca9c3d
@ -866,8 +866,6 @@ float Reputation::updateReputation(uint32_t average_active_friends)
|
|||||||
{
|
{
|
||||||
// the calculation of reputation makes the whole thing
|
// the calculation of reputation makes the whole thing
|
||||||
|
|
||||||
if(mOwnOpinion == RsReputations::OPINION_NEUTRAL)
|
|
||||||
{
|
|
||||||
int friend_total = 0;
|
int friend_total = 0;
|
||||||
|
|
||||||
// accounts for all friends. Neutral opinions count for 1-1=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;
|
friend_total += it->second - 1;
|
||||||
|
|
||||||
if(mOpinions.empty()) // includes the case of no friends!
|
if(mOpinions.empty()) // includes the case of no friends!
|
||||||
{
|
|
||||||
mReputation = 1.0f;
|
|
||||||
mFriendAverage = 1.0f ;
|
mFriendAverage = 1.0f ;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
mFriendAverage = 1.0+friend_total / float(std::max(average_active_friends,(uint32_t)mOpinions.size()));
|
mFriendAverage = 1.0+friend_total / float(std::max(average_active_friends,(uint32_t)mOpinions.size()));
|
||||||
|
|
||||||
|
if(mOwnOpinion == RsReputations::OPINION_NEUTRAL)
|
||||||
mReputation = mFriendAverage ;
|
mReputation = mFriendAverage ;
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
mReputation = (float)mOwnOpinion ;
|
mReputation = (float)mOwnOpinion ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user