eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot dic/compdic.cpp dic/dic_search.cpp dic/he...


From: Olivier Teulière
Subject: [Eliot-dev] eliot dic/compdic.cpp dic/dic_search.cpp dic/he...
Date: Sat, 30 Jul 2011 19:48:07 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>       11/07/30 19:48:07

Modified files:
        dic            : compdic.cpp dic_search.cpp header.cpp 
                         listdic.cpp regexpmain.cpp tile.cpp 
        game           : bag.cpp coord.cpp duplicate.cpp freegame.cpp 
                         game.cpp game_factory.cpp game_io.cpp 
                         navigation.cpp rack.cpp training.cpp 
                         xml_reader.cpp xml_writer.cpp 
        utils          : eliottxt.cpp game_io.cpp ncurses.cpp 

Log message:
        Replace the use of convertToMb() and convertToWc() with macros

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/compdic.cpp?cvsroot=eliot&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/dic_search.cpp?cvsroot=eliot&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/header.cpp?cvsroot=eliot&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/listdic.cpp?cvsroot=eliot&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/regexpmain.cpp?cvsroot=eliot&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/tile.cpp?cvsroot=eliot&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/eliot/game/bag.cpp?cvsroot=eliot&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/eliot/game/coord.cpp?cvsroot=eliot&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/eliot/game/duplicate.cpp?cvsroot=eliot&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/eliot/game/freegame.cpp?cvsroot=eliot&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/eliot/game/game.cpp?cvsroot=eliot&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/eliot/game/game_factory.cpp?cvsroot=eliot&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/eliot/game/game_io.cpp?cvsroot=eliot&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/eliot/game/navigation.cpp?cvsroot=eliot&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/eliot/game/rack.cpp?cvsroot=eliot&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/eliot/game/training.cpp?cvsroot=eliot&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/eliot/game/xml_reader.cpp?cvsroot=eliot&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/eliot/game/xml_writer.cpp?cvsroot=eliot&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/eliottxt.cpp?cvsroot=eliot&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/game_io.cpp?cvsroot=eliot&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/ncurses.cpp?cvsroot=eliot&r1=1.36&r2=1.37

