~ubuntu-branches/ubuntu/trusty/lordsawar/trusty

« back to all changes in this revision

Viewing changes to src/bridgelist.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2008-06-17 16:07:00 UTC
  • mto: (5.1.1 lenny) (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20080617160700-6d8ofoz0qkasxlnw
ImportĀ upstreamĀ versionĀ 0.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  Copyright (C) 2007, 2008 Ben Asselstine
 
2
//
1
3
//  This program is free software; you can redistribute it and/or modify
2
4
//  it under the terms of the GNU General Public License as published by
3
5
//  the Free Software Foundation; either version 2 of the License, or
10
12
//
11
13
//  You should have received a copy of the GNU General Public License
12
14
//  along with this program; if not, write to the Free Software
13
 
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
15
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 
16
//  02110-1301, USA.
14
17
 
15
18
#ifndef BRIDGELIST_H
16
19
#define BRIDGELIST_H
17
20
 
18
21
#include <sigc++/trackable.h>
19
 
#include "ObjectList.h"
 
22
#include "LocationList.h"
20
23
#include "bridge.h"
21
24
 
22
 
/** The bridgelist just keeps track of the bridges located on the game map. It
23
 
  * is also implemented as a singleton since many classes use it for looking up
24
 
  * bridges.
25
 
  */
26
 
 
27
 
class Bridgelist : public ObjectList<Bridge>, public sigc::trackable
 
25
//! A list of Bridge objects located on the game map.
 
26
/** 
 
27
 * The bridgelist keeps track of the bridges located on the game map. It
 
28
 * is implemented as a singleton because many classes use it for looking up
 
29
 * bridges.
 
30
 */
 
31
class Bridgelist : public LocationList<Bridge>, public sigc::trackable
28
32
{
29
33
    public:
30
 
        //! Return the singleton instance. Create a new one if needed.
 
34
        //! Return the singleton instance.  Create a new one if needed.
31
35
        static Bridgelist* getInstance();
32
36
 
33
 
        //! Load the singleton instance with the given savegame
 
37
        //! Load the singleton instance from the opened saved-game file.
34
38
        static Bridgelist* getInstance(XML_Helper* helper);
35
39
 
36
 
        //! Explicitly delete the singleton instance
 
40
        //! Explicitly delete the singleton instance.
37
41
        static void deleteInstance();
38
 
        
39
42
 
40
 
        //! Saves the game data. See XML_Helper for details.
 
43
        //! Saves the list of Bridge objects to the opened saved-game file.
41
44
        bool save(XML_Helper* helper) const;
42
45
 
43
46
    protected:
44
 
        //! Default constructor
 
47
        //! Default constructor.
45
48
        Bridgelist();
46
49
 
47
 
        //! Loading constructor
 
50
        //! Loading constructor.
 
51
        /**
 
52
         * Load the list of Bridge objects from the opened saved-game file.
 
53
         *
 
54
         * @param helper  The opened saved-game file to load the Bridge objects
 
55
         *                from.
 
56
         */
48
57
        Bridgelist(XML_Helper* helper);
49
58
 
50
59
    private:
51
 
        //! Callback for loading
 
60
        //! Callback for loading Bridge objects into the list of bridges.
52
61
        bool load(std::string tag, XML_Helper* helper);
53
62
 
 
63
        //! A static pointer for the singleton instance.
54
64
        static Bridgelist* s_instance;
55
65
};
56
66