diff options
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; } |