Patches:
Index: dic/compdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/compdic.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- dic/compdic.cpp     30 Jul 2011 19:46:47 -0000      1.24
+++ dic/compdic.cpp     30 Jul 2011 19:48:05 -0000      1.25
@@ -90,7 +90,7 @@
     if (!iswalpha(chr) && chr != L'?')
     {
         ostringstream ss;
-        ss << fmt(_("'%1%' is not a valid letter.")) % convertToMb(chr) << 
endl;
+        ss << fmt(_("'%1%' is not a valid letter.")) % lfw(chr) << endl;
         ss << fmt(_("For technical reasons, Eliot currently only supports "
                     "alphabetical characters as internal character "
                     "representation, even if the tile has a display string "
@@ -324,7 +324,7 @@
                              const string &iDawgFile,
                              const string &iDicName)
 {
-    m_headerInfo.dicName = convertToWc(iDicName);
+    m_headerInfo.dicName = wfl(iDicName);
     // We are not (yet) able to build the GADDAG format
     m_headerInfo.dawg = true;
 

Index: dic/dic_search.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/dic_search.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- dic/dic_search.cpp  21 Sep 2009 20:10:34 -0000      1.18
+++ dic/dic_search.cpp  30 Jul 2011 19:48:05 -0000      1.19
@@ -427,7 +427,7 @@
     if (!parsingOk)
     {
         delete root;
-        throw InvalidRegexpException(convertToMb(iRegexp));
+        throw InvalidRegexpException(lfw(iRegexp));
     }
 
     int ptl[REGEXP_MAX+1];

Index: dic/header.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/header.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- dic/header.cpp      30 Jul 2011 19:46:47 -0000      1.17
+++ dic/header.cpp      30 Jul 2011 19:48:05 -0000      1.18
@@ -220,7 +220,7 @@
     }
 
     m_compressDate = time(NULL);
-    m_userHost = convertToWc(ELIOT_COMPILE_BY + string("@") + 
ELIOT_COMPILE_HOST);
+    m_userHost = wfl(ELIOT_COMPILE_BY + string("@") + ELIOT_COMPILE_HOST);
     m_root = iInfo.root;
     m_nbWords = iInfo.nwords;
     m_nodesUsed = iInfo.nodesused;
@@ -307,7 +307,7 @@
         char s[5];
         sprintf(s, "%d", iChar);
         format fmt(_("Header::getCodeFromChar: No code for letter '%1%' 
(val=%2%)"));
-        fmt % convertToMb(iChar) % s;
+        fmt % lfw(iChar) % s;
         throw DicException(fmt.str());
     }
     return pair->second;
@@ -624,13 +624,13 @@
 void Header::print() const
 {
 #define fmt(x) boost::format(x)
-    cout << fmt(_("Dictionary name: %1%")) % convertToMb(m_dicName) << endl;
+    cout << fmt(_("Dictionary name: %1%")) % lfw(m_dicName) << endl;
     char buf[150];
     strftime(buf, sizeof(buf), "%c", gmtime(&m_compressDate));
     cout << fmt(_("Compressed on: %1%")) % buf << endl;
-    cout << fmt(_("Compressed using a binary compiled by: %1%")) % 
convertToMb(m_userHost) << endl;
+    cout << fmt(_("Compressed using a binary compiled by: %1%")) % 
lfw(m_userHost) << endl;
     cout << fmt(_("Dictionary type: %1%")) % (m_type == kDAWG ? "DAWG" : 
"GADDAG") << endl;
-    cout << fmt(_("Letters: %1%")) % convertToMb(m_letters) << endl;
+    cout << fmt(_("Letters: %1%")) % lfw(m_letters) << endl;
     cout << fmt(_("Number of letters: %1%")) % m_letters.size() << endl;
     cout << fmt(_("Number of words: %1%")) % m_nbWords << endl;
     long unsigned int size = sizeof(Dict_header_old) +
@@ -668,7 +668,7 @@
                     first = false;
                 else
                     s += " ";
-                s += convertToMb(inputs[j]);
+                s += lfw(inputs[j]);
             }
             fmter % s;
         }

Index: dic/listdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/listdic.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- dic/listdic.cpp     18 Sep 2010 13:07:39 -0000      1.7
+++ dic/listdic.cpp     30 Jul 2011 19:48:05 -0000      1.8
@@ -40,7 +40,7 @@
     if (edge.term)  /* edge points at a complete word */
     {
         *s = '\0';
-        out << convertToMb(buf) << endl;
+        out << lfw(buf) << endl;
     }
     if (edge.ptr)
     {           /* Compute index: is it non-zero ? */

Index: dic/regexpmain.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/regexpmain.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- dic/regexpmain.cpp  3 Jul 2009 21:40:15 -0000       1.12
+++ dic/regexpmain.cpp  30 Jul 2011 19:48:05 -0000      1.13
@@ -94,12 +94,12 @@
             vector<wstring> wordList;
             try
             {
-                dic.searchRegExp(convertToWc(line), wordList, 1, 15);
+                dic.searchRegExp(wfl(line), wordList, 1, 15);
                 cout << _("result:") << endl;
                 vector<wstring>::const_iterator it;
                 for (it = wordList.begin(); it != wordList.end(); it++)
                 {
-                    cout << convertToMb(*it) << endl;
+                    cout << lfw(*it) << endl;
                 }
             }
             catch (InvalidRegexpException &e)

Index: dic/tile.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/tile.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- dic/tile.cpp        1 Jan 2010 18:01:35 -0000       1.6
+++ dic/tile.cpp        30 Jul 2011 19:48:05 -0000      1.7
@@ -58,7 +58,7 @@
     else
     {
         ostringstream ss;
-        ss << "Tile::Tile: Unknown character: " << convertToMb(c);
+        ss << "Tile::Tile: Unknown character: " << lfw(c);
         throw DicException(ss.str());
     }
 }

Index: game/bag.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/bag.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- game/bag.cpp        6 Mar 2010 16:54:20 -0000       1.14
+++ game/bag.cpp        30 Jul 2011 19:48:06 -0000      1.15
@@ -82,7 +82,7 @@
 void Bag::takeTile(const Tile &iTile)
 {
     ASSERT(in(iTile),
-           "The bag does not contain the letter " + 
convertToMb(iTile.getDisplayStr()));
+           "The bag does not contain the letter " + 
lfw(iTile.getDisplayStr()));
 
     m_tilesMap[iTile]--;
     m_ntiles--;
@@ -92,7 +92,7 @@
 void Bag::replaceTile(const Tile &iTile)
 {
     ASSERT(in(iTile) < iTile.maxNumber(),
-           "Cannot replace tile: " + convertToMb(iTile.getDisplayStr()));
+           "Cannot replace tile: " + lfw(iTile.getDisplayStr()));
 
     m_tilesMap[iTile]++;
     m_ntiles++;

Index: game/coord.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/coord.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- game/coord.cpp      29 Nov 2009 16:01:32 -0000      1.13
+++ game/coord.cpp      30 Jul 2011 19:48:06 -0000      1.14
@@ -76,7 +76,7 @@
 {
     // TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
     // Temporary implementation: convert the wchar_t* string into a char* one
-    string iStr = convertToMb(iWStr);
+    string iStr = lfw(iWStr);
 
     char l[4];
     int col;

Index: game/duplicate.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/duplicate.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- game/duplicate.cpp  30 Jan 2011 00:23:45 -0000      1.36
+++ game/duplicate.cpp  30 Jul 2011 19:48:06 -0000      1.37
@@ -187,7 +187,7 @@
 
 void Duplicate::recordPlayerMove(const Move &iMove, Player &ioPlayer, bool 
isForHuman)
 {
-    LOG_INFO("Player " << ioPlayer.getId() << " plays: " << 
convertToMb(iMove.toString()));
+    LOG_INFO("Player " << ioPlayer.getId() << " plays: " << 
lfw(iMove.toString()));
     Command *pCmd = new PlayerMoveCmd(ioPlayer, iMove);
     pCmd->setAutoExecution(!isForHuman);
     accessNavigation().addAndExecute(pCmd);

Index: game/freegame.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/freegame.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- game/freegame.cpp   30 Jan 2011 00:23:45 -0000      1.35
+++ game/freegame.cpp   30 Jul 2011 19:48:06 -0000      1.36
@@ -116,7 +116,7 @@
 void FreeGame::recordPlayerMove(const Move &iMove, Player &ioPlayer,
                                 bool isForHuman)
 {
-    LOG_INFO("Player " << ioPlayer.getId() << " plays: " << 
convertToMb(iMove.toString()));
+    LOG_INFO("Player " << ioPlayer.getId() << " plays: " << 
lfw(iMove.toString()));
     Command *pCmd = new PlayerMoveCmd(ioPlayer, iMove);
     pCmd->setAutoExecution(!isForHuman);
     accessNavigation().addAndExecute(pCmd);

Index: game/game.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/game.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- game/game.cpp       29 Jan 2011 23:47:21 -0000      1.59
+++ game/game.cpp       30 Jul 2011 19:48:06 -0000      1.60
@@ -344,8 +344,8 @@
             // Get the best word
             const Round & bestRound = res.get(0);
             LOG_DEBUG("helperSetRackRandom(): initial rack: "
-                      << convertToMb(pld.toString()) << " (best word: "
-                      << convertToMb(bestRound.getWord()) << ")");
+                      << lfw(pld.toString()) << " (best word: "
+                      << lfw(bestRound.getWord()) << ")");
 
             // Identify the joker
             for (unsigned int i = 0; i < bestRound.getWordLen(); ++i)
@@ -355,7 +355,7 @@
                     const Tile &jokerTile = bestRound.getTile(i);
                     Tile replacingTile(towupper(jokerTile.toChar()));
                     LOG_DEBUG("helperSetRackRandom(): replacing Joker with "
-                              << convertToMb(replacingTile.toChar()));
+                              << lfw(replacingTile.toChar()));
 
                     // If the bag does not contain this letter anymore,
                     // simply keep the joker in the rack.
@@ -459,7 +459,7 @@
     iPlayer->setId(getNPlayers());
     m_players.push_back(iPlayer);
 
-    LOG_INFO("Adding player '" << convertToMb(iPlayer->getName())
+    LOG_INFO("Adding player '" << lfw(iPlayer->getName())
              << "' (" << (iPlayer->isHuman() ? "human" : "AI") << ")"
              << " with ID " << iPlayer->getId());
 }

Index: game/game_factory.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/game_factory.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- game/game_factory.cpp       29 Jan 2011 23:47:21 -0000      1.14
+++ game/game_factory.cpp       30 Jul 2011 19:48:06 -0000      1.15
@@ -152,10 +152,10 @@
                     // TODO: use Boost.Format
                     char s[200];
                     snprintf(s, 200, _("Player %u"), m_players.size() + 1);
-                    name = convertToWc(s);
+                    name = wfl(s);
                 }
                 else
-                    name = convertToWc(optarg);
+                    name = wfl(optarg);
                 m_players.push_back(make_pair<bool, wstring>(res == 'u', 
name));
             }
             break;

Index: game/game_io.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/game_io.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- game/game_io.cpp    29 Jan 2011 23:47:21 -0000      1.15
+++ game/game_io.cpp    30 Jul 2011 19:48:06 -0000      1.16
@@ -128,7 +128,7 @@
 
             /* rack */
             strncpy(rack, token, sizeof(rack));
-            static_cast<Training*>(pGame)->setRackManual(false, 
convertToWc(rack));
+            static_cast<Training*>(pGame)->setRackManual(false, wfl(rack));
 
             /* word */
             token = strtok(NULL, delim);
@@ -164,7 +164,7 @@
             //debug("%s)", token);
             strncat(pos, token, sizeof(pos) - strlen(pos) - 1);
 
-            if ((ret = pGame->play(convertToWc(pos), convertToWc(word))))
+            if ((ret = pGame->play(wfl(pos), wfl(word))))
             {
                 GameFactory::Instance()->releaseGame(*pGame);
                 char tmp1[10];
@@ -327,11 +327,11 @@
 
         // Build a rack for the correct player
         PlayedRack pldrack;
-        if (!iDic.validateLetters(convertToWc(rack)))
+        if (!iDic.validateLetters(wfl(rack)))
         {
             throw GameException("Rack invalid for the current dictionary");
         }
-        pldrack.setManual(convertToWc(rack));
+        pldrack.setManual(wfl(rack));
 
         // Build a round
         Round round;
@@ -339,7 +339,7 @@
         if (bonus == '*')
             round.setBonus(1);
 
-        wstring word = convertToWc(tmpWord);
+        wstring word = wfl(tmpWord);
         Tile tile;
         if (isalpha(ref[0]))
         {
@@ -411,7 +411,7 @@
         {
             // Create the played rack
             PlayedRack pldrack;
-            pldrack.setManual(convertToWc(letters));
+            pldrack.setManual(wfl(letters));
             // Give the rack to the player
             pGame->m_players[nb]->setCurrentRack(pldrack);
         }

Index: game/navigation.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/navigation.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- game/navigation.cpp 29 Jan 2011 23:50:14 -0000      1.12
+++ game/navigation.cpp 30 Jul 2011 19:48:06 -0000      1.13
@@ -193,7 +193,7 @@
     int index = 0;
     BOOST_FOREACH(const Command *c, m_turnCommands)
     {
-        LOG_DEBUG(index << " " << convertToMb(c->toString()));
+        LOG_DEBUG(index << " " << lfw(c->toString()));
         ++index;
     }
 }

Index: game/rack.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/rack.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- game/rack.cpp       23 Jun 2009 12:41:53 -0000      1.11
+++ game/rack.cpp       30 Jul 2011 19:48:06 -0000      1.12
@@ -34,7 +34,7 @@
 void Rack::remove(const Tile &t)
 {
     ASSERT(in(t),
-           "The rack does not contain the letter " + 
convertToMb(t.getDisplayStr()));
+           "The rack does not contain the letter " + lfw(t.getDisplayStr()));
     m_tiles[t.toCode()]--;
     m_ntiles--;
 }

Index: game/training.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/training.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- game/training.cpp   30 Jan 2011 00:23:45 -0000      1.37
+++ game/training.cpp   30 Jul 2011 19:48:06 -0000      1.38
@@ -109,7 +109,7 @@
 
 void Training::recordPlayerMove(const Move &iMove, Player &ioPlayer)
 {
-    LOG_INFO("Player " << ioPlayer.getId() << " plays: " << 
convertToMb(iMove.toString()));
+    LOG_INFO("Player " << ioPlayer.getId() << " plays: " << 
lfw(iMove.toString()));
     // Update the rack and the score of the current player
     // PlayerMoveCmd::execute() must be called before Game::helperPlayMove()
     // (called in this class in endTurn()).
@@ -183,7 +183,7 @@
     ASSERT(getNPlayers() == 0,
            "Only one player can be added in Training mode");
     // Force the name of the player
-    iPlayer->setName(convertToWc(_("Training")));
+    iPlayer->setName(wfl(_("Training")));
     Game::addPlayer(iPlayer);
 }
 

Index: game/xml_reader.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/xml_reader.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- game/xml_reader.cpp 30 Jul 2011 19:46:47 -0000      1.4
+++ game/xml_reader.cpp 30 Jul 2011 19:48:06 -0000      1.5
@@ -284,12 +284,12 @@
             throw LoadGameException("Rack invalid for the current dictionary: 
" + m_data);
         }
         pldrack.setManual(rackStr);
-        LOG_DEBUG("loaded rack: " << convertToMb(pldrack.toString()));
+        LOG_DEBUG("loaded rack: " << lfw(pldrack.toString()));
 
         Player &p = getPlayer(m_players, m_attributes["playerid"]);
         PlayerRackCmd *cmd = new PlayerRackCmd(p, pldrack);
         m_game->accessNavigation().addAndExecute(cmd);
-        LOG_DEBUG("rack: " << convertToMb(pldrack.toString()));
+        LOG_DEBUG("rack: " << lfw(pldrack.toString()));
     }
 
     else if (tag == "PlayerMove")

