eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot/game training.h training.cpp


From: eliot-dev
Subject: [Eliot-dev] eliot/game training.h training.cpp
Date: Mon, 26 Dec 2005 18:07:26 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         
Changes by:     Antoine Fraboulet <address@hidden>      05/12/26 18:07:26

Modified files:
        game           : training.h training.cpp 

Log message:
        - remove results members access methods from Training Class
        - add m_testPlay for temporary placed words

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/training.h.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/training.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text

Patches:
Index: eliot/game/training.cpp
diff -u eliot/game/training.cpp:1.11 eliot/game/training.cpp:1.12
--- eliot/game/training.cpp:1.11        Sat Nov  5 23:22:42 2005
+++ eliot/game/training.cpp     Mon Dec 26 18:07:26 2005
@@ -168,49 +168,10 @@
 }
 
 
-int Training::getNResults() const
-{
-    return m_results.size();
-}
-
-
-string Training::getSearchedWord(int num) const
-{
-    ASSERT(0 <= num && num < m_results.size(), "Wrong result number");
-    char c;
-    string s;
-    const Round &r = m_results.get(num);
-    for (int i = 0; i < r.getWordLen(); i++)
-    {
-        c = r.getTile(i).toChar();
-        if (r.isJoker(i))
-            c = tolower(c);
-        s += c;
-    }
-    return s;
-}
-
-
-string Training::getSearchedCoords(int num) const
-{
-    return m_results.get(num).getCoord().toString();
-}
-
-
-int Training::getSearchedPoints(int num) const
-{
-    return m_results.get(num).getPoints();
-}
-
-
-int Training::getSearchedBonus(int num) const
-{
-    return m_results.get(num).getBonus();
-}
-
-
 void Training::testPlay(int num)
 {
+    ASSERT(0 <= num && num < m_results.size(), "Wrong result number");
+    m_testRound = m_results.get(num);
     m_board.testRound(m_results.get(num));
 }
 
@@ -218,5 +179,11 @@
 void Training::removeTestPlay()
 {
     m_board.removeTestRound();
+    m_testRound = Round();
+}
+
+std::string Training::getTestPlayWord() const
+{
+    return m_testRound.getWord();
 }
 
Index: eliot/game/training.h
diff -u eliot/game/training.h:1.11 eliot/game/training.h:1.12
--- eliot/game/training.h:1.11  Fri Nov  4 20:00:06 2005
+++ eliot/game/training.h       Mon Dec 26 18:07:26 2005
@@ -65,16 +65,14 @@
      * Functions to access the current search results
      * The int parameter should be 0 <= int < getNResults
      *************************/
-    int getNResults() const;
-    string getSearchedWord(int) const;
-    string getSearchedCoords(int) const;
-    int getSearchedPoints(int) const;
-    int getSearchedBonus (int) const;
+    const Results& getResults() const { return m_results; };
 
     /// Place a temporary word on the board for preview purpose
     void testPlay(int);
     /// Remove the temporary word(s)
     void removeTestPlay();
+    /// Get the temporary word
+    string getTestPlayWord() const;
 
 private:
     // Private constructor and destructor to force using the GameFactory class
@@ -82,6 +80,7 @@
     virtual ~Training();
 
     // Search results, with all the possible rounds
+    Round   m_testRound;
     Results m_results;
 };
 




reply via email to

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