summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/game.cpp20
-rw-r--r--server/player.cpp1
-rw-r--r--server/wall.cpp2
3 files changed, 21 insertions, 2 deletions
diff --git a/server/game.cpp b/server/game.cpp
index 5827565..501aa57 100644
--- a/server/game.cpp
+++ b/server/game.cpp
@@ -327,6 +327,10 @@ void Game::handle_action_discard(Action action, int player) {
void Game::round_end(Endcondition end) {
Message::RoundEnd::p msg = make_shared<Message::RoundEnd>();
+ for(int i = 0; i < 4; i++) {
+ msg->score[current_player + i].won = 0;
+ msg->score[current_player + i].score = players[current_player + i].get_state().score;
+ }
switch(end) {
case Draw:
@@ -345,8 +349,21 @@ void Game::round_end(Endcondition end) {
if(current_player == round_num) {
msg->won = 3 * player.won_value.tsumo_east();
+ msg->score[current_player].won = msg->won;
+ for(int i = 1; i < 4; i++) {
+ msg->score[current_player + i]. won = -(msg->won / 3);
+ }
} else {
msg->won = player.won_value.tsumo_east() + 2 * player.won_value.tsumo();
+ for(int i = 0; i < 4; i++) {
+ if(i == current_player) {
+ msg->score[i].won = msg->won;
+ } else if (i == round_num){
+ msg->score[i].won = -(player.won_value.tsumo_east());
+ } else {
+ msg->score[i].won = -(player.won_value.tsumo());
+ }
+ }
}
} break;
@@ -375,6 +392,9 @@ void Game::round_end(Endcondition end) {
break;
}
+ //Send med score
+
+
round_num++;
if(!round_num) {
diff --git a/server/player.cpp b/server/player.cpp
index d87f8e8..9707f34 100644
--- a/server/player.cpp
+++ b/server/player.cpp
@@ -119,7 +119,6 @@ Actions Player::get_actions_discard(Tile tile, PlayerNum discarder) {
// Check if tile can be called for a kan.
if(can_kan(tile, target)) {
- std::cout << "Can kan!" << std::endl;
possible_actions.push_back(Action(Action::Kan, Action::Index, target + 2));
}
}
diff --git a/server/wall.cpp b/server/wall.cpp
index 42df094..714e519 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);