Index: game/xml_writer.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/xml_writer.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- game/xml_writer.cpp 29 Jan 2011 23:47:21 -0000      1.3
+++ game/xml_writer.cpp 30 Jul 2011 19:48:06 -0000      1.4
@@ -77,7 +77,7 @@
     else if (iMove.getType() == Move::PASS)
         out << "pass\" />";
     else
-        throw SaveGameException("Unsupported move: " + 
convertToMb(iMove.toString()));
+        throw SaveGameException("Unsupported move: " + lfw(iMove.toString()));
 }
 
 void XmlWriter::write(const Game &iGame, const string &iFileName)
@@ -197,7 +197,7 @@
             else
             {
                 // XXX
-                //throw SaveGameException("Unsupported command: " + 
convertToMb(cmd->toString()));
+                //throw SaveGameException("Unsupported command: " + 
lfw(cmd->toString()));
             }
             // TODO
         }

Index: utils/eliottxt.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/eliottxt.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- utils/eliottxt.cpp  20 May 2010 20:27:47 -0000      1.43
+++ utils/eliottxt.cpp  30 Jul 2011 19:48:06 -0000      1.44
@@ -376,9 +376,9 @@
         else
         {
             if (iGame.getDic().searchWord(word))
-                printf("le mot -%s- existe\n", convertToMb(word).c_str());
+                printf("le mot -%s- existe\n", lfw(word).c_str());
             else
-                printf("le mot -%s- n'existe pas\n", 
convertToMb(word).c_str());
+                printf("le mot -%s- n'existe pas\n", lfw(word).c_str());
         }
     }
     else if (tokens[0][0] == L'h')
