summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/game.cpp14
-rw-r--r--server/game.h2
-rw-r--r--server/player.cpp2
-rw-r--r--server/player.h2
4 files changed, 10 insertions, 10 deletions
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<State>();
+ //game_state = make_shared<State>();
// 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<Game> {
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<Message::RoundStart>());
}
-void Player::round_state(State::p state) {
+void Player::round_state(State state) {
connection->send(make_shared<Message::RoundState>(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<Player> {
void round_start();
//! Send round state.
- void round_state(State::p state);
+ void round_state(State state);
//! Get action.
void get_action(boost::function<void (Action)> callback);