summaryrefslogtreecommitdiff
path: root/server/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/game.cpp')
-rw-r--r--server/game.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/server/game.cpp b/server/game.cpp
index a41b90c..6b0b275 100644
--- a/server/game.cpp
+++ b/server/game.cpp
@@ -326,20 +326,37 @@ void Game::handle_action_discard(Action action, int player) {
}
void Game::round_end() {
- // Flere runder? round_start()
+ Message::RoundEnd::p msg = make_shared<Message::RoundEnd>();
+ // Did anybody win?
+ for(int i = 0; i < 4; i++) {
+ if(players[current_player + i].won) {
+ Player& player = players[current_player + i];
+
+ msg->hand = player.hand;
+
+ msg->yakus = player.won_han;
+
+ msg->total_han = player.won_value.han();
+ msg->total_fu = player.won_value.fu_rounded();
+ msg->won = player.won_value.ron_east();
+
+ break;
+ }
+ }
round_num++;
if(!round_num) {
round_wind++;
}
+ msg->game_end = false;
awaiting_players = 4;
- players[0].client->round_end(boost::bind(&Game::handle_ready, shared_from_this()));
- players[1].client->round_end(boost::bind(&Game::handle_ready, shared_from_this()));
- players[2].client->round_end(boost::bind(&Game::handle_ready, shared_from_this()));
- players[3].client->round_end(boost::bind(&Game::handle_ready, shared_from_this()));
+ players[0].client->round_end(msg, boost::bind(&Game::handle_ready, shared_from_this()));
+ players[1].client->round_end(msg, boost::bind(&Game::handle_ready, shared_from_this()));
+ players[2].client->round_end(msg, boost::bind(&Game::handle_ready, shared_from_this()));
+ players[3].client->round_end(msg, boost::bind(&Game::handle_ready, shared_from_this()));
// Ferdig? game_end()