summaryrefslogtreecommitdiffstats
path: root/pokemod/Tile.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-08-18 18:51:31 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-08-18 18:51:31 +0000
commitc1793a87ebea8c8e1bb2d5d1a409d105bfae3871 (patch)
treeb7ff53cf9747ad61a80b169e1adad96950f4b16c /pokemod/Tile.cpp
parentfa4764c9e4d86fdfa976bb9fa9f6976e82c496d5 (diff)
[FIX] Script to make a tarball now defaults to HEAD for the revision
[FIX] Enumeration types used to help remove some checks [FIX] Macro code moved to static members of Object (not all though) [FIX] Scripting wrappers now share information by keeping track of already-created instances of the wrapper [FIX] Scripting methods are now Q_SCRIPTABLE and not slots git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@239 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Tile.cpp')
-rw-r--r--pokemod/Tile.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp
index 4e52a11f..bacefad1 100644
--- a/pokemod/Tile.cpp
+++ b/pokemod/Tile.cpp
@@ -33,9 +33,10 @@ Pokemod::Tile::Tile(const Pokemod* parent, const int id) :
Object(parent, id),
m_name(""),
m_sprite(-1),
+ m_from(D_End),
m_script("", "")
{
- for (int i = 0; i < D_End; ++i)
+ for (int i = 0; i < m_from.size(); ++i)
m_from[i] = false;
}
@@ -64,19 +65,19 @@ void Pokemod::Tile::validate()
void Pokemod::Tile::load(const QDomElement& xml)
{
LOAD_BEGIN();
- LOAD(QString, name);
- LOAD(int, sprite);
- LOAD_ARRAY(bool, from, D_End);
- LOAD(Script, script);
+ LOAD(name);
+ LOAD(sprite);
+ LOAD_ARRAY(from);
+ LOAD(script);
}
QDomElement Pokemod::Tile::save() const
{
SAVE_CREATE();
- SAVE(QString, name);
- SAVE(int, sprite);
- SAVE_ARRAY(bool, from, D_End);
- SAVE(Script, script);
+ SAVE(name);
+ SAVE(sprite);
+ SAVE_ARRAY(from);
+ SAVE(script);
return xml;
}
@@ -96,12 +97,9 @@ void Pokemod::Tile::setSprite(const int sprite)
CHECK(sprite);
}
-void Pokemod::Tile::setFrom(const int direction, const bool state)
+void Pokemod::Tile::setFrom(const Direction direction, const bool state)
{
- if (D_End <= direction)
- emit(error(bounds("direction")));
- else
- CHECK_ARRAY(from[direction], state);
+ CHECK_ARRAY(from[direction], state);
}
void Pokemod::Tile::setScript(const Script& script)
@@ -119,13 +117,8 @@ int Pokemod::Tile::sprite() const
return m_sprite;
}
-bool Pokemod::Tile::from(const int direction) const
+bool Pokemod::Tile::from(const Direction direction) const
{
- if (D_End <= direction)
- {
- emit(warning(bounds("direction")));
- return false;
- }
return m_from[direction];
}
@@ -140,7 +133,7 @@ Pokemod::Tile& Pokemod::Tile::operator=(const Tile& rhs)
return *this;
COPY(name);
COPY(sprite);
- COPY_ARRAY(from, D_End);
+ COPY(from);
COPY(script);
return *this;
}