1
// Copyright (C) 2007, 2008 Ben Asselstine
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
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
15
18
#ifndef BRIDGELIST_H
16
19
#define BRIDGELIST_H
18
21
#include <sigc++/trackable.h>
19
#include "ObjectList.h"
22
#include "LocationList.h"
20
23
#include "bridge.h"
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
27
class Bridgelist : public ObjectList<Bridge>, public sigc::trackable
25
//! A list of Bridge objects located on the game map.
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
31
class Bridgelist : public LocationList<Bridge>, public sigc::trackable
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();
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);
36
//! Explicitly delete the singleton instance
40
//! Explicitly delete the singleton instance.
37
41
static void deleteInstance();
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;
44
//! Default constructor
47
//! Default constructor.
47
//! Loading constructor
50
//! Loading constructor.
52
* Load the list of Bridge objects from the opened saved-game file.
54
* @param helper The opened saved-game file to load the Bridge objects
48
57
Bridgelist(XML_Helper* helper);
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);
63
//! A static pointer for the singleton instance.
54
64
static Bridgelist* s_instance;