summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtle Hellvik Havsø <atle@havso.net>2010-12-15 12:01:58 +0100
committerAtle Hellvik Havsø <atle@havso.net>2010-12-15 12:01:58 +0100
commit5dd443319b5ab67feba2a213186091b587456743 (patch)
treeaec6c3fa47427de3efc3ae0b35136f531f2abdc2
parent8ef6d187b48cfe07d9f62bfa2227df612b4a3960 (diff)
* Server sends closed and open hand.
* Client draws scoring properly when no yakus is sent.
-rw-r--r--server/game.cpp12
-rw-r--r--server/wall.cpp2
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<Message::RoundEnd>();
@@ -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);