summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/standard.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/server/standard.cpp b/server/standard.cpp
index 08012d1..015308d 100644
--- a/server/standard.cpp
+++ b/server/standard.cpp
@@ -149,14 +149,14 @@ State& Standard::round_update() {
}
if(chi) {
temp_action.player = temp_next_player;
- temp_action.target = tile_2u_id;
- temp_action.target2 = tile_1u_id;
+ temp_action.target.push_back(tile_2u_id);
+ temp_action.target.push_back(tile_1u_id);
temp_action.type = Action::Chi;
game_state.possible_actions.push_back(temp_action);
#ifdef DEBUG
time_t current_time = std::time(0);
- std::cout << std::ctime(&current_time) << " Player: " << temp_action.player << " Can do action: " << temp_action.type << " On target: " << temp_action.target << std::endl;
+ std::cout << std::ctime(&current_time) << " Player: " << temp_action.player << " Can do action: " << temp_action.type << " On target: " << temp_action.target[0] << std::endl;
#endif
}
@@ -175,15 +175,15 @@ State& Standard::round_update() {
}
if(chi) {
temp_action.player = temp_next_player;
- temp_action.target = tile_1u_id;
- temp_action.target2 = tile_1o_id;
+ temp_action.target.push_back(tile_1u_id);
+ temp_action.target.push_back(tile_1o_id);
temp_action.type = Action::Chi;
game_state.possible_actions.push_back(temp_action);
#ifdef DEBUG
time_t current_time = std::time(0);
- std::cout << std::ctime(&current_time) << " Player: " << temp_action.player << " Can do action: " << temp_action.type << " On target: " << temp_action.target << std::endl;
+ std::cout << std::ctime(&current_time) << " Player: " << temp_action.player << " Can do action: " << temp_action.type << " On target: " << temp_action.target[0] << std::endl;
#endif
}
@@ -202,15 +202,15 @@ State& Standard::round_update() {
}
if(chi) {
temp_action.player = temp_next_player;
- temp_action.target = tile_1o_id;
- temp_action.target2 = tile_2o_id;
+ temp_action.target.push_back(tile_1o_id);
+ temp_action.target.push_back(tile_2o_id);
temp_action.type = Action::Chi;
game_state.possible_actions.push_back(temp_action);
#ifdef DEBUG
time_t current_time = std::time(0);
- std::cout << std::ctime(&current_time) << " Player: " << temp_action.player << " Can do action: " << temp_action.type << " On target: " << temp_action.target << std::endl;
+ std::cout << std::ctime(&current_time) << " Player: " << temp_action.player << " Can do action: " << temp_action.type << " On target: " << temp_action.target[0] << std::endl;
#endif
}
@@ -274,7 +274,7 @@ bool Standard::round_action(Action action) {
#ifdef DEBUG
time_t current_time = std::time(0);
- std::cout << std::ctime(&current_time) << " Player: " << action.player << " Did action: " << action.type << " On target: " << action.target << std::endl;
+ std::cout << std::ctime(&current_time) << " Player: " << action.player << " Did action: " << action.type << " On target: " << action.target[0] << std::endl;
#endif
@@ -305,9 +305,9 @@ bool Standard::round_action(Action action) {
} break;
case Action::Discard: {
- Tile discarded_tile = game_state.players[action.player].hand[action.target];
+ Tile discarded_tile = game_state.players[action.player].hand[action.target[0]];
game_state.players[action.player].pond.push_back(discarded_tile);
- game_state.players[action.player].hand.erase(game_state.players[action.player].hand.begin() + action.target);
+ game_state.players[action.player].hand.erase(game_state.players[action.player].hand.begin() + action.target[0]);
} break;
@@ -379,14 +379,14 @@ bool Standard::round_action(Action action) {
left_tile.rotated = true;
game_state.players[action.player].open.push_back(left_tile);
- Tile middle_tile = game_state.players[action.player].hand[action.target];
- game_state.players[action.player].open.push_back(middle_tile);
-
- Tile right_tile = game_state.players[action.player].hand[action.target2];
- game_state.players[action.player].open.push_back(right_tile);
-
- game_state.players[action.player].hand.erase(game_state.players[action.player].hand.begin() + action.target);
- game_state.players[action.player].hand.erase(game_state.players[action.player].hand.begin() + action.target2 - 1);
+ int count = 0;
+ for(std::vector<int>::iterator it = most_value_action.target.begin(); it != most_value_action.target.end(); ++it) {
+ Tile target_tile = game_state.players[action.player].hand[(*it) - count];
+ game_state.players[action.player].open.push_back(target_tile);
+ game_state.players[action.player].hand.erase(game_state.players[action.player].hand.begin() + (*it) - count);
+
+ count++;
+ }
} break;