summaryrefslogtreecommitdiffstats
path: root/pokemod/Tile.cpp
diff options
context:
space:
mode:
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;
}