eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot/game navigation.cpp round.cpp settings.h


From: Olivier Teulière
Subject: [Eliot-dev] eliot/game navigation.cpp round.cpp settings.h
Date: Sun, 23 Nov 2008 20:13:02 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>      08/11/23 20:13:02

Modified files:
        game           : navigation.cpp round.cpp settings.h 

Log message:
        Improved debugging

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/game/navigation.cpp?cvsroot=eliot&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/eliot/game/round.cpp?cvsroot=eliot&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/eliot/game/settings.h?cvsroot=eliot&r1=1.4&r2=1.5

Patches:
Index: navigation.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/navigation.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- navigation.cpp      23 Nov 2008 17:08:12 -0000      1.3
+++ navigation.cpp      23 Nov 2008 20:13:02 -0000      1.4
@@ -149,9 +149,12 @@
 void Navigation::print() const
 {
     cout << "=== Commands history ===" << endl;
+    cout << "Current position right after turn " << m_currTurn  - 1<< endl;
+    int index = 0;
     BOOST_FOREACH(Command *c, m_turnCommands)
     {
-        cout << convertToMb(c->toString()) << endl;
+        cout << index << " " << convertToMb(c->toString()) << endl;
+        ++index;
     }
 }
 

Index: round.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/round.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- round.cpp   22 Nov 2008 13:09:31 -0000      1.14
+++ round.cpp   23 Nov 2008 20:13:02 -0000      1.15
@@ -20,6 +20,7 @@
  *****************************************************************************/
 
 #include <string>
+#include <sstream>
 #include <wctype.h>
 #include "tile.h"
 #include "round.h"
@@ -151,19 +152,12 @@
 
 wstring Round::toString() const
 {
-    wstring rs = L" ";
-
-    if (getWord().size() > 0)
+    wostringstream oss;
+    if (!getWord().empty())
     {
-        rs  = getWord();
-        rs += wstring(17 - getWord().size(), ' ');
-        rs += getBonus() ? L'*' : L' ';
-        wchar_t buff[5];
-        _swprintf(buff, 4, L"%3d", getPoints());
-        rs += buff;
-        rs += L" " + getCoord().toString();
+        oss << getWord() << L' ' << (getBonus() ? L'*' : L' ')
+            << L' ' << getPoints() << L' ' << getCoord().toString();
     }
-
-    return rs;
+    return oss.str();
 }
 

Index: settings.h
===================================================================
RCS file: /cvsroot/eliot/eliot/game/settings.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- settings.h  22 Nov 2008 13:09:31 -0000      1.4
+++ settings.h  23 Nov 2008 20:13:02 -0000      1.5
@@ -52,7 +52,7 @@
 
     ~Settings();
 
-    /// Save the current value of the settinfs to a configuration file
+    /// Save the current value of the settings to a configuration file
     void save() const;
 
     void setBool(const string &iName, bool iValue);




reply via email to

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