@@ -431,7 +431,7 @@
         {
             try
             {
-                iGame.save(convertToMb(word));
+                iGame.save(lfw(word));
             }
             catch (std::exception &e)
             {
@@ -477,7 +477,7 @@
         return;
     }
 
-    printf("search for %s (%d,%d,%d)\n", convertToMb(regexp).c_str(),
+    printf("search for %s (%d,%d,%d)\n", lfw(regexp).c_str(),
            nres, lmin, lmax);
 
     vector<wdstring> wordList;
@@ -493,7 +493,7 @@
 
     BOOST_FOREACH(const wdstring &wstr, wordList)
     {
-        printf("%s\n", convertToMb(wstr).c_str());
+        printf("%s\n", lfw(wstr).c_str());
     }
     printf("%lu printed results\n", (long unsigned)wordList.size());
 }
@@ -518,7 +518,7 @@
 
     try
     {
-        string setting = convertToMb(settingWide);
+        string setting = lfw(settingWide);
         if (type == L"i")
         {
             Settings::Instance().setInt(setting, wtoi(value.c_str()));
@@ -596,7 +596,7 @@
                                             vector<wdstring> wordList;
                                             iGame.getDic().searchBenj(word, 
wordList);
                                             BOOST_FOREACH(const wdstring 
&wstr, wordList)
-                                                cout << convertToMb(wstr) << 
endl;
+                                                cout << lfw(wstr) << endl;
                                         }
                                         break;
                                     case L'p':
@@ -607,10 +607,10 @@
                                             for (it = wordMap.begin(); it != 
wordMap.end(); ++it)
                                             {
                                                 if (it->first != 0)
-                                                    cout << "+" << 
convertToMb(iGame.getDic().getHeader().getDisplayStr(it->first)) << endl;
+                                                    cout << "+" << 
lfw(iGame.getDic().getHeader().getDisplayStr(it->first)) << endl;
                                                 BOOST_FOREACH(const wdstring 
&wstr, it->second)
                                                 {
-                                                    cout << "  " << 
convertToMb(wstr) << endl;
+                                                    cout << "  " << lfw(wstr) 
<< endl;
                                                 }
                                             }
                                         }
@@ -620,7 +620,7 @@
                                             vector<wdstring> wordList;
                                             iGame.getDic().searchRacc(word, 
wordList);
                                             BOOST_FOREACH(const wdstring 
&wstr, wordList)
-                                                cout << convertToMb(wstr) << 
endl;
+                                                cout << lfw(wstr) << endl;
                                         }
                                         break;
                                 }
