summaryrefslogtreecommitdiff
path: root/server/game.h
blob: 2574dc3768b465c1f59165c0750484fdee4394cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef GAME_H
#define GAME_H

#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>

#include <vector>

#include "wall.h"
#include "client.h"
#include "../common/action.h"

#include "gamevariant.h"
#include "standard.h"

class Game : public boost::enable_shared_from_this<Game> {
	public:
		typedef boost::shared_ptr<Game> p;
		
		static p create(Client::p player_1, Client::p player_2, Client::p player_3, Client::p player_4);
		
		~Game();
		
	private:
		std::vector<Client::p> players;
		
		int waiting_players;
		
		Game(Client::p player_1, Client::p player_2, Client::p player_3, Client::p player_4);
		
		GameVariant *ruleset;
		
		//! Handle Ready message from player.
		void handle_ready();
		
		//! Start the game.
		void start();
		
		void round_start();
		void round_update();
		void handle_action(Action action);
		void round_end();
};

#endif