Stats: compute the ranking based on the final score, not the intermediate one

This commit is contained in:
Olivier Teulière 2012-10-05 16:49:58 +02:00
parent 553d7f9cf0
commit b53295c782
3 changed files with 14 additions and 3 deletions

View file

@ -127,6 +127,12 @@ int Player::getSoloPoints() const
}
int Player::getTotalScore() const
{
return getPoints() + getSoloPoints() + getPenaltyPoints();
}
wstring Player::toString() const
{
wstring res = L"Player ";

View file

@ -91,6 +91,9 @@ public:
/// Return the total number of solo points received
int getSoloPoints() const;
/// Return the total score of the player, including solos and penalties
int getTotalScore() const;
/**************************
* Accessors for the score of the player
**************************/

View file

@ -33,6 +33,7 @@
#include "turn.h"
#include "game_params.h"
#include "settings.h"
#include "debug.h"
using namespace std;
@ -187,6 +188,7 @@ void StatsWidget::refresh()
// Final score
score += player.getSoloPoints() + player.getPenaltyPoints();
setModelText(getIndex(i + 1, col++), score, score >= gameTotal);
//ASSERT(score == player.getTotalScore(), "Invalid score computation");
// Diff with game total
setModelText(getIndex(i + 1, col++), score - gameTotal);
@ -200,9 +202,9 @@ void StatsWidget::refresh()
int rank = 1;
for (unsigned j = 0; j < nbPlayers; ++j)
{
if (i == j)
continue;
if (player.getPoints() < m_game->getPlayer(j).getPoints())
if (i == j)
continue;
if (player.getTotalScore() < m_game->getPlayer(j).getTotalScore())
++rank;
}
setModelText(getIndex(i + 1, col++), rank, rank == 1);