1 // Copyright (C) 2008 Ole Laursen
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Library General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include <sigc++/trackable.h>
26 #include <sigc++/signal.h>
31 #include "network-common.h"
32 #include "game-station.h"
34 class NetworkConnection;
38 class GameClient: public GameStation
42 //! Returns the singleton instance. Creates a new one if neccessary.
43 static GameClient* getInstance();
45 //! Deletes the singleton instance.
46 static void deleteInstance();
48 void start(std::string host, guint32 port, std::string nick);
49 void request_seat_manifest();
51 sigc::signal<void> client_connected;
52 sigc::signal<void> client_disconnected;
53 sigc::signal<void> client_could_not_connect;
55 void sit_down (Player *player);
56 void stand_up (Player *player);
57 void chat(std::string message);
59 std::string getHost() const{return d_host;};
60 guint32 getPort() const{return d_port;};
68 std::auto_ptr<NetworkConnection> network_connection;
72 void onConnectionLost();
73 void onGotMessage(MessageType type, std::string message);
75 void onActionDone(NetworkAction *action);
78 void onHistoryDone(NetworkHistory *history);
81 void gotTurnOrder (std::string payload);
82 void gotKillPlayer(Player *player);
84 void sat_down(Player *player, std::string nickname);
85 void stood_up(Player *player, std::string nickname);
87 std::list<NetworkAction*> actions;
88 std::list<NetworkHistory*> histories;
89 //! A static pointer for the singleton instance.
90 static GameClient * s_instance;