@@ -861,7 +861,7 @@
                         const wstring &wfileName = checkFileNameToken(tokens, 
1);
                         if (wfileName != L"")
                         {
-                            string filename = convertToMb(wfileName);
+                            string filename = lfw(wfileName);
                             try
                             {
                                 PublicGame *game = PublicGame::load(filename, 
iDic);

Index: utils/game_io.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/game_io.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- utils/game_io.cpp   29 Nov 2009 16:01:34 -0000      1.20
+++ utils/game_io.cpp   30 Jul 2011 19:48:07 -0000      1.21
@@ -115,7 +115,7 @@
             {
                 bool j = iGame.getBoard().isJoker(row, col);
                 out << (j ? " ." : "  ")
-                    << convertToMb(iGame.getBoard().getDisplayStr(row, col));
+                    << lfw(iGame.getBoard().getDisplayStr(row, col));
             }
         }
         out << endl;
@@ -183,7 +183,7 @@
             if (iGame.getBoard().isVacant(row, col))
                 out << "-";
             else
-                out << convertToMb(iGame.getBoard().getDisplayStr(row, col));
+                out << lfw(iGame.getBoard().getDisplayStr(row, col));
         }
         out << endl;
     }
@@ -197,7 +197,7 @@
     {
         if (bag.in(tile) > 9)
             out << " ";
-        out << setw(2) << convertToMb(tile.getDisplayStr());
+        out << setw(2) << lfw(tile.getDisplayStr());
     }
     out << endl;
 
