summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Wadham <[email protected]>2015-07-17 13:18:28 +1000
committerIan Wadham <[email protected]>2015-07-17 13:18:28 +1000
commit75035ff90a545f43c28c3bb356ac093689954d08 (patch)
tree08c9925caf36c47d24dea0d0f16a2f987da91367
parent80c4dbabdf6666fe67802f98b500b58ca9851326 (diff)
Fix parameters in puzzle-generator's messages - no more .arg's.
-rw-r--r--src/generator/sudokuboard.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/generator/sudokuboard.cpp b/src/generator/sudokuboard.cpp
index ed06ace..09d958b 100644
--- a/src/generator/sudokuboard.cpp
+++ b/src/generator/sudokuboard.cpp
@@ -190,6 +190,9 @@ bool SudokuBoard::generateSudokuRoxdokuTypes (BoardContents & puzzle,
puzzle = currPuzzle;
}
+ // Express the rating to 1 decimal place in whatever locale we have.
+ QString ratingStr = ki18n("%1").subs(bestRating, 0, 'f', 1).toString();
+ // Check and explain the Sudoku/Roxdoku puzzle-generator's results.
if ((d < difficultyRequired) && (count >= maxTries)) {
// Exit after max attempts?
QWidget owner;
@@ -201,9 +204,9 @@ bool SudokuBoard::generateSudokuRoxdokuTypes (BoardContents & puzzle,
"\n"
"If you accept the puzzle, it may help to change to "
"No Symmetry or some low symmetry type, then use "
- "Game->New and try generating another puzzle.")
- .arg(maxTries).arg(bestDifficulty)
- .arg(bestRating, 0, 'f', 1).arg(difficultyRequired),
+ "Game->New and try generating another puzzle.",
+ maxTries, bestDifficulty,
+ ratingStr, difficultyRequired),
i18n("Difficulty Level"),
KGuiItem(i18n("&Try Again")), KGuiItem(i18n("&Accept")));
if (ans == KMessageBox::Yes) {
@@ -216,19 +219,20 @@ bool SudokuBoard::generateSudokuRoxdokuTypes (BoardContents & puzzle,
QWidget owner;
int ans = 0;
if (m_accum.nGuesses == 0) {
- const QString rating = QString("%1").arg(bestRating, 0, 'f', 1);
ans = KMessageBox::questionYesNo (&owner,
i18n("It will be possible to solve the generated puzzle "
"by logic alone. No guessing will be required.\n"
"\n"
"The internal difficulty rating is %1. There are "
- "%2 clues at the start and %3 moves to go.", rating, bestNClues, (m_stats.nCells - bestNClues)),
+ "%2 clues at the start and %3 moves to go.",
+ ratingStr, bestNClues,
+ (m_stats.nCells - bestNClues)),
i18n("Difficulty Level"),
KGuiItem(i18n("&OK")), KGuiItem(i18n("&Retry")));
}
else {
- const QString average = QString::fromLatin1("%1").arg(((float) bestNGuesses) / 5.0, 0, 'f', 1);
- const QString rating = QString::fromLatin1("%1").arg(bestRating, 0, 'f', 1);
+ QString avGuessStr = ki18n("%1").subs(((float) bestNGuesses) /
+ 5.0, 0, 'f', 1).toString(); // Format as for ratingStr.
ans = KMessageBox::questionYesNo (&owner,
i18n("Solving the generated puzzle will require an "
"average of %1 guesses or branch points and if you "
@@ -237,8 +241,8 @@ bool SudokuBoard::generateSudokuRoxdokuTypes (BoardContents & puzzle,
"\n"
"The internal difficulty rating is %3, there are "
"%4 clues at the start and %5 moves to go.",
- average, bestFirstGuessAt, rating, bestNClues,
- (m_stats.nCells - bestNClues)),
+ avGuessStr, bestFirstGuessAt, ratingStr,
+ bestNClues, (m_stats.nCells - bestNClues)),
i18n("Difficulty Level"),
KGuiItem(i18n("&OK")), KGuiItem(i18n("&Retry")));
}