1 // Copyright (C) 2008 Ben Asselstine
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
22 #include "game-station.h"
24 #include "network-action.h"
25 #include "network-history.h"
28 GameStation::GameStation()
32 GameStation::~GameStation()
36 void GameStation::clearNetworkActionlist(std::list<NetworkAction*> &a)
38 for (std::list<NetworkAction*>::iterator it = a.begin();
46 void GameStation::clearNetworkHistorylist(std::list<NetworkHistory*> &h)
48 for (std::list<NetworkHistory*>::iterator it = h.begin();
56 void GameStation::listenForLocalEvents(Player *p)
58 sigc::connection connection;
59 connection = p->acting.connect(sigc::mem_fun(this,
60 &GameStation::onActionDone));
61 action_listeners[p->getId()] = connection;
62 connection = p->history_written.connect
63 (sigc::mem_fun(this, &GameStation::onHistoryDone));
64 history_listeners[p->getId()] = connection;
67 void GameStation::stopListeningForLocalEvents(Player *p)
69 sigc::connection connection;
70 std::map<guint32, sigc::connection>::iterator it;
71 it = action_listeners.find(p->getId());
72 if (it != action_listeners.end())
74 connection = (*it).second;
75 connection.disconnect();
76 action_listeners.erase(it);
78 it = history_listeners.find(p->getId());
79 if (it != history_listeners.end())
81 connection = (*it).second;
82 connection.disconnect();
83 history_listeners.erase(it);