diff options
author | Atle Hellvik Havsø <atle@havso.net> | 2010-11-23 13:24:21 +0100 |
---|---|---|
committer | Atle Hellvik Havsø <atle@havso.net> | 2010-11-23 13:24:21 +0100 |
commit | 33fbb2451fdac7f36bf3934aab0f64bb0896bf08 (patch) | |
tree | 2713be52cc1b524ba124e332fdb79c56d62f6f07 /server | |
parent | 62a05732e05a25f40fbb409e49ff30e3fc8bd28c (diff) |
Added a second target to Action.
Diffstat (limited to 'server')
-rw-r--r-- | server/standard.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/server/standard.cpp b/server/standard.cpp index a45c018..7ffd6ac 100644 --- a/server/standard.cpp +++ b/server/standard.cpp @@ -148,9 +148,10 @@ State& Standard::round_update() { chi = true; } if(chi) { - temp_action.player = temp_next_player; - temp_action.target = tile_2u_id; - temp_action.type = Action::Chi; + temp_action.player = temp_next_player; + temp_action.target = tile_2u_id; + temp_action.target2 = tile_1u_id; + temp_action.type = Action::Chi; game_state.possible_actions.push_back(temp_action); #ifdef DEBUG @@ -173,9 +174,10 @@ State& Standard::round_update() { chi = true; } if(chi) { - temp_action.player = temp_next_player; - temp_action.target = tile_1u_id; - temp_action.type = Action::Chi; + temp_action.player = temp_next_player; + temp_action.target = tile_1u_id; + temp_action.target2 = tile_1o_id; + temp_action.type = Action::Chi; game_state.possible_actions.push_back(temp_action); #ifdef DEBUG @@ -199,9 +201,10 @@ State& Standard::round_update() { chi = true; } if(chi) { - temp_action.player = temp_next_player; - temp_action.target = tile_1o_id; - temp_action.type = Action::Chi; + temp_action.player = temp_next_player; + temp_action.target = tile_1o_id; + temp_action.target2 = tile_2o_id; + temp_action.type = Action::Chi; game_state.possible_actions.push_back(temp_action); #ifdef DEBUG @@ -380,17 +383,12 @@ bool Standard::round_action(Action action) { Tile middle_tile = game_state.players[action.player].hand[action.target]; chi.add_tile(middle_tile); - Tile right_tile; - if(Tile::Type(game_state.players[action.player].hand[action.target].type + 1) == left_tile.type) { - right_tile = game_state.players[action.player].hand[action.target + 2]; - } else { - right_tile = game_state.players[action.player].hand[action.target + 1]; - } + Tile right_tile = game_state.players[action.player].hand[action.target2]; chi.add_tile(right_tile); game_state.players[action.player].open.push_back(chi); 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); + game_state.players[action.player].hand.erase(game_state.players[action.player].hand.begin() + action.target2 - 1); } break; |