diff options
Diffstat (limited to 'kbackgammon/kbgstatus.cpp')
-rw-r--r-- | kbackgammon/kbgstatus.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/kbackgammon/kbgstatus.cpp b/kbackgammon/kbgstatus.cpp index 824ff721..e9e8d4e5 100644 --- a/kbackgammon/kbgstatus.cpp +++ b/kbackgammon/kbgstatus.cpp @@ -29,7 +29,7 @@ /* * Parse a rawboard description from FIBS and initialize members. */ -KBgStatus::KBgStatus(const TQString &rawboard) +KBgtqStatus::KBgtqStatus(const TQString &rawboard) { /* * This is the format string from hell... @@ -116,7 +116,7 @@ KBgStatus::KBgStatus(const TQString &rawboard) * Constructor initializes the status to an empty board with cube one * and empty dice. */ -KBgStatus::KBgStatus() +KBgtqStatus::KBgtqStatus() : TQObject() { /* @@ -146,7 +146,7 @@ KBgStatus::KBgStatus() /* * Copy constructor calls private utility function. */ -KBgStatus::KBgStatus(const KBgStatus &rhs) +KBgtqStatus::KBgtqStatus(const KBgtqStatus &rhs) : TQObject() { copy(rhs); @@ -155,7 +155,7 @@ KBgStatus::KBgStatus(const KBgStatus &rhs) /* * Destructor */ -KBgStatus::~KBgStatus() +KBgtqStatus::~KBgtqStatus() { // nothing to do } @@ -164,14 +164,14 @@ KBgStatus::~KBgStatus() * Assignment operator shares a lot of code with the copy * constructor. */ -KBgStatus& KBgStatus::operator=(const KBgStatus &rhs) +KBgtqStatus& KBgtqStatus::operator=(const KBgtqStatus &rhs) { if (this == &rhs) return *this; copy(rhs); return *this; } -void KBgStatus::copy(const KBgStatus &rhs) +void KBgtqStatus::copy(const KBgtqStatus &rhs) { for (int i = 0; i < 26; i++) board_[i] = rhs.board_[i]; @@ -199,32 +199,32 @@ void KBgStatus::copy(const KBgStatus &rhs) /* * Access functions */ -int KBgStatus::board(const int &i) const +int KBgtqStatus::board(const int &i) const { return ((0 < i && i < 25) ? color_*board_[i] : 0); } -int KBgStatus::home(const int &w) const +int KBgtqStatus::home(const int &w) const { return ((w == US || w == THEM) ? color_*home_[w] : 0); } -int KBgStatus::bar(const int &w) const +int KBgtqStatus::bar(const int &w) const { return ((w == US || w == THEM) ? color_*bar_[w] : 0); } -int KBgStatus::color(const int &w) const +int KBgtqStatus::color(const int &w) const { return ((w == THEM) ? -color_ : color_); } -int KBgStatus::direction() const +int KBgtqStatus::direction() const { return direction_; } -int KBgStatus::dice(const int &w, const int &n) const +int KBgtqStatus::dice(const int &w, const int &n) const { if ((w == US || w == THEM) && (n == 0 || n == 1)) return dice_[w][n]; @@ -232,34 +232,34 @@ int KBgStatus::dice(const int &w, const int &n) const return 0; } -int KBgStatus::cube(const int &w) const +int KBgtqStatus::cube(const int &w) const { if (w == US || w == THEM) return ((maydouble_[w]) ? cube_ : -cube_); return 0; } -int KBgStatus::points(const int& w) const +int KBgtqStatus::points(const int& w) const { return ((w == US || w == THEM) ? points_[w] : -1); } -TQString KBgStatus::player(const int &w) const +TQString KBgtqStatus::player(const int &w) const { return ((w == US || w == THEM) ? player_[w] : TQString()); } -int KBgStatus::length() const +int KBgtqStatus::length() const { return length_; } -int KBgStatus::turn() const +int KBgtqStatus::turn() const { return turn_; } -bool KBgStatus::doubled() const +bool KBgtqStatus::doubled() const { return doubled_; } @@ -268,7 +268,7 @@ bool KBgStatus::doubled() const /* * Assignment functions */ -void KBgStatus::setBoard(const int &i, const int &w, const int &v) +void KBgtqStatus::setBoard(const int &i, const int &w, const int &v) { if (0 < i && i < 25) { if (w == US) @@ -278,7 +278,7 @@ void KBgStatus::setBoard(const int &i, const int &w, const int &v) } } -void KBgStatus::setHome(const int &w, const int &v) +void KBgtqStatus::setHome(const int &w, const int &v) { if (w == US) home_[w] = abs(v); @@ -286,7 +286,7 @@ void KBgStatus::setHome(const int &w, const int &v) home_[w] = -abs(v); } -void KBgStatus::setBar(const int& w, const int& v) +void KBgtqStatus::setBar(const int& w, const int& v) { if (w == US) bar_[w] = abs(v); @@ -294,7 +294,7 @@ void KBgStatus::setBar(const int& w, const int& v) bar_[w] = -abs(v); } -void KBgStatus::setColor(const int &c, const int &w) +void KBgtqStatus::setColor(const int &c, const int &w) { if (w == US) color_ = ((c < 0) ? Black : White); @@ -302,12 +302,12 @@ void KBgStatus::setColor(const int &c, const int &w) color_ = ((c < 0) ? White : Black); } -void KBgStatus::setDirection(const int &dir) +void KBgtqStatus::setDirection(const int &dir) { direction_ = ((dir < 0) ? -1 : +1); } -void KBgStatus::setDice(const int &w, const int &n, const int &v) +void KBgtqStatus::setDice(const int &w, const int &n, const int &v) { if ((w == US || w == THEM) && (n == 0 || n == 1)) { if (0 <= v && v <= 6) @@ -317,7 +317,7 @@ void KBgStatus::setDice(const int &w, const int &n, const int &v) } } -void KBgStatus::setCube(const int &c, const bool &us, const bool &them) +void KBgtqStatus::setCube(const int &c, const bool &us, const bool &them) { int w = NONE; if (us) w = US; @@ -326,7 +326,7 @@ void KBgStatus::setCube(const int &c, const bool &us, const bool &them) setCube(c, w); } -void KBgStatus::setCube(const int &c, const int &w) +void KBgtqStatus::setCube(const int &c, const int &w) { // assume that int has at least 32 bits... for (int i = 0; i < 31; i++) { @@ -337,24 +337,24 @@ void KBgStatus::setCube(const int &c, const int &w) maydouble_[THEM] = (w == THEM || w == BOTH); } -void KBgStatus::setPoints(const int &w, const int &p) +void KBgtqStatus::setPoints(const int &w, const int &p) { if (w == US || w == THEM) points_[w] = p; } -void KBgStatus::setPlayer(const int &w, const TQString &name) +void KBgtqStatus::setPlayer(const int &w, const TQString &name) { if (w == US || w == THEM) player_[w] = name; } -void KBgStatus::setLength(const int &l) +void KBgtqStatus::setLength(const int &l) { length_ = l; } -void KBgStatus::setTurn(const int &w) +void KBgtqStatus::setTurn(const int &w) { if (w == US || w == THEM || w == BOTH) turn_ = w; @@ -364,7 +364,7 @@ void KBgStatus::setTurn(const int &w) /* * Utility functions */ -int KBgStatus::moves() const +int KBgtqStatus::moves() const { int start, dir; @@ -407,7 +407,7 @@ int KBgStatus::moves() const * Get a copy of ourselves. That way we can mess around with * the internals of the game. */ - KBgStatus sc(*this); + KBgtqStatus sc(*this); /* * Start with getting all checkers off the bar @@ -490,7 +490,7 @@ int KBgStatus::moves() const } } -bool KBgStatus::movePossible(KBgStatus &sc, int a, int start, int dir) const +bool KBgtqStatus::movePossible(KBgtqStatus &sc, int a, int start, int dir) const { /* * Determine where the first checker in moving direction is |