summaryrefslogtreecommitdiff
path: root/server/game.cpp
diff options
context:
space:
mode:
authorAtle Hellvik Havsø <atle@havso.net>2010-12-13 16:47:55 +0100
committerAtle Hellvik Havsø <atle@havso.net>2010-12-13 16:47:55 +0100
commit7f3c5360b2ed0ce5c3d84b6d04cb0f37e7e85149 (patch)
tree2a3fa28faf144b7ba3fa9ff30682c05f8e240d71 /server/game.cpp
parent4920ca952d7b818c7d2f5953a4676bf0ff7513e8 (diff)
Made RoundEnd send winnings.
Diffstat (limited to 'server/game.cpp')
-rw-r--r--server/game.cpp20
1 files changed, 20 insertions, 0 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) {