summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-12-01 14:05:10 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-12-01 14:05:10 +0100
commite604584db75f08af27b142ce4637882a0d20927e (patch)
tree2f6f42232541af67c05f662b067361b526709a92 /server
parent76636ecbb9c6fd312cc450fcb82c4e7a0b67639e (diff)
Made «dumb» ClientDumb.
Diffstat (limited to 'server')
-rw-r--r--server/client.cpp24
-rw-r--r--server/client.h15
2 files changed, 39 insertions, 0 deletions
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<void ()> callback) {
void Client::get_action(boost::function<void (Action)> 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<void ()> callback, std::vector<std::string> 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<void ()> callback) {
+ callback();
+}
+
+void ClientDumb::get_action(boost::function<void (Action)> 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<Client>
typedef std::vector<Client> Clients;
+class ClientDumb : public ClientBase {
+ public:
+ virtual std::string nick();
+
+ virtual void game_start(boost::function<void ()> callback, std::vector<std::string> 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<void ()> callback);
+
+ virtual void get_action(boost::function<void (Action)> callback, Actions expected_actions);
+};
+
#endif