@@ -211,7 +211,7 @@
 
 void GameIO::printPlayedRack(ostream &out, const PublicGame &iGame, int 
__UNUSED__ n)
 {
-    out << 
convertToMb(iGame.getCurrentPlayer().getCurrentRack().toString(PlayedRack::RACK_SIMPLE))
 << endl;
+    out << 
lfw(iGame.getCurrentPlayer().getCurrentRack().toString(PlayedRack::RACK_SIMPLE))
 << endl;
 }
 
 
@@ -220,7 +220,7 @@
     for (unsigned int j = 0; j < iGame.getNbPlayers(); j++)
     {
         out << "Rack " << j << ": ";
-        out << 
convertToMb(iGame.getPlayer(j).getCurrentRack().toString(PlayedRack::RACK_EXTRA))
 << endl;
+        out << 
lfw(iGame.getPlayer(j).getCurrentRack().toString(PlayedRack::RACK_EXTRA)) << 
endl;
     }
 }
 
@@ -231,10 +231,10 @@
     const wstring &word = r.getWord();
     if (word.empty())
         return;
-    out << convertToMb(word) << string(16 - word.size(), ' ')
+    out << lfw(word) << string(16 - word.size(), ' ')
         << (r.getBonus() ? '*' : ' ')
         << setw(4) << r.getPoints()
-        << ' ' << convertToMb(r.getCoord().toString());
+        << ' ' << lfw(r.getCoord().toString());
 }
 
 

Index: utils/ncurses.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/ncurses.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- utils/ncurses.cpp   29 Jan 2011 23:47:22 -0000      1.36
+++ utils/ncurses.cpp   30 Jul 2011 19:48:07 -0000      1.37
@@ -257,12 +257,12 @@
                 if (m_game->getBoard().isJoker(row, col))
                 {
                     wattron(win, A_BOLD | COLOR_PAIR(COLOR_GREEN));
-                    mvwprintw(win, y + row + 1, x + 3 * col + 2 + offset, 
convertToMb(chr).c_str());
+                    mvwprintw(win, y + row + 1, x + 3 * col + 2 + offset, 
lfw(chr).c_str());
                     wattroff(win, A_BOLD);
                 }
                 else
                 {
-                    mvwprintw(win, y + row + 1, x + 3 * col + 2 + offset, 
convertToMb(chr).c_str());
+                    mvwprintw(win, y + row + 1, x + 3 * col + 2 + offset, 
lfw(chr).c_str());
                 }
             }
             else
@@ -298,7 +298,7 @@
         if (m_game->getMode() != PublicGame::kTRAINING && i == currId)
             attron(A_BOLD);
         mvwprintw(win, y + i + 1, x + 2, _("%s: %d"),
-                  truncOrPad(convertToMb(m_game->getPlayer(i).getName()),
+                  truncOrPad(lfw(m_game->getPlayer(i).getName()),
                              maxForScores).c_str(),
                   m_game->getPlayer(i).getPoints());
         if (m_game->getMode() != PublicGame::kTRAINING && i == currId)
@@ -320,7 +320,7 @@
             attron(A_BOLD);
         wstring rack = 
m_game->getPlayer(i).getCurrentRack().toString(PlayedRack::RACK_SIMPLE);
         mvwprintw(win, y + yOff + i + 1, x + 2, _("%s: %ls"),
-                  truncOrPad(convertToMb(m_game->getPlayer(i).getName()),
+                  truncOrPad(lfw(m_game->getPlayer(i).getName()),
                              maxForRacks).c_str(),
                   rack.c_str());
         if (m_game->getMode() != PublicGame::kTRAINING && i == currId)
@@ -359,7 +359,7 @@
         ioBox.printDataLine(i, x, "%3d %s %3s",
                             r.getPoints(),
                             padAndConvert(r.getWord(), ioBox.getWidth() - 9, 
false).c_str(),
-                            convertToMb(coord).c_str());
+                            lfw(coord).c_str());
     }
     // Complete the list with empty lines, to avoid trails
     for (; i < (unsigned int)ioBox.getLastLine(); i++)
