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
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.
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.
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
24 #define DEFAULT_TEMPLE_NAME "Shrine"
27 #include "NamedLocation.h"
32 //! A temple on the game map.
34 * A temple is the place where heroes can get quests or have their armies
37 class Temple : public NamedLocation
40 //! The xml tag of this object in a saved-game file.
41 static std::string d_tag;
43 //! Default constructor.
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
51 Temple(Vector<int> pos, guint32 width, std::string name = DEFAULT_TEMPLE_NAME,
55 Temple(const Temple&);
57 //! Alternative copying constructor that changes the temple position.
58 Temple(const Temple&, Vector<int> pos);
60 //! Loading constructor.
62 * @param helper The opened saved-game file to load the temple from.
64 Temple(XML_Helper* helper, guint32 width);
71 //! Returns the type of the temple.
72 int getType() const {return d_type;};
74 //! Returns whether or not the temple can be searched.
76 * @note Temples can always be searched in this game.
78 bool searchable() const {return true;}
83 //! Returns the type of the temple.
84 void setType(int type) {d_type=type;};
87 // Methods that operate on class data but do not modify the class.
89 //! Save the temple to the opened saved-game file.
90 bool save(XML_Helper* helper) const;
92 //! Return true if the temple has the default temple name.
93 bool isUnnamed() const {return getName() == getDefaultName() ? true : false;};
97 //! Return the default name of any temple.
98 static std::string getDefaultName() {return _(DEFAULT_TEMPLE_NAME);};
104 //! The type of the temple.
106 * The temple always has a type of 0, because there is only one kind
107 * of temple in the game.