summaryrefslogtreecommitdiff
path: root/server/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/game.cpp')
-rw-r--r--server/game.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/server/game.cpp b/server/game.cpp
index b0739cb..66a791c 100644
--- a/server/game.cpp
+++ b/server/game.cpp
@@ -44,6 +44,9 @@ void Game::start() {
<< players[2].client->nick() << " and "
<< players[3].client->nick() << "." << std::endl;
+ round_wind = 0;
+ round_num = 0;
+
awaiting_players = 4;
std::vector<std::string> pl;
@@ -82,10 +85,10 @@ void Game::round_start() {
// Notify players of round start.
// TODO: Tell them where wall is broken.
- players[0].round_start();
- players[1].round_start();
- players[2].round_start();
- players[3].round_start();
+ players[0].round_start(-round_num);
+ players[1].round_start(-round_num + 1);
+ players[2].round_start(-round_num + 2);
+ players[3].round_start(-round_num + 3);
// Draw hands.
for(int i = 0; i < 13; i++) {
@@ -128,9 +131,7 @@ void Game::round_update_draw() {
a = possible_actions;
}
- GameState gstate;
- gstate.dora = dora;
- gstate.current_player = current_player - player;
+ GameState gstate = {dora, current_player - player, round_wind, round_num, 0, 0};
players[player].client->round_state(state[0], state[1], state[2], state[3], gstate, a);
} while(++player);
@@ -161,9 +162,7 @@ void Game::round_update_discard() {
}
}
- GameState gstate;
- gstate.dora = dora;
- gstate.current_player = current_player - player;
+ GameState gstate = {dora, current_player - player, round_wind, round_num, 0, 0};
players[player].client->round_state(state[0], state[1], state[2], state[3], gstate, a);
} while(++player);
@@ -305,6 +304,14 @@ void Game::handle_action_discard(Action action, int player) {
}
void Game::round_end() {
+ // Flere runder? round_start()
+
+ round_num++;
+
+ if(!round_num) {
+ round_wind++;
+ }
+
awaiting_players = 4;
players[0].client->round_end(boost::bind(&Game::handle_ready, shared_from_this()));
@@ -312,6 +319,6 @@ void Game::round_end() {
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()));
- // Flere runder? round_start()
+
// Ferdig? game_end()
}