diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-25 12:54:59 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-25 12:54:59 +0100 |
commit | fae209a9e93400c3a2072befda9c820634cf9278 (patch) | |
tree | 2d69e2c75fff0e08468c168f773abbc939a2ff03 /src/game.h | |
parent | 94a1189d757f0269ac081ad2d750152e30564986 (diff) |
Diffstat (limited to 'src/game.h')
-rw-r--r-- | src/game.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/game.h b/src/game.h new file mode 100644 index 0000000..874a525 --- /dev/null +++ b/src/game.h @@ -0,0 +1,75 @@ +#ifndef GAME_H +#define GAME_H + +#include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> + +#include <vector> + +#include "wall.h" +#include "player.h" + +class Game : public boost::enable_shared_from_this<Game> { + public: + typedef boost::shared_ptr<Game> p; + + static p create(ClientBase::p player_1, ClientBase::p player_2, ClientBase::p player_3, ClientBase::p player_4); + + ~Game(); + + private: + Player players[4]; + + Wall wall; + + Tiles dora; + + bool kan_dora_pending; + + PlayerNum current_player; + + PlayerNum round_wind; + PlayerNum round_num; + + int awaiting_players; + + Action preceding_action; + int preceding_action_owner; + + Game(ClientBase::p player_1, ClientBase::p player_2, ClientBase::p player_3, ClientBase::p player_4); + + //! Handle Ready message from player. + void handle_ready(); + + //! Start the game. + void start(); + + //! Start a new round. + void round_start(); + + //! Send update after a tile is drawn. + void round_update_draw(); + + //! Send update after a tile is discarded. + void round_update_discard(); + + //! Handle action after draw. + void handle_action_draw(Action action); + + //! Handle actions after discard. + void handle_action_discard(Action action, int player); + + enum Endcondition { + Draw, + Tsumo, + Ron + }; + + //! End the round. + void round_end(Endcondition end); + + //! End the game + void game_end(); +}; + +#endif |