mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-27 09:58:08 +01:00
Stats: compute the ranking based on the final score, not the intermediate one
This commit is contained in:
parent
553d7f9cf0
commit
b53295c782
3 changed files with 14 additions and 3 deletions
|
@ -127,6 +127,12 @@ int Player::getSoloPoints() const
|
|||
}
|
||||
|
||||
|
||||
int Player::getTotalScore() const
|
||||
{
|
||||
return getPoints() + getSoloPoints() + getPenaltyPoints();
|
||||
}
|
||||
|
||||
|
||||
wstring Player::toString() const
|
||||
{
|
||||
wstring res = L"Player ";
|
||||
|
|
|
@ -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
|
||||
**************************/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue