diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-18 14:45:29 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-18 14:45:29 -0400 |
commit | 5c4c6284b385e55819bcbe396b8efd0d1c657c5f (patch) | |
tree | 9735299873f869c1ca74082519d40d4985766394 /sigmod | |
parent | 6d1422a0908042219ae03377b54585e27d3ff7a5 (diff) | |
download | sigen-5c4c6284b385e55819bcbe396b8efd0d1c657c5f.tar.gz sigen-5c4c6284b385e55819bcbe396b8efd0d1c657c5f.tar.xz sigen-5c4c6284b385e55819bcbe396b8efd0d1c657c5f.zip |
Add a preview sprite to Tile for the editor
Diffstat (limited to 'sigmod')
-rw-r--r-- | sigmod/Tile.cpp | 9 | ||||
-rw-r--r-- | sigmod/Tile.h | 14 |
2 files changed, 22 insertions, 1 deletions
diff --git a/sigmod/Tile.cpp b/sigmod/Tile.cpp index b478dbdf..84a6dc6d 100644 --- a/sigmod/Tile.cpp +++ b/sigmod/Tile.cpp @@ -39,7 +39,8 @@ Tile::Tile(const Game* parent, const int id) : Object(parent, id), m_name(""), m_walkable(true), - m_script("", "") + m_script("", ""), + m_preview(-1) { } @@ -70,6 +71,7 @@ void Tile::load(const QDomElement& xml) LOAD(name); LOAD(walkable); LOAD(script); + LOAD(preview); } QDomElement Tile::save() const @@ -78,20 +80,24 @@ QDomElement Tile::save() const SAVE(name); SAVE(walkable); SAVE(script); + SAVE(preview); return xml; } SETTER(Tile, QString&, Name, name) SETTER(Tile, bool, Walkable, walkable) SETTER(Tile, Script&, Script, script) +SETTER(Tile, int, Preview, preview) GETTER(Tile, QString, name) GETTER(Tile, bool, walkable) GETTER(Tile, Script, script) +GETTER(Tile, int, preview) CHECK(Tile, QString&, name) CHECK(Tile, bool, walkable) CHECK(Tile, Script&, script) +CHECK_INDEX(Tile, int, preview, game(), sprite) Tile& Tile::operator=(const Tile& rhs) { @@ -100,5 +106,6 @@ Tile& Tile::operator=(const Tile& rhs) COPY(name); COPY(walkable); COPY(script); + COPY(preview); return *this; } diff --git a/sigmod/Tile.h b/sigmod/Tile.h index 5030b58a..c92d1185 100644 --- a/sigmod/Tile.h +++ b/sigmod/Tile.h @@ -124,6 +124,12 @@ class SIGMOD_EXPORT Tile : public Object * \param script The script for the tile. */ void setScript(const Sigcore::Script& script); + /** + * Sets the preview sprite for the tile. It is only used while editing maps. + * + * \param preview The id of the sprite. + */ + void setPreview(const int preview); /** * \sa setName @@ -143,16 +149,24 @@ class SIGMOD_EXPORT Tile : public Object * \return The script for the tile. */ Sigcore::Script script() const; + /** + * \sa setPreview + * + * \return The sprite to use for a preview of the tile. + */ + int preview() const; bool nameCheck(const QString& name) const; bool walkableCheck(const bool walkable) const; bool scriptCheck(const Sigcore::Script& script) const; + bool previewCheck(const int preview) const; Tile& operator=(const Tile& rhs); private: QString m_name; bool m_walkable; Sigcore::Script m_script; + int m_preview; }; } |