From be2a1877e3412095c3bfca3ad9ce36721e4c9fe9 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Thu, 2 Dec 2010 03:54:15 +0100 Subject: Sort hands before testing agari/tenpai. --- server/player.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server') 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) { -- cgit v1.2.3