summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--common/message.cpp2
-rw-r--r--common/message.h4
-rw-r--r--server/game.cpp14
-rw-r--r--server/game.h2
-rw-r--r--server/player.cpp2
-rw-r--r--server/player.h2
7 files changed, 15 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index 45ce594..57eea40 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ server/aotenjoud
*.cbp
*.save
*.cbTemp
+*.workspace
doc/client/
doc/server/
@@ -16,4 +17,4 @@ doc/server/
client/bin/*
client/obj/*
server/bin/*
-server/obj/* \ No newline at end of file
+server/obj/*
diff --git a/common/message.cpp b/common/message.cpp
index bc0e3dd..b69ddef 100644
--- a/common/message.cpp
+++ b/common/message.cpp
@@ -134,7 +134,7 @@ Message::RoundState::RoundState() : BoostBase(Types::RoundState) {
}
-Message::RoundState::RoundState(State::p state_) : BoostBase(Types::RoundState), state(state_) {
+Message::RoundState::RoundState(State state_) : BoostBase(Types::RoundState), state(state_) {
}
diff --git a/common/message.h b/common/message.h
index 26deb32..447d12d 100644
--- a/common/message.h
+++ b/common/message.h
@@ -138,9 +138,9 @@ namespace Message {
typedef boost::shared_ptr<RoundState> p;
RoundState();
- RoundState(State::p state_);
+ RoundState(State state_);
- State::p state;
+ State state;
virtual void serialize(boost::archive::text_oarchive& ar);
virtual void deserialize(boost::archive::text_iarchive& ar);
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);