summaryrefslogtreecommitdiffstats
path: root/pokemod/Tile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/Tile.cpp')
-rw-r--r--pokemod/Tile.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp
index ba6bb9ab..80f7d7b4 100644
--- a/pokemod/Tile.cpp
+++ b/pokemod/Tile.cpp
@@ -35,6 +35,7 @@ Tile::Tile(const Tile& tile) :
Tile::Tile(const Pokemod* pokemod, const int id) :
Object("Tile", pokemod, id),
m_name(""),
+ m_sprite(64, 64),
m_wildChance(1, 1),
m_hmType(INT_MAX),
m_under(INT_MAX),
@@ -134,16 +135,17 @@ void Tile::setName(const QString& name)
m_name = name;
}
-void Tile::setSprite(const QPixmap& sprite) throw(Exception)
+void Tile::setSprite(const QPixmap& sprite) throw(SizeException)
{
- // TODO: check dimension
+ if (sprite.size() != QSize(64, 64))
+ error<SizeException>("sprte");
m_sprite = sprite;
}
void Tile::setFrom(const int direction, const bool state) throw(BoundsException)
{
if (Pokemod::D_End <= direction)
- throw(BoundsException(className(), "direction"));
+ error<BoundsException>("direction");
m_from[direction] = state;
}
@@ -155,7 +157,7 @@ void Tile::setWildChance(const Fraction& wildChance) throw(Exception)
void Tile::setHMType(const int hmType) throw(BoundsException)
{
if (Pokemod::HM_End <= hmType)
- throw(BoundsException(className(), "hmType"));
+ error<BoundsException>("hmType");
m_hmType = hmType;
m_under = INT_MAX;
}
@@ -165,9 +167,9 @@ void Tile::setUnder(const int under) throw(Exception)
if (m_hmType != INT_MAX)
{
if ((m_hmType != Pokemod::HM_Whirlpool) || (m_hmType != Pokemod::HM_Cut) || (m_hmType != Pokemod::HM_RockSmash))
- throw(UnusedException(className(), "under"));
+ error<UnusedException>("under");
if ((under == id()) || (pokemod()->tileIndex(under) == INT_MAX))
- throw(BoundsException(className(), "under"));
+ error<BoundsException>("under");
}
m_under = under;
}
@@ -175,7 +177,7 @@ void Tile::setUnder(const int under) throw(Exception)
void Tile::setForceType(const int forceType) throw(BoundsException)
{
if (End <= forceType)
- throw(BoundsException(className(), "forceType"));
+ error<BoundsException>("forceType");
m_forceType = forceType;
}
@@ -184,9 +186,9 @@ void Tile::setForceDirection(const int forceDirection) throw(Exception)
if (m_forceType != INT_MAX)
{
if (m_forceType == Stop)
- throw(UnusedException(className(), "forceDirection"));
+ error<UnusedException>("forceDirection");
if (Pokemod::D_End <= forceDirection)
- throw(BoundsException(className(), "forceDirection"));
+ error<BoundsException>("forceDirection");
}
m_forceDirection = forceDirection;
}
@@ -204,7 +206,7 @@ QPixmap Tile::sprite() const
bool Tile::from(const int direction) const throw(BoundsException)
{
if (Pokemod::D_End <= direction)
- throw(BoundsException(className(), "direction"));
+ warning<BoundsException>("direction");
return m_from[direction];
}