mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-25 21:59:30 +01:00
Hints: fix a bug in WordLettersHint.
The letters of a word containing digraph tiles (like the Catalan 'QU') were sorted incorrectly. For example, "AQUIETE" was sorted as "AEEIQTU" instead of "AEEITQU". Note: it would be even better as "AEEIQUT", but this is a different problem...
This commit is contained in:
parent
3b51da76ce
commit
7c7e26cc16
1 changed files with 12 additions and 3 deletions
|
@ -19,6 +19,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#if ENABLE_NLS
|
#if ENABLE_NLS
|
||||||
|
@ -146,9 +147,17 @@ WordLettersHint::WordLettersHint()
|
||||||
string WordLettersHint::giveHint(const Move &iMove) const
|
string WordLettersHint::giveHint(const Move &iMove) const
|
||||||
{
|
{
|
||||||
ASSERT(iMove.isValid(), "Hints only make sense for valid moves");
|
ASSERT(iMove.isValid(), "Hints only make sense for valid moves");
|
||||||
wstring word = iMove.getRound().getWord();
|
vector<Tile> tiles = iMove.getRound().getTiles();
|
||||||
// Sort the letters
|
// Sort the letters (we cannot sort directly the wstring from
|
||||||
std::sort(word.begin(), word.end());
|
// Round::getWord(), because it would break digraph characters)
|
||||||
|
std::sort(tiles.begin(), tiles.end());
|
||||||
|
|
||||||
|
// Get the word
|
||||||
|
wstring word;
|
||||||
|
BOOST_FOREACH(const Tile &tile, tiles)
|
||||||
|
{
|
||||||
|
word += tile.getDisplayStr();
|
||||||
|
}
|
||||||
|
|
||||||
return str(boost::format(_("Word letters: %1%"))
|
return str(boost::format(_("Word letters: %1%"))
|
||||||
% lfw(word));
|
% lfw(word));
|
||||||
|
|
Loading…
Reference in a new issue