summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-12-02 03:54:15 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-12-02 03:54:34 +0100
commitbe2a1877e3412095c3bfca3ad9ce36721e4c9fe9 (patch)
tree0a1f36a5887bd05bf896f7c1e35ad81fcf37a661
parentfdd3d58c92fc924c31c3acad69dcb3d0dac06ac0 (diff)
Sort hands before testing agari/tenpai.
-rw-r--r--server/player.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/player.cpp b/server/player.cpp
index 37dc3bc..554084d 100644
--- a/server/player.cpp
+++ b/server/player.cpp
@@ -99,6 +99,8 @@ bool Game::Player::can_riichi() {
Tiles tiles = hand;
+ tiles.sort();
+
// Take first tile out of the set.
Tile out = tiles.front();
tiles.erase(tiles.begin());
@@ -182,7 +184,9 @@ bool Game::Player::can_kan(Tile tile, int target) {
}
bool Game::Player::can_tsumo() {
- return Hand::agari(hand);
+ Tiles tiles = hand;
+ tiles.sort();
+ return Hand::agari(tiles);
}
bool Game::Player::can_ron(Tile tile) {