From 5dd443319b5ab67feba2a213186091b587456743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atle=20Hellvik=20Havs=C3=B8?= Date: Wed, 15 Dec 2010 12:01:58 +0100 Subject: * Server sends closed and open hand. * Client draws scoring properly when no yakus is sent. --- server/game.cpp | 12 ++++++++++-- server/wall.cpp | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/server/game.cpp b/server/game.cpp index 819336a..e791379 100644 --- a/server/game.cpp +++ b/server/game.cpp @@ -325,6 +325,14 @@ void Game::handle_action_discard(Action action, int player) { } } +Tiles merge_hand_open(const Tiles& hand, const Sets& open) { + Tiles tiles = hand; + for(Sets::const_iterator it = open.begin(); it != open.end(); it++) { + tiles.insert(tiles.end(), it->tiles.begin(), it->tiles.end()); + } + return tiles; +} + void Game::round_end(Endcondition end) { Message::RoundEnd::p msg[4] = make_shared(); @@ -344,7 +352,7 @@ void Game::round_end(Endcondition end) { case Tsumo: { Player& player = players[current_player]; - msg[count_player]->hand = player.hand; + msg[count_player]->hand = merge_hand_open(player.hand, player.open); msg[count_player]->yakus = player.won_han; @@ -380,7 +388,7 @@ void Game::round_end(Endcondition end) { if(players[current_player + i].won) { Player& player = players[current_player + i]; - msg[count_player]->hand = player.hand; + msg[count_player]->hand = merge_hand_open(player.hand, player.open); msg[count_player]->yakus = player.won_han; diff --git a/server/wall.cpp b/server/wall.cpp index 714e519..42df094 100644 --- a/server/wall.cpp +++ b/server/wall.cpp @@ -27,7 +27,7 @@ int Wall::remaining() { } Tile Wall::take_one() { - return wall.front(); + //return wall.front(); boost::uniform_int<> range(0, wall.size() - 1); -- cgit v1.2.3