From e604584db75f08af27b142ce4637882a0d20927e Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Wed, 1 Dec 2010 14:05:10 +0100 Subject: =?UTF-8?q?Made=20=C2=ABdumb=C2=BB=20ClientDumb.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/client.cpp | 24 ++++++++++++++++++++++++ server/client.h | 15 +++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/server/client.cpp b/server/client.cpp index 0d2fe24..95f7e1d 100644 --- a/server/client.cpp +++ b/server/client.cpp @@ -120,3 +120,27 @@ void Client::round_end(boost::function callback) { void Client::get_action(boost::function callback, Actions expected_actions) { connection->recv(boost::bind(&Client::handle_action, shared_from_this(), _1, callback, expected_actions)); } + +std::string ClientDumb::nick() { + return "CPU"; +} + +void ClientDumb::game_start(boost::function callback, std::vector players) { + callback(); +} + +void ClientDumb::round_start() { + +} + +void ClientDumb::round_state(const PlayerState& pl_d, const PlayerState& pl_r, const PlayerState& pl_u, const PlayerState& pl_l, const Tiles& d, const Actions& a) { + +} + +void ClientDumb::round_end(boost::function callback) { + callback(); +} + +void ClientDumb::get_action(boost::function callback, Actions expected_actions) { + callback(expected_actions.back()); +} diff --git a/server/client.h b/server/client.h index ed3a47b..91fd4b6 100644 --- a/server/client.h +++ b/server/client.h @@ -94,4 +94,19 @@ class Client : public ClientBase, public boost::enable_shared_from_this typedef std::vector Clients; +class ClientDumb : public ClientBase { + public: + virtual std::string nick(); + + virtual void game_start(boost::function callback, std::vector players); + + virtual void round_start(); + + virtual void round_state(const PlayerState& pl_d, const PlayerState& pl_r, const PlayerState& pl_u, const PlayerState& pl_l, const Tiles& d, const Actions& a); + + virtual void round_end(boost::function callback); + + virtual void get_action(boost::function callback, Actions expected_actions); +}; + #endif -- cgit v1.2.3