diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-19 18:12:17 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-19 18:12:17 +0000 |
| commit | fe31331e2807634ae659e372358bac5781de9130 (patch) | |
| tree | 6b208974e3f141e9b22152526e2d42e967bfd4ec /pokemod/MapEffect.cpp | |
| parent | 6679f5cffa9d35a23b76605ddfbf3257f882b6ee (diff) | |
| download | sigen-fe31331e2807634ae659e372358bac5781de9130.tar.gz sigen-fe31331e2807634ae659e372358bac5781de9130.tar.xz sigen-fe31331e2807634ae659e372358bac5781de9130.zip | |
[FIX] IndexException is more explicit
[FIX] Added SizeException for image validation
[FIX] QPixmaps are now verified
[FIX] Classes now use error and warning rather than throwing
[FIX] Deleted Object.cpp
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@100 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/MapEffect.cpp')
| -rw-r--r-- | pokemod/MapEffect.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp index f9f39a24..d17c0df2 100644 --- a/pokemod/MapEffect.cpp +++ b/pokemod/MapEffect.cpp @@ -39,7 +39,7 @@ MapEffect::MapEffect(const Pokemod* pokemod, const int id) : m_name(""), m_coordinate(0, 0), m_existFlag(0, 0), - m_skin(""), + m_skin(192, 128), m_effect(INT_MAX), m_value1(INT_MAX), m_value2(INT_MAX), @@ -168,16 +168,17 @@ void MapEffect::setExistFlag(const Flag& existFlag) m_existFlag = existFlag; } -void MapEffect::setSkin(const QPixmap& skin) throw(Exception) +void MapEffect::setSkin(const QPixmap& skin) throw(SizeException) { - // TODO: check size is 128x128 + if (skin.size() != QSize(192, 128)) + error<SizeException>("skin"); m_skin = skin; } void MapEffect::setEffect(const int effect) throw(BoundsException) { if (E_End <= effect) - throw(BoundsException(className(), "effect")); + error<BoundsException>("effect"); m_effect = effect; m_value1 = INT_MAX; m_value2 = INT_MAX; @@ -186,7 +187,7 @@ void MapEffect::setEffect(const int effect) throw(BoundsException) void MapEffect::setValue1(const int value1) throw(UnusedException) { if ((m_effect != E_StrengthBlock) && (m_effect != E_Button)) - throw(UnusedException(className(), "val1")); + error<UnusedException>("val1"); m_value1 = value1; } @@ -196,19 +197,19 @@ void MapEffect::setValue2(const int value2) throw(Exception) { case E_Item: if (pokemod()->itemIndex(value2) == INT_MAX) - throw(BoundsException(className(), "val2")); + error<BoundsException>("val2"); break; case E_PC: if (PC_End <= value2) - throw(BoundsException(className(), "val2")); + error<BoundsException>("val2"); break; case E_StrengthBlock: case E_Button: if (Flag::End <= value2) - throw(BoundsException(className(), "val2")); + error<BoundsException>("val2"); break; default: - throw(UnusedException(className(), "val2")); + error<UnusedException>("val2"); break; } m_value2 = value2; @@ -217,7 +218,7 @@ void MapEffect::setValue2(const int value2) throw(Exception) void MapEffect::setDirection(const int direction) throw(BoundsException) { if (Pokemod::D_End_None <= direction) - throw(BoundsException(className(), "direction")); + error<BoundsException>("direction"); m_direction = direction; } @@ -234,7 +235,7 @@ void MapEffect::setCanMove(const bool canMove) void MapEffect::setDialog(const int dialog) throw(BoundsException) { if (pokemod()->dialogIndex(dialog) == INT_MAX) - throw(BoundsException(className(), "dialog")); + error<BoundsException>("dialog"); m_dialog = dialog; } |
