From cd36c6cc07a450e1625cedbe8858682bdb216fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atle=20Hellvik=20Havs=C3=B8?= Date: Sat, 20 Nov 2010 17:09:51 +0100 Subject: Minor change with State. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Atle Hellvik Havsø --- server/game.cpp | 14 +++++++------- server/game.h | 2 +- server/player.cpp | 2 +- server/player.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'server') diff --git a/server/game.cpp b/server/game.cpp index c189776..1806e25 100644 --- a/server/game.cpp +++ b/server/game.cpp @@ -44,20 +44,20 @@ void Game::round_start() { players[3]->id = 3; // Sett opp runden sin state - game_state = make_shared(); + //game_state = make_shared(); // Simulates drawing 4, 4 ,4 for each player for (int i = 0; i < 3; i++) { for (int player_num = 0; player_num < 4; player_num++) { for (int y = 0; y < 4; y++) { - game_state->players[player_num].hand.push_back(wall.take_one()); + game_state.players[player_num].hand.push_back(wall.take_one()); } } } // Simulates the second part of drawing with only 1 tile for (int player_num = 0; player_num < 4; player_num++) { - game_state->players[player_num].hand.push_back(wall.take_one()); + game_state.players[player_num].hand.push_back(wall.take_one()); } current_player = 0; @@ -76,13 +76,13 @@ void Game::round_update() { round_end(); } - game_state->players[current_player].hand.push_back(wall.take_one()); + game_state.players[current_player].hand.push_back(wall.take_one()); Action discard_action; discard_action.type = Action::Discard; discard_action.player = current_player; - game_state->possible_actions.push_back(discard_action); + game_state.possible_actions.push_back(discard_action); // TODO // Add code for calculation of possible riichi, tsumo, kan and draw @@ -130,8 +130,8 @@ void Game::handle_action(Action action) { } break; case Action::Discard: { - game_state->players[current_player].pond.push_back(game_state->players[current_player].hand[action.target]); - game_state->players[current_player].hand.erase(game_state->players[current_player].hand.begin() + action.target); + game_state.players[current_player].pond.push_back(game_state.players[current_player].hand[action.target]); + game_state.players[current_player].hand.erase(game_state.players[current_player].hand.begin() + action.target); } break; case Action::Riichi: { diff --git a/server/game.h b/server/game.h index 3ed97e4..f88ffd4 100644 --- a/server/game.h +++ b/server/game.h @@ -29,7 +29,7 @@ class Game : public boost::enable_shared_from_this { Wall wall; //! The current state of the game - State::p game_state; + State game_state; //! Current player, used when discarding etc int current_player; diff --git a/server/player.cpp b/server/player.cpp index 72ab99b..437d78d 100644 --- a/server/player.cpp +++ b/server/player.cpp @@ -82,7 +82,7 @@ void Player::round_start() { connection->send(make_shared()); } -void Player::round_state(State::p state) { +void Player::round_state(State state) { connection->send(make_shared(state)); } diff --git a/server/player.h b/server/player.h index 27b2757..af27721 100644 --- a/server/player.h +++ b/server/player.h @@ -54,7 +54,7 @@ class Player : public boost::enable_shared_from_this { void round_start(); //! Send round state. - void round_state(State::p state); + void round_state(State state); //! Get action. void get_action(boost::function callback); -- cgit v1.2.3