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
24 #include "xmlhelper.h"
26 //! Describes the appearance of a tile on the miniature map.
32 //! The xml tag of this object in a tileset configuration file.
33 static std::string d_tag;
35 //! The terrain tile's appearance as seen on the OverviewMap.
38 //! The terrain feature is shown as a single solid colour.
41 //! The terrain feature is checkered with two alternating colours.
43 * The stippled pattern looks something like this:
51 * It is currently used for Type::FOREST, and Type::HILLS.
55 //! The feature is random pixels with three different colours.
57 * The random pattern looks something like this:
65 * It is currently used for Type::MOUNTAINS.
69 //! The feature is shaded on the bottom and on the left.
71 * The sunken pattern looks something like this:
79 * It is currently used for Type::WATER.
83 //! The feature is shown as a 3 colour pattern.
85 * The tablecloth pattern looks something like this:
93 * It is currently used for Type::SWAMP.
98 //! The feature is shaded on the top and on the left, and striped too.
100 * The sunken striped pattern looks something like this:
108 * It is currently used for Type::WATER.
114 //! Default constructor.
117 //! Loading constructor.
119 * Loads the tileset.tile XML entities in the tileset configuration
122 SmallTile(XML_Helper* helper);
130 //! Get the colour associated with this tile for the smallmap.
131 Gdk::Color getColor() const {return d_color;}
133 //! Get the alternate colour associated with this tile's pattern.
135 * This "second" colour gets used when SmallTile::Pattern is
136 * STIPPLED, RANDOMIZED, SUNKEN, or TABLECLOTH.
138 Gdk::Color getSecondColor() const {return d_second_color;}
140 //! Get another alternate colour associated with this tile's pattern.
142 * This "third" colour gets used when SmallTile::Pattern is
143 * RANDOMIZED, DIAGONAL, CROSSHATCH, or TABLECLOTH.
145 Gdk::Color getThirdColor() const {return d_third_color;}
147 //! Get the pattern (solid, stippled, random) of this type.
148 Pattern getPattern() const {return d_pattern;}
153 //! Set the colour associated with this tile for the smallmap.
154 void setColor(Gdk::Color clr) {d_color = clr;}
156 //! Set the alternate colour associated with this tile's pattern.
157 void setSecondColor(Gdk::Color color) {d_second_color = color;}
159 //! Set another alternate colour associated with this tile's pattern.
160 void setThirdColor(Gdk::Color color) {d_third_color = color;}
162 //! set the pattern (solid, stippled, random) of this type.
163 void setPattern(Pattern pattern) {d_pattern = pattern;}
166 // Methods that operate on class data but do not modify the class.
168 //! Save a SmallTile to an opened tile configuration file.
170 * @param The opened XML tile configuration file.
172 bool save(XML_Helper *helper) const;
176 //! The general appearance of the terrain tile on the OverviewMap.
178 * Equates to the tileset.tile.smallmap.d_pattern XML entities in the
179 * tileset configuration file.
185 * Equates to the following XML entities in the tileset configuration
187 * tileset.tile.smallmap.d_red
188 * tileset.tile.smallmap.d_green
189 * tileset.tile.smallmap.d_blue
195 * Only used when SmallTile::Pattern is one of: STIPPLED,
196 * RANDOMIZED, SUNKEN, TABLECLOTH, DIAGONAL, or CROSSHATCH.
198 * Equates to the following XML entities in the tileset configuration
200 * tileset.tile.smallmap.d_2nd_red
201 * tileset.tile.smallmap.d_2nd_green
202 * tileset.tile.smallmap.d_2nd_blue
204 Gdk::Color d_second_color;
208 * Only used when Tile::Pattern is Tile::RANDOMIZED, or
211 * Equates to the following XML entities in the tileset configuration
213 * tileset.tile.smallmap.d_3rd_red
214 * tileset.tile.smallmap.d_3rd_green
215 * tileset.tile.smallmap.d_3rd_blue
217 Gdk::Color d_third_color;
221 #endif // SMALLTILE_H