summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/game.cpp21
-rw-r--r--server/game.h7
2 files changed, 27 insertions, 1 deletions
diff --git a/server/game.cpp b/server/game.cpp
index 346251e..3f34d07 100644
--- a/server/game.cpp
+++ b/server/game.cpp
@@ -40,13 +40,32 @@ void Game::round_start() {
players[3]->round_start();
// Sett opp runden
+ game_state = make_shared<State>();
+
+ // Simulates drawing 4, 4 ,4 for each player
+ for (int player_num = 0; player_num < 4; player_num++) {
+ for (int i = 0; i < 3; i++) {
+ for (int y = 0; y < 4; y++) {
+ 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());
+ }
+
+ // Gives an extra tile to the first player (east)
+ game_state->players[0].hand.push_back(wall.take_one());
+
+
round_update();
}
void Game::round_update() {
// Send RoundState, inkl. liste av mulige actions.
- State::p game_state = make_shared<State>();
players[0]->round_state(game_state);
players[1]->round_state(game_state);
diff --git a/server/game.h b/server/game.h
index 39e02f8..dc3a9ff 100644
--- a/server/game.h
+++ b/server/game.h
@@ -6,6 +6,7 @@
#include <vector>
+#include "wall.h"
#include "player.h"
#include "../common/action.h"
@@ -24,6 +25,12 @@ class Game : public boost::enable_shared_from_this<Game> {
Game(Player::p player_1, Player::p player_2, Player::p player_3, Player::p player_4);
+ //! The wall that belongs to this game
+ Wall wall;
+
+ //! The current state of the game
+ State::p game_state;
+
//! Handle Ready message from player.
void handle_ready();