@@ -419,7 +419,7 @@
             // The move corresponds to a passed turn or changed letters
             wstring action;
             if (m.getType() == Move::PASS)
-                action = convertToWc(_("(PASS)"));
+                action = wfl(_("(PASS)"));
             else if (m.getType() == Move::CHANGE_LETTERS)
                 action = L"(-" + m.getChangedLetters() + L")";
 
@@ -515,7 +515,7 @@
                             padAndConvert(allTiles[i].getDisplayStr(), 
2).c_str(),
                             allTiles[i].getPoints(),
                             allTiles[i].maxNumber(),
-                            convertToMb(str).c_str());
+                            lfw(str).c_str());
     }
 
     int nbLines = min(i + 2 - ioBox.getFirstLine(),
@@ -620,7 +620,7 @@
         char s[100];
         try
         {
-            m_game->save(convertToMb(filename));
+            m_game->save(lfw(filename));
             snprintf(s, 100, _("Game saved in '%ls'"), filename.c_str());
             drawStatus(win, s, false);
         }
@@ -646,7 +646,7 @@
     {
         try
         {
-            PublicGame *loaded = PublicGame::load(convertToMb(filename), 
m_game->getDic());
+            PublicGame *loaded = PublicGame::load(lfw(filename), 
m_game->getDic());
             //GameFactory::Instance()->releaseGame(*m_game);
             delete m_game;
             m_game = loaded;
@@ -751,7 +751,7 @@
             int len = pos;
             x = x0;
             pos = 0;
-            mvwprintw(win, y, x0, "%s", convertToMb(oString + wstring(len, L' 
')).c_str());
+            mvwprintw(win, y, x0, "%s", lfw(oString + wstring(len, L' 
')).c_str());
             wmove(win, y, x);
         }
         else if (res == KEY_CODE_YES)
@@ -761,13 +761,13 @@
                 x--;
                 pos--;
                 oString.erase(pos, 1);
-                mvwprintw(win, y, x0, "%s", convertToMb(oString + L" 
").c_str());
+                mvwprintw(win, y, x0, "%s", lfw(oString + L" ").c_str());
                 wmove(win, y, x);
             }
             else if (c == KEY_DC)
             {
                 oString.erase(pos, 1);
-                mvwprintw(win, y, x0, "%s", convertToMb(oString + L" 
").c_str());
+                mvwprintw(win, y, x0, "%s", lfw(oString + L" ").c_str());
                 wmove(win, y, x);
             }
             else if (c == KEY_LEFT && pos != 0)
@@ -801,14 +801,14 @@
         {
             x++;
             oString.insert(pos++, 1, c);
-            mvwprintw(win, y, x0, "%s", convertToMb(oString).c_str());
+            mvwprintw(win, y, x0, "%s", lfw(oString).c_str());
             wmove(win, y, x);
         }
         else if (flag & kJOKER && c == L'?')
         {
             x++;
             oString.insert(pos++, 1, c);
-            mvwprintw(win, y, x0, "%s", convertToMb(oString).c_str());
+            mvwprintw(win, y, x0, "%s", lfw(oString).c_str());
             wmove(win, y, x);
         }
         else if (flag & kFILENAME)
@@ -817,7 +817,7 @@
             {
                 x++;
                 oString += c;
-                mvwprintw(win, y, x0, "%s", convertToMb(oString).c_str());
+                mvwprintw(win, y, x0, "%s", lfw(oString).c_str());
                 wmove(win, y, x);
             }
             else



reply via email to

[Prev in Thread] Current Thread [Next in Thread]