1 // Copyright (C) 2003 Michael Bartl
2 // Copyright (C) 2003, 2004, 2005 Ulf Lorenz
3 // Copyright (C) 2007, 2008 Ben Asselstine
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Library General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include <sigc++/trackable.h>
29 /** The purpose of this class is very simple. Each object (player etc.) has a
30 * unique id by which it may be accessed (this isn't important for now, but
31 * becomes crucial as soon as you play e.g. over the network). Therefore, each
32 * important game object queries this class for an id and gets a unique
33 * identifier. The current counter position is saved together with a game.
35 * The implementation with the global variable could be changed in favour of
39 class FL_Counter : public sigc::trackable
42 //! The xml tag of this object in a saved-game file.
43 static std::string d_tag;
45 //! Initialise the counter with a start value
46 FL_Counter(guint32 start = 0);
48 //! Load the counter. See XML_Helper for details.
49 FL_Counter(XML_Helper* helper);
52 //! Returns a unique id
55 void syncToId(guint32 id);
57 //! Saves the current counter position
58 bool save(XML_Helper* helper);
64 extern FL_Counter* fl_counter;