mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
Arbitration: do not handle solos automatically.
The arbitrator has to specify them manually. Otherwise, we cannot know when a turn is complete and thus we cannot determine if solos can/should be applied.
This commit is contained in:
parent
66cfd66681
commit
a800863c1f
12 changed files with 174 additions and 97 deletions
|
@ -109,6 +109,51 @@ struct MatchingPlayerAndEventType : public unary_function<PlayerEventCmd, bool>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void Arbitration::setSolo(unsigned iPlayerId, int iPoints)
|
||||||
|
{
|
||||||
|
ASSERT(iPlayerId < getNPlayers(), "Wrong player number");
|
||||||
|
ASSERT(iPoints >= 0, "Expected a positive value for the solo");
|
||||||
|
|
||||||
|
if (iPoints == 0)
|
||||||
|
{
|
||||||
|
// Retrieve the default value of the solo
|
||||||
|
iPoints = Settings::Instance().getInt("arbitration.solo-value");
|
||||||
|
}
|
||||||
|
LOG_INFO("Giving a solo of " << iPoints << " to player " << iPlayerId);
|
||||||
|
|
||||||
|
// If an existing solo exists, get rid of it
|
||||||
|
const PlayerEventCmd *cmd = getPlayerEvent(iPlayerId, PlayerEventCmd::SOLO);
|
||||||
|
if (cmd != 0)
|
||||||
|
{
|
||||||
|
accessNavigation().dropCommand(*cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
Command *pCmd = new PlayerEventCmd(*m_players[iPlayerId],
|
||||||
|
PlayerEventCmd::SOLO, iPoints);
|
||||||
|
accessNavigation().insertCommand(pCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Arbitration::removeSolo(unsigned iPlayerId)
|
||||||
|
{
|
||||||
|
ASSERT(iPlayerId < getNPlayers(), "Wrong player number");
|
||||||
|
const PlayerEventCmd *cmd = getPlayerEvent(iPlayerId, PlayerEventCmd::SOLO);
|
||||||
|
ASSERT(cmd != 0, "No matching PlayerEventCmd found");
|
||||||
|
|
||||||
|
accessNavigation().dropCommand(*cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Arbitration::getSolo(unsigned iPlayerId) const
|
||||||
|
{
|
||||||
|
ASSERT(iPlayerId < getNPlayers(), "Wrong player number");
|
||||||
|
const PlayerEventCmd *cmd = getPlayerEvent(iPlayerId, PlayerEventCmd::SOLO);
|
||||||
|
if (cmd == 0)
|
||||||
|
return 0;
|
||||||
|
return cmd->getPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Arbitration::addWarning(unsigned iPlayerId)
|
void Arbitration::addWarning(unsigned iPlayerId)
|
||||||
{
|
{
|
||||||
ASSERT(iPlayerId < getNPlayers(), "Wrong player number");
|
ASSERT(iPlayerId < getNPlayers(), "Wrong player number");
|
||||||
|
@ -144,7 +189,7 @@ void Arbitration::addPenalty(unsigned iPlayerId, int iPoints)
|
||||||
if (iPoints == 0)
|
if (iPoints == 0)
|
||||||
{
|
{
|
||||||
// Retrieve the default value of the penalty
|
// Retrieve the default value of the penalty
|
||||||
iPoints = Settings::Instance().getInt("arbitration.default-penalty");
|
iPoints = Settings::Instance().getInt("arbitration.penalty-value");
|
||||||
|
|
||||||
// By convention, use negative values to indicate a penalty
|
// By convention, use negative values to indicate a penalty
|
||||||
iPoints = -iPoints;
|
iPoints = -iPoints;
|
||||||
|
|
|
@ -56,6 +56,10 @@ public:
|
||||||
|
|
||||||
Move checkWord(const wstring &iWord, const wstring &iCoords) const;
|
Move checkWord(const wstring &iWord, const wstring &iCoords) const;
|
||||||
|
|
||||||
|
void setSolo(unsigned iPlayerId, int iPoints = 0);
|
||||||
|
void removeSolo(unsigned iPlayerId);
|
||||||
|
int getSolo(unsigned iPlayerId) const;
|
||||||
|
|
||||||
void addWarning(unsigned iPlayerId);
|
void addWarning(unsigned iPlayerId);
|
||||||
void removeWarning(unsigned iPlayerId);
|
void removeWarning(unsigned iPlayerId);
|
||||||
bool hasWarning(unsigned iPlayerId) const;
|
bool hasWarning(unsigned iPlayerId) const;
|
||||||
|
|
|
@ -288,11 +288,13 @@ void Duplicate::endTurn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle solo bonus
|
// Handle solo bonus (not in arbitration mode, because we may not have all
|
||||||
|
// the moves to decide whether a solo can be attributed).
|
||||||
|
if (!isArbitrationGame())
|
||||||
|
{
|
||||||
// First check whether there are enough players in the game for the
|
// First check whether there are enough players in the game for the
|
||||||
// bonus to apply
|
// bonus to apply
|
||||||
unsigned int minNbPlayers = Settings::Instance().getInt(
|
unsigned int minNbPlayers = Settings::Instance().getInt("duplicate.solo-players");
|
||||||
isArbitrationGame() ? "arbitration.solo-players" : "duplicate.solo-players");
|
|
||||||
// Find the player with the best score
|
// Find the player with the best score
|
||||||
Player *bestPlayer = findBestPlayer();
|
Player *bestPlayer = findBestPlayer();
|
||||||
if (getNPlayers() >= minNbPlayers && bestPlayer != NULL)
|
if (getNPlayers() >= minNbPlayers && bestPlayer != NULL)
|
||||||
|
@ -313,12 +315,12 @@ void Duplicate::endTurn()
|
||||||
if (!otherWithSameScore)
|
if (!otherWithSameScore)
|
||||||
{
|
{
|
||||||
// Give the bonus to the player of the best move
|
// Give the bonus to the player of the best move
|
||||||
int bonus = Settings::Instance().getInt(
|
int bonus = Settings::Instance().getInt("duplicate.solo-value");
|
||||||
isArbitrationGame() ? "arbitration.solo-value" : "duplicate.solo-value");
|
|
||||||
Command *pCmd = new PlayerEventCmd(*bestPlayer, PlayerEventCmd::SOLO, bonus);
|
Command *pCmd = new PlayerEventCmd(*bestPlayer, PlayerEventCmd::SOLO, bonus);
|
||||||
accessNavigation().addAndExecute(pCmd);
|
accessNavigation().addAndExecute(pCmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Play the master word on the board
|
// Play the master word on the board
|
||||||
// We assign it to player 0 arbitrarily (this is only used
|
// We assign it to player 0 arbitrarily (this is only used
|
||||||
|
|
|
@ -109,7 +109,7 @@ int Player::getPenaltyPoints() const
|
||||||
if ((int)warningsNb > limit)
|
if ((int)warningsNb > limit)
|
||||||
{
|
{
|
||||||
int penaltiesPoints =
|
int penaltiesPoints =
|
||||||
Settings::Instance().getInt("arbitration.default-penalty");
|
Settings::Instance().getInt("arbitration.penalty-value");
|
||||||
total -= penaltiesPoints * (warningsNb - limit);
|
total -= penaltiesPoints * (warningsNb - limit);
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
|
|
|
@ -284,6 +284,22 @@ Move PublicGame::arbitrationCheckWord(const wstring &iWord,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PublicGame::arbitrationToggleSolo(unsigned iPlayerId)
|
||||||
|
{
|
||||||
|
Arbitration &game = getTypedGame<Arbitration>(m_game);
|
||||||
|
if (game.getSolo(iPlayerId) != 0)
|
||||||
|
game.removeSolo(iPlayerId);
|
||||||
|
else
|
||||||
|
game.setSolo(iPlayerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PublicGame::arbitrationGetSolo(unsigned iPlayerId) const
|
||||||
|
{
|
||||||
|
return getTypedGame<Arbitration>(m_game).getSolo(iPlayerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PublicGame::arbitrationToggleWarning(unsigned iPlayerId)
|
void PublicGame::arbitrationToggleWarning(unsigned iPlayerId)
|
||||||
{
|
{
|
||||||
Arbitration &game = getTypedGame<Arbitration>(m_game);
|
Arbitration &game = getTypedGame<Arbitration>(m_game);
|
||||||
|
|
|
@ -268,6 +268,9 @@ public:
|
||||||
Move arbitrationCheckWord(const wstring &iWord,
|
Move arbitrationCheckWord(const wstring &iWord,
|
||||||
const wstring &iCoords) const;
|
const wstring &iCoords) const;
|
||||||
|
|
||||||
|
void arbitrationToggleSolo(unsigned iPlayerId);
|
||||||
|
int arbitrationGetSolo(unsigned iPlayerId) const;
|
||||||
|
|
||||||
void arbitrationToggleWarning(unsigned iPlayerId);
|
void arbitrationToggleWarning(unsigned iPlayerId);
|
||||||
bool arbitrationHasWarning(unsigned iPlayerId) const;
|
bool arbitrationHasWarning(unsigned iPlayerId) const;
|
||||||
|
|
||||||
|
|
|
@ -236,18 +236,15 @@ Settings::Settings()
|
||||||
// Number of search results kept in a search
|
// Number of search results kept in a search
|
||||||
arbitration.add("search-limit", Setting::TypeInt) = 100;
|
arbitration.add("search-limit", Setting::TypeInt) = 100;
|
||||||
|
|
||||||
|
// Number of points granted for a solo (10 is the ODS value)
|
||||||
|
arbitration.add("solo-value", Setting::TypeInt) = 10;
|
||||||
|
|
||||||
// Default value of a penalty
|
// Default value of a penalty
|
||||||
arbitration.add("default-penalty", Setting::TypeInt) = 5;
|
arbitration.add("penalty-value", Setting::TypeInt) = 5;
|
||||||
|
|
||||||
// Maximum number of warnings before getting penalties
|
// Maximum number of warnings before getting penalties
|
||||||
arbitration.add("warnings-limit", Setting::TypeInt) = 3;
|
arbitration.add("warnings-limit", Setting::TypeInt) = 3;
|
||||||
|
|
||||||
// Minimum number of players in an arbitration game needed to apply a "solo" bonus
|
|
||||||
// (16 is the ODS value)
|
|
||||||
arbitration.add("solo-players", Setting::TypeInt) = 16;
|
|
||||||
// Number of points granted for a solo (10 is the ODS value)
|
|
||||||
arbitration.add("solo-value", Setting::TypeInt) = 10;
|
|
||||||
|
|
||||||
// Try to read the values from the configuration file
|
// Try to read the values from the configuration file
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -263,10 +260,9 @@ Settings::Settings()
|
||||||
copySetting<bool>(tmpConf, *m_conf, "freegame.reject-invalid");
|
copySetting<bool>(tmpConf, *m_conf, "freegame.reject-invalid");
|
||||||
copySetting<bool>(tmpConf, *m_conf, "arbitration.fill-rack");
|
copySetting<bool>(tmpConf, *m_conf, "arbitration.fill-rack");
|
||||||
copySetting<int>(tmpConf, *m_conf, "arbitration.search-limit");
|
copySetting<int>(tmpConf, *m_conf, "arbitration.search-limit");
|
||||||
copySetting<int>(tmpConf, *m_conf, "arbitration.default-penalty");
|
|
||||||
copySetting<int>(tmpConf, *m_conf, "arbitration.warnings-limit");
|
|
||||||
copySetting<int>(tmpConf, *m_conf, "arbitration.solo-players");
|
|
||||||
copySetting<int>(tmpConf, *m_conf, "arbitration.solo-value");
|
copySetting<int>(tmpConf, *m_conf, "arbitration.solo-value");
|
||||||
|
copySetting<int>(tmpConf, *m_conf, "arbitration.penalty-value");
|
||||||
|
copySetting<int>(tmpConf, *m_conf, "arbitration.warnings-limit");
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
@ -351,7 +347,9 @@ int Settings::getInt(const string &iName) const
|
||||||
return 10;
|
return 10;
|
||||||
else if (iName == "arbitration.search-limit")
|
else if (iName == "arbitration.search-limit")
|
||||||
return 100;
|
return 100;
|
||||||
else if (iName == "arbitration.default-penalty")
|
else if (iName == "arbitration.solo-value")
|
||||||
|
return 5;
|
||||||
|
else if (iName == "arbitration.penalty-value")
|
||||||
return 5;
|
return 5;
|
||||||
else if (iName == "arbitration.warnings-limit")
|
else if (iName == "arbitration.warnings-limit")
|
||||||
return 3;
|
return 3;
|
||||||
|
|
|
@ -78,6 +78,11 @@ ArbitAssignments::ArbitAssignments(QWidget *parent, PublicGame *iGame)
|
||||||
this, SLOT(assignTopMove()));
|
this, SLOT(assignTopMove()));
|
||||||
treeViewPlayers->installEventFilter(filter);
|
treeViewPlayers->installEventFilter(filter);
|
||||||
|
|
||||||
|
filter = new KeyEventFilter(this, Qt::Key_S);
|
||||||
|
QObject::connect(filter, SIGNAL(keyPressed(int, int)),
|
||||||
|
this, SLOT(addRemoveSolo()));
|
||||||
|
treeViewPlayers->installEventFilter(filter);
|
||||||
|
|
||||||
filter = new KeyEventFilter(this, Qt::Key_W);
|
filter = new KeyEventFilter(this, Qt::Key_W);
|
||||||
QObject::connect(filter, SIGNAL(keyPressed(int, int)),
|
QObject::connect(filter, SIGNAL(keyPressed(int, int)),
|
||||||
this, SLOT(addRemoveWarning()));
|
this, SLOT(addRemoveWarning()));
|
||||||
|
@ -271,7 +276,15 @@ void ArbitAssignments::populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint)
|
||||||
this, SLOT(assignTopMove()));
|
this, SLOT(assignTopMove()));
|
||||||
iMenu.addAction(assignTopMoveAction);
|
iMenu.addAction(assignTopMoveAction);
|
||||||
|
|
||||||
// Action to warn (or "unwarn") players
|
// Action to give or remove a solo to players
|
||||||
|
QAction *soloAction = new QAction(_q("Give (or remove) a solo"), this);
|
||||||
|
soloAction->setStatusTip(_q("Give a solo to the selected player, or remove it if (s)he already has one"));
|
||||||
|
soloAction->setShortcut(Qt::Key_S);
|
||||||
|
QObject::connect(soloAction, SIGNAL(triggered()),
|
||||||
|
this, SLOT(addRemoveSolo()));
|
||||||
|
iMenu.addAction(soloAction);
|
||||||
|
|
||||||
|
// Action to give or remove a warning to players
|
||||||
QAction *warningAction = new QAction(_q("Give (or remove) a warning"), this);
|
QAction *warningAction = new QAction(_q("Give (or remove) a warning"), this);
|
||||||
warningAction->setStatusTip(_q("Give a warning to the selected player(s), or remove it if they already have one"));
|
warningAction->setStatusTip(_q("Give a warning to the selected player(s), or remove it if they already have one"));
|
||||||
warningAction->setShortcut(Qt::Key_W);
|
warningAction->setShortcut(Qt::Key_W);
|
||||||
|
@ -279,9 +292,9 @@ void ArbitAssignments::populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint)
|
||||||
this, SLOT(addRemoveWarning()));
|
this, SLOT(addRemoveWarning()));
|
||||||
iMenu.addAction(warningAction);
|
iMenu.addAction(warningAction);
|
||||||
|
|
||||||
// Action to give a penalty to players
|
// Action to give or remove a penalty to players
|
||||||
QAction *penaltyAction = new QAction(_q("Give a penalty"), this);
|
QAction *penaltyAction = new QAction(_q("Give (or remove) a penalty"), this);
|
||||||
penaltyAction->setStatusTip(_q("Give a penalty to the selected player(s)"));
|
penaltyAction->setStatusTip(_q("Give a penalty to the selected player(s), or remove it if they already have one"));
|
||||||
penaltyAction->setShortcut(Qt::Key_P);
|
penaltyAction->setShortcut(Qt::Key_P);
|
||||||
QObject::connect(penaltyAction, SIGNAL(triggered()),
|
QObject::connect(penaltyAction, SIGNAL(triggered()),
|
||||||
this, SLOT(addRemovePenalty()));
|
this, SLOT(addRemovePenalty()));
|
||||||
|
@ -596,6 +609,21 @@ void ArbitAssignments::helperAssignMove(const Move &iMove)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ArbitAssignments::addRemoveSolo()
|
||||||
|
{
|
||||||
|
QSet<unsigned int> playersIdSet = getSelectedPlayers();
|
||||||
|
// Only one player can have a solo
|
||||||
|
if (playersIdSet.size() != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BOOST_FOREACH(unsigned int id, playersIdSet)
|
||||||
|
{
|
||||||
|
m_game->arbitrationToggleSolo(id);
|
||||||
|
}
|
||||||
|
emit gameUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ArbitAssignments::addRemoveWarning()
|
void ArbitAssignments::addRemoveWarning()
|
||||||
{
|
{
|
||||||
QSet<unsigned int> playersIdSet = getSelectedPlayers();
|
QSet<unsigned int> playersIdSet = getSelectedPlayers();
|
||||||
|
|
|
@ -81,6 +81,7 @@ private slots:
|
||||||
void populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint);
|
void populatePlayersMenu(QMenu &iMenu, const QPoint &iPoint);
|
||||||
void assignTopMove();
|
void assignTopMove();
|
||||||
void suppressMove();
|
void suppressMove();
|
||||||
|
void addRemoveSolo();
|
||||||
void addRemoveWarning();
|
void addRemoveWarning();
|
||||||
void addRemovePenalty();
|
void addRemovePenalty();
|
||||||
void endTurn();
|
void endTurn();
|
||||||
|
|
|
@ -135,9 +135,8 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
|
||||||
bool linkArbit7P1 = qs.value(kARBIT_LINK_7P1, false).toBool();
|
bool linkArbit7P1 = qs.value(kARBIT_LINK_7P1, false).toBool();
|
||||||
checkBoxArbitLink7P1->setChecked(linkArbit7P1);
|
checkBoxArbitLink7P1->setChecked(linkArbit7P1);
|
||||||
spinBoxArbitSearchLimit->setValue(Settings::Instance().getInt("arbitration.search-limit"));
|
spinBoxArbitSearchLimit->setValue(Settings::Instance().getInt("arbitration.search-limit"));
|
||||||
spinBoxArbitDefPenalty->setValue(Settings::Instance().getInt("arbitration.default-penalty"));
|
spinBoxArbitPenaltyValue->setValue(Settings::Instance().getInt("arbitration.penalty-value"));
|
||||||
spinBoxArbitWarnLimit->setValue(Settings::Instance().getInt("arbitration.warnings-limit"));
|
spinBoxArbitWarnLimit->setValue(Settings::Instance().getInt("arbitration.warnings-limit"));
|
||||||
spinBoxArbitSoloPlayers->setValue(Settings::Instance().getInt("arbitration.solo-players"));
|
|
||||||
spinBoxArbitSoloValue->setValue(Settings::Instance().getInt("arbitration.solo-value"));
|
spinBoxArbitSoloValue->setValue(Settings::Instance().getInt("arbitration.solo-value"));
|
||||||
|
|
||||||
// Confirmations
|
// Confirmations
|
||||||
|
@ -255,12 +254,10 @@ void PrefsDialog::updateSettings()
|
||||||
}
|
}
|
||||||
Settings::Instance().setInt("arbitration.search-limit",
|
Settings::Instance().setInt("arbitration.search-limit",
|
||||||
spinBoxArbitSearchLimit->value());
|
spinBoxArbitSearchLimit->value());
|
||||||
Settings::Instance().setInt("arbitration.default-penalty",
|
Settings::Instance().setInt("arbitration.penalty-value",
|
||||||
spinBoxArbitDefPenalty->value());
|
spinBoxArbitPenaltyValue->value());
|
||||||
Settings::Instance().setInt("arbitration.warnings-limit",
|
Settings::Instance().setInt("arbitration.warnings-limit",
|
||||||
spinBoxArbitWarnLimit->value());
|
spinBoxArbitWarnLimit->value());
|
||||||
Settings::Instance().setInt("arbitration.solo-players",
|
|
||||||
spinBoxArbitSoloPlayers->value());
|
|
||||||
Settings::Instance().setInt("arbitration.solo-value",
|
Settings::Instance().setInt("arbitration.solo-value",
|
||||||
spinBoxArbitSoloValue->value());
|
spinBoxArbitSoloValue->value());
|
||||||
|
|
||||||
|
|
|
@ -108,12 +108,12 @@ void StatsWidget::refresh()
|
||||||
|
|
||||||
setSectionHidden(col, !isArbit && !canHaveSolos);
|
setSectionHidden(col, !isArbit && !canHaveSolos);
|
||||||
setModelHeader(col++, _q("Sub-total"), false);
|
setModelHeader(col++, _q("Sub-total"), false);
|
||||||
setSectionHidden(col, !isArbit);
|
|
||||||
setModelHeader(col++, _q("Warnings"), false);
|
|
||||||
setSectionHidden(col, !isArbit);
|
|
||||||
setModelHeader(col++, _q("Penalties"), false);
|
|
||||||
setSectionHidden(col, !isArbit && !canHaveSolos);
|
setSectionHidden(col, !isArbit && !canHaveSolos);
|
||||||
setModelHeader(col++, _q("Solo points"), false);
|
setModelHeader(col++, _q("Solo points"), false);
|
||||||
|
setSectionHidden(col, !isArbit);
|
||||||
|
setModelHeader(col++, _q("Penalties"), false);
|
||||||
|
setSectionHidden(col, !isArbit);
|
||||||
|
setModelHeader(col++, _q("Warnings"), false);
|
||||||
|
|
||||||
setModelHeader(col++, _q("Total"), false);
|
setModelHeader(col++, _q("Total"), false);
|
||||||
setModelHeader(col++, _q("Diff"), false);
|
setModelHeader(col++, _q("Diff"), false);
|
||||||
|
@ -277,12 +277,12 @@ void StatsWidget::setModelTurnData(const QModelIndex &iIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the background c constolor
|
// Set the background c constolor
|
||||||
if (iTurn.getPenaltyPoints() != 0)
|
if (iTurn.getSoloPoints() != 0)
|
||||||
|
m_model->setData(iIndex, SoloBrush, Qt::BackgroundRole);
|
||||||
|
else if (iTurn.getPenaltyPoints() != 0)
|
||||||
m_model->setData(iIndex, PenaltyBrush, Qt::BackgroundRole);
|
m_model->setData(iIndex, PenaltyBrush, Qt::BackgroundRole);
|
||||||
else if (iTurn.getWarningsNb() != 0)
|
else if (iTurn.getWarningsNb() != 0)
|
||||||
m_model->setData(iIndex, WarningBrush, Qt::BackgroundRole);
|
m_model->setData(iIndex, WarningBrush, Qt::BackgroundRole);
|
||||||
else if (iTurn.getSoloPoints() != 0)
|
|
||||||
m_model->setData(iIndex, SoloBrush, Qt::BackgroundRole);
|
|
||||||
else if (iTurn.getMove().isNull())
|
else if (iTurn.getMove().isNull())
|
||||||
m_model->setData(iIndex, PassBrush, Qt::BackgroundRole);
|
m_model->setData(iIndex, PassBrush, Qt::BackgroundRole);
|
||||||
|
|
||||||
|
@ -300,12 +300,12 @@ void StatsWidget::setModelEventData(const QModelIndex &iIndex,
|
||||||
int iEvent, const Player &iPlayer)
|
int iEvent, const Player &iPlayer)
|
||||||
{
|
{
|
||||||
QVariant text;
|
QVariant text;
|
||||||
if (iEvent == 0 && iPlayer.getWarningsNb() != 0)
|
if (iEvent == 0 && iPlayer.getSoloPoints() != 0)
|
||||||
text = iPlayer.getWarningsNb();
|
text = iPlayer.getSoloPoints();
|
||||||
else if (iEvent == 1 && iPlayer.getPenaltyPoints() != 0)
|
else if (iEvent == 1 && iPlayer.getPenaltyPoints() != 0)
|
||||||
text = iPlayer.getPenaltyPoints();
|
text = iPlayer.getPenaltyPoints();
|
||||||
else if (iEvent == 2 && iPlayer.getSoloPoints() != 0)
|
else if (iEvent == 2 && iPlayer.getWarningsNb() != 0)
|
||||||
text = iPlayer.getSoloPoints();
|
text = iPlayer.getWarningsNb();
|
||||||
setModelText(iIndex, text);
|
setModelText(iIndex, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +352,10 @@ QString StatsWidget::getTooltip(const Turn &iTurn, const Turn &iGameTurn) const
|
||||||
tooltip += "\n" + scoreString.arg(score - gameScore);
|
tooltip += "\n" + scoreString.arg(score - gameScore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iTurn.getSoloPoints())
|
||||||
|
{
|
||||||
|
tooltip += "\n" + _q("Solo: %1").arg(iTurn.getSoloPoints());
|
||||||
|
}
|
||||||
if (iTurn.getWarningsNb())
|
if (iTurn.getWarningsNb())
|
||||||
{
|
{
|
||||||
tooltip += "\n" + _q("Warnings: %1").arg(iTurn.getWarningsNb());
|
tooltip += "\n" + _q("Warnings: %1").arg(iTurn.getWarningsNb());
|
||||||
|
@ -360,10 +364,6 @@ QString StatsWidget::getTooltip(const Turn &iTurn, const Turn &iGameTurn) const
|
||||||
{
|
{
|
||||||
tooltip += "\n" + _q("Penalties: %1").arg(iTurn.getPenaltyPoints());
|
tooltip += "\n" + _q("Penalties: %1").arg(iTurn.getPenaltyPoints());
|
||||||
}
|
}
|
||||||
if (iTurn.getSoloPoints())
|
|
||||||
{
|
|
||||||
tooltip += "\n" + _q("Solo: %1").arg(iTurn.getSoloPoints());
|
|
||||||
}
|
|
||||||
return tooltip;
|
return tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>474</width>
|
<width>474</width>
|
||||||
<height>655</height>
|
<height>622</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -363,7 +363,7 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QSpinBox" name="spinBoxArbitWarnLimit">
|
<widget class="QSpinBox" name="spinBoxArbitWarnLimit">
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
|
@ -380,22 +380,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_10">
|
<widget class="QLabel" name="label_10">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>_("Default penalty value:")</string>
|
<string>_("Penalty value:")</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>_("Warnings limit:")</string>
|
<string>_("Warnings limit:")</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="spinBoxArbitDefPenalty">
|
<widget class="QSpinBox" name="spinBoxArbitPenaltyValue">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>_("Default number of points for a penalty")</string>
|
<string>_("Default number of points for a penalty")</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -407,13 +407,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>_("Search results limit:")</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -427,37 +420,27 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="QSpinBox" name="spinBoxArbitSoloValue">
|
<widget class="QLabel" name="label_9">
|
||||||
<property name="toolTip">
|
<property name="text">
|
||||||
<string>_("Value of the solo bonus. Set it to 0 if you don't want solo bonus")</string>
|
<string>_("Search results limit:")</string>
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_12">
|
<widget class="QLabel" name="label_12">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>_("Solo value:")</string>
|
<string>_("Solo value:")</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QSpinBox" name="spinBoxArbitSoloValue">
|
||||||
<property name="text">
|
|
||||||
<string>_("Min. players for a solo:")</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QSpinBox" name="spinBoxArbitSoloPlayers">
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>_("Minimum number of players needed to take into account the solo bonus")</string>
|
<string>_("Value of the solo bonus. Set it to 0 if you don't want solo bonus")</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>16</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -636,7 +619,7 @@
|
||||||
<tabstop>checkBoxArbitFillRack</tabstop>
|
<tabstop>checkBoxArbitFillRack</tabstop>
|
||||||
<tabstop>checkBoxArbitLink7P1</tabstop>
|
<tabstop>checkBoxArbitLink7P1</tabstop>
|
||||||
<tabstop>spinBoxArbitSearchLimit</tabstop>
|
<tabstop>spinBoxArbitSearchLimit</tabstop>
|
||||||
<tabstop>spinBoxArbitDefPenalty</tabstop>
|
<tabstop>spinBoxArbitPenaltyValue</tabstop>
|
||||||
<tabstop>checkBoxConfoStartGame</tabstop>
|
<tabstop>checkBoxConfoStartGame</tabstop>
|
||||||
<tabstop>checkBoxConfoLoadGame</tabstop>
|
<tabstop>checkBoxConfoLoadGame</tabstop>
|
||||||
<tabstop>checkBoxConfoLoadDic</tabstop>
|
<tabstop>checkBoxConfoLoadDic</tabstop>
|
||||||
|
|
Loading…
Reference in a new issue