[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] Changes to eliot/game/coord.cpp
From: |
eliot-dev |
Subject: |
[Eliot-dev] Changes to eliot/game/coord.cpp |
Date: |
Sat, 05 Nov 2005 10:48:59 -0500 |
Index: eliot/game/coord.cpp
diff -u eliot/game/coord.cpp:1.6 eliot/game/coord.cpp:1.7
--- eliot/game/coord.cpp:1.6 Sat Nov 5 13:56:59 2005
+++ eliot/game/coord.cpp Sat Nov 5 15:48:59 2005
@@ -27,6 +27,7 @@
#include <string>
#include "coord.h"
#include "board.h" // for BOARD_MIN and BOARD_MAX (TODO: remove this include)
+#include "debug.h"
Coord::Coord(int iRow, int iCol, Direction iDir)
@@ -86,19 +87,20 @@
string Coord::toString() const
{
- string rs;
+ ASSERT(isValid(), "Invalid coordinates");
+ string res;
char s[5];
sprintf(s, "%d", m_col);
if (getDir() == HORIZONTAL)
{
- rs = string(1, m_row + 'A' - 1) + s;
+ res = string(1, m_row + 'A' - 1) + s;
}
else
{
- rs = s + string(1, m_row + 'A' - 1);
+ res = s + string(1, m_row + 'A' - 1);
}
- return rs;
+ return res;
}