1 // Copyright (C) 2008 Ole Laursen
2 // Copyright (C) 2008 Ben Asselstine
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Library General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #include "pbm-game-client.h"
26 #include "network-action.h"
27 #include "network-history.h"
28 #include "playerlist.h"
29 #include "network_player.h"
30 #include "xmlhelper.h"
34 PbmGameClient * PbmGameClient::s_instance = 0;
37 PbmGameClient* PbmGameClient::getInstance()
40 s_instance = new PbmGameClient();
45 void PbmGameClient::deleteInstance()
54 PbmGameClient::PbmGameClient()
58 PbmGameClient::~PbmGameClient()
62 bool PbmGameClient::loadWithHelper(XML_Helper &helper, Player *p)
64 ActionLoader actionloader;
65 HistoryLoader historyloader;
67 helper.registerTag(NetworkAction::d_tag, sigc::mem_fun(actionloader, &ActionLoader::loadAction));
68 helper.registerTag(Action::d_tag, sigc::mem_fun(actionloader, &ActionLoader::loadAction));
69 helper.registerTag(NetworkHistory::d_tag, sigc::mem_fun(historyloader, &HistoryLoader::loadHistory));
70 helper.registerTag(History::d_tag, sigc::mem_fun(historyloader, &HistoryLoader::loadHistory));
74 int num = decodeActions(actionloader.actions, p);
75 printf ("decoded %d actions\n", num);
76 num = decodeHistories(historyloader.histories);
77 printf ("decoded %d histories\n", num);