1 // Copyright (C) 2008, 2009 Ben Asselstine
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Library General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 #include "SmallTile.h"
21 std::string SmallTile::d_tag = "smallmap";
25 SmallTile::SmallTile()
28 d_color.set_rgb_p(80.0/255.0,172.0/255.0,28.0/255.0);
29 d_second_color.set_rgb_p(0,0,0);
30 d_third_color.set_rgb_p(0,0,0);
33 SmallTile::SmallTile(XML_Helper* helper)
35 helper->getData(d_color, "color");
38 helper->getData(i, "pattern");
39 SmallTile::Pattern pattern = static_cast<SmallTile::Pattern>(i);
44 helper->getData(d_second_color, "2nd_color");
45 if (pattern != STIPPLED && pattern != SUNKEN)
46 helper->getData(d_third_color, "3rd_color");
50 bool SmallTile::save(XML_Helper *helper) const
54 retval &= helper->openTag(d_tag);
55 retval &= helper->saveData("pattern", d_pattern);
58 //patterns with a single colour
60 retval &= helper->saveData("color", d_color);
62 //patterns with two colours
63 case STIPPLED: case SUNKEN:
64 retval &= helper->saveData("color", d_color);
65 retval &= helper->saveData("2nd_color", d_second_color);
67 //patterns with three colours
68 case RANDOMIZED: case TABLECLOTH: case DIAGONAL: case CROSSHATCH:
70 retval &= helper->saveData("color", d_color);
71 retval &= helper->saveData("2nd_color", d_second_color);
72 retval &= helper->saveData("3rd_color", d_third_color);
75 retval &= helper->closeTag();
80 SmallTile::~SmallTile()