~ubuntu-branches/ubuntu/raring/lordsawar/raring

« back to all changes in this revision

Viewing changes to src/templelist.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese, Gonéri Le Bouder
  • Date: 2008-06-17 11:15:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080617111526-yjyvu9df50zmpdo0
Tags: 0.0.9-1
[ Barry deFreese ]
* New upstream release.
  + Fixes gcc-4.3 builds so drop ftbfs_gcc-4.3_fix.diff.
  + Add new build-dependency for libgnet-dev.
* Add simple man page for new lordsawar-tile-editor.
* Add desktop file for lordsawar-tile-editor.
* Remove French translation on install.

[ Gonéri Le Bouder ]
* bump Debian Policy to 3.8.0. No change needed.
* fix wording in the 0.0.8-3 entry of the Debian changelog

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2000, 2001, 2003 Michael Bartl
 
2
// Copyright (C) 2001, 2003, 2004, 2005 Ulf Lorenz
 
3
// Copyright (C) 2007, 2008 Ben Asselstine
 
4
//
1
5
//  This program is free software; you can redistribute it and/or modify
2
6
//  it under the terms of the GNU General Public License as published by
3
7
//  the Free Software Foundation; either version 2 of the License, or
10
14
//
11
15
//  You should have received a copy of the GNU General Public License
12
16
//  along with this program; if not, write to the Free Software
13
 
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 
18
//  02110-1301, USA.
14
19
 
15
20
#ifndef TEMPLELIST_H
16
21
#define TEMPLELIST_H
17
22
 
18
23
#include <sigc++/trackable.h>
19
 
#include "ObjectList.h"
 
24
#include "LocationList.h"
20
25
#include "temple.h"
21
26
 
22
 
/** The templelist just keeps track of the temples located on the game map. It
23
 
  * is also implemented as a singleton since many classes use it for looking up
24
 
  * temples.
25
 
  */
26
 
 
27
 
class Templelist : public ObjectList<Temple>, public sigc::trackable
 
27
//! A list of Temple objects on the game map.
 
28
/** 
 
29
 * The templelist keeps track of the temples located on the game map. It
 
30
 * is implemented as a singleton because many classes use it for looking 
 
31
 * up temples.
 
32
 */
 
33
class Templelist : public LocationList<Temple>, public sigc::trackable
28
34
{
29
35
    public:
30
 
        //! Return the singleton instance. Create a new one if needed.
 
36
        //! Return the singleton instance.  Create a new one if needed.
31
37
        static Templelist* getInstance();
32
38
 
33
 
        //! Load the singleton instance with the given savegame
 
39
        //! Load the temple list from an opened saved-game file.
 
40
        /**
 
41
         * @param helper  The opened saved-game file to load the list of 
 
42
         *                temples from.
 
43
         *
 
44
         * @return The list of temples.
 
45
         */
34
46
        static Templelist* getInstance(XML_Helper* helper);
35
47
 
36
 
        //! Explicitely delete the singleton instance
 
48
        //! Explicitly delete the singleton instance.
37
49
        static void deleteInstance();
38
 
        
39
50
 
40
 
        //! Saves the game data. See XML_Helper for details.
 
51
        //! Saves the temple data to an opened saved-game file.
41
52
        bool save(XML_Helper* helper) const;
42
53
 
43
 
        // Find the nearest temple
44
 
        Temple* getNearestTemple(const Vector<int>& pos);
45
 
        Temple* getNearestTemple(const Vector<int>& pos, int dist);
 
54
        //! Find the nearest temple that is not obscured by fog.
 
55
        /**
 
56
         * Scan through all temples, searching for the closest one that is
 
57
         * not covered by fog-of-war on a hidden map.
 
58
         *
 
59
         * @param pos  The position to find the nearest temple from.
 
60
         *
 
61
         * @return A pointer to the nearest temple that is not obscured by fog.
 
62
         */
46
63
        Temple* getNearestVisibleTemple(const Vector<int>& pos);
 
64
 
 
65
        //! Find the nearest temple that is unobscured and is not too far away.
 
66
        /**
 
67
         * Scan through all the temples, searching for the closest one that
 
68
         * is not covered by fog-of-war on a hidden map, but is not farther
 
69
         * away than a given distance.
 
70
         *
 
71
         * @param pos  The position to find the nearest temple from.
 
72
         * @param dist The number of tiles away that is deemed "too far".
 
73
         *
 
74
         * @return A pointer to the nearest temple that is not obscured by fog 
 
75
         *         and is within the prescribed number of tiles.  Returns NULL 
 
76
         *         if no temple could be found.
 
77
         */
47
78
        Temple* getNearestVisibleTemple(const Vector<int>& pos, int dist);
48
 
        
 
79
 
49
80
    protected:
50
 
        //! Default constructor
 
81
        //! Default constructor.
51
82
        Templelist();
52
83
 
53
 
        //! Loading constructor
 
84
        //! Loading constructor.
 
85
        /**
 
86
         * Load the list of temples from an opened saved-game file.
 
87
         *
 
88
         * @param helper  The opened saved-game file to load the temples from.
 
89
         */
54
90
        Templelist(XML_Helper* helper);
55
91
 
56
92
    private:
57
 
        //! Callback for loading
 
93
        //! Callback for loading temple objects from opened saved game files.
58
94
        bool load(std::string tag, XML_Helper* helper);
59
95
 
 
96
        //! A static pointer for the singleton instance.
60
97
        static Templelist* s_instance;
61
98
};
62
99