initial commit, lordsawar source, slightly modified
[lordsawar] / src / temple.h
1 // Copyright (C) 2001, 2003 Michael Bartl
2 // Copyright (C) 2002, 2003, 2004, 2005, 2006 Ulf Lorenz
3 // Copyright (C) 2006 Andrea Paternesi
4 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
5 //
6 //  This program is free software; you can redistribute it and/or modify
7 //  it under the terms of the GNU General Public License as published by
8 //  the Free Software Foundation; either version 3 of the License, or
9 //  (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU Library General Public License for more details.
15 //
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
19 //  02110-1301, USA.
20
21 #ifndef TEMPLE_H
22 #define TEMPLE_H
23
24 #define DEFAULT_TEMPLE_NAME  "Shrine"
25
26 #include <string>
27 #include "NamedLocation.h"
28
29 class Stack;
30 class Quest;
31
32 //! A temple on the game map.
33 /** 
34  * A temple is the place where heroes can get quests or have their armies
35  * blessed.
36  */
37 class Temple : public NamedLocation
38 {
39     public:
40         //! The xml tag of this object in a saved-game file.
41         static std::string d_tag; 
42
43         //! Default constructor.
44         /**
45          * @param pos          The location of the temple on the game map.
46          * @param width        The span of tiles this temple covers.
47          * @param name         The name of the temple.
48          * @param type         The type of the temple.  This should always
49          *                     be 0.
50          */
51         Temple(Vector<int> pos, guint32 width, std::string name = DEFAULT_TEMPLE_NAME, 
52                int type = 0);
53
54         //! Copy constructor.
55         Temple(const Temple&);
56
57         //! Alternative copying constructor that changes the temple position.
58         Temple(const Temple&, Vector<int> pos);
59
60         //! Loading constructor.
61         /**
62          * @param helper  The opened saved-game file to load the temple from.
63          */
64         Temple(XML_Helper* helper, guint32 width);
65
66         //! Destructor.
67         ~Temple();
68
69         // Get Methods
70         
71         //! Returns the type of the temple.
72         int getType() const {return d_type;};
73
74         //! Returns whether or not the temple can be searched.
75         /**
76          * @note Temples can always be searched in this game.
77          */
78         bool searchable() const {return true;}
79
80
81         // Set Methods
82
83         //! Returns the type of the temple.
84         void setType(int type) {d_type=type;};
85
86
87         // Methods that operate on class data but do not modify the class.
88
89         //! Save the temple to the opened saved-game file.
90         bool save(XML_Helper* helper) const;
91
92         //! Return true if the temple has the default temple name.
93         bool isUnnamed() const {return getName() == getDefaultName() ? true : false;};
94
95         // Static Methods
96
97         //! Return the default name of any temple.
98         static std::string getDefaultName() {return _(DEFAULT_TEMPLE_NAME);};
99
100     protected:
101         
102         // DATA
103
104         //! The type of the temple.
105         /**
106          * The temple always has a type of 0, because there is only one kind
107          * of temple in the game.
108          */
109         int d_type;
110 };
111
112 #endif // TEMPLE_H