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 // Copyright (C) 2007 Ole Laursen
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Library General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 #include "QuestsManager.h"
27 std::string Temple::d_tag = "temple";
29 Temple::Temple(Vector<int> pos, guint32 width, std::string name, int type)
30 :NamedLocation(pos, width, name,
31 name + _(" can bless your armies or give you quests.")),
34 //mark the location on the game map as occupied by a temple
35 for (unsigned int i = 0; i < getSize(); i++)
36 for (unsigned int j = 0; j < getSize(); j++)
38 Vector<int> pos = getPos() + Vector<int>(i, j);
39 GameMap::getInstance()->getTile(pos)->setBuilding(Maptile::TEMPLE);
43 Temple::Temple(XML_Helper* helper, guint32 width)
44 :NamedLocation(helper, width)
46 //mark the location on the game map as occupied by a temple
47 helper->getData(d_type, "type");
48 for (unsigned int i = 0; i < getSize(); i++)
49 for (unsigned int j = 0; j < getSize(); j++)
51 Vector<int> pos = getPos() + Vector<int>(i, j);
52 GameMap::getInstance()->getTile(pos)->setBuilding(Maptile::TEMPLE);
56 Temple::Temple(const Temple& t)
57 :NamedLocation(t), d_type(t.d_type)
61 Temple::Temple(const Temple& t, Vector<int> pos)
62 :NamedLocation(t, pos), d_type(t.d_type)
70 bool Temple::save(XML_Helper* helper) const
74 retval &= helper->openTag(Temple::d_tag);
75 retval &= helper->saveData("id", d_id);
76 retval &= helper->saveData("x", getPos().x);
77 retval &= helper->saveData("y", getPos().y);
78 retval &= helper->saveData("name", getName(false));
79 retval &= helper->saveData("description", getDescription());
80 retval &= helper->saveData("type", d_type);
81 retval &= helper->closeTag();