From 5642bfa191ccbadd1b175b8682cac820baac1ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Sat, 6 Mar 2010 16:53:37 +0000 Subject: [PATCH] Fixed loading of games, for languages with multichar letters like Catalan --- game/xml_reader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/game/xml_reader.cpp b/game/xml_reader.cpp index e3d5d8f..22d2d40 100644 --- a/game/xml_reader.cpp +++ b/game/xml_reader.cpp @@ -112,10 +112,10 @@ static Move buildMove(const Game &iGame, map &attr, string type = attr["type"]; if (type == "valid") { + wstring word = iGame.getDic().convertFromInput(fromUtf8(attr["word"])); Round round; int res = iGame.checkPlayedWord(fromUtf8(attr["coord"]), - fromUtf8(attr["word"]), - round, checkRack); + word, round, checkRack); if (res != 0) { throw LoadGameException("Invalid move marked as valid: " + @@ -269,12 +269,13 @@ void XmlReader::endElement(const string& namespaceURI, else if (tag == "PlayerRack") { // Build a rack for the correct player + const wstring &rackStr = m_dic.convertFromInput(fromUtf8(m_data)); PlayedRack pldrack; - if (!m_dic.validateLetters(fromUtf8(m_data), L"-+")) + if (!m_dic.validateLetters(rackStr, L"-+")) { throw LoadGameException("Rack invalid for the current dictionary: " + m_data); } - pldrack.setManual(fromUtf8(m_data)); + pldrack.setManual(rackStr); #if 0 cerr << "loaded rack: " << convertToMb(pldrack.toString()) << endl; #endif