diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-01-21 06:38:00 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-01-21 06:38:00 +0000 |
| commit | 342fa6879e9fd8a757ebabe0a30370137b8d83a7 (patch) | |
| tree | 647fb184567a481dc86373116203740c2607f366 /pokemod/Tile.cpp | |
| parent | b2e515e6badeb033bbdb53b28424d3b8e7289067 (diff) | |
| download | sigen-342fa6879e9fd8a757ebabe0a30370137b8d83a7.tar.gz sigen-342fa6879e9fd8a757ebabe0a30370137b8d83a7.tar.xz sigen-342fa6879e9fd8a757ebabe0a30370137b8d83a7.zip | |
[FIX] const char*[] -> QStringList for easier laoding into KComboBox
[DEL] pokemod/pokemod_inc.h no longer needed
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@37 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Tile.cpp')
| -rw-r--r-- | pokemod/Tile.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp index 025782d4..d6d46440 100644 --- a/pokemod/Tile.cpp +++ b/pokemod/Tile.cpp @@ -24,9 +24,7 @@ #include "Pokemod.h" #include "Tile.h" -const char* PokeMod::Tile::HMTypeStr[PokeMod::Tile::H_End] = -{"None", "Surf", "Dive", "Waterfall", "Whirlpool", "Cut", "Headbutt", "Rock Climb", "Rock Smash"}; -const char* PokeMod::Tile::ForceStr[PokeMod::Tile::F_End] = {"None", "Slip", "Stop", "Force", "Push"}; +const QStringList PokeMod::Tile::ForceStr = QStringList() << "None" << "Slip" << "Stop" << "Force" << "Push"; PokeMod::Tile::Tile(const Pokemod& par, const unsigned _id) : Object(par, _id), @@ -69,29 +67,29 @@ bool PokeMod::Tile::validate() const pokemod.validationMsg("Cannot find tile image"); valid = false; } - if ((hmType == H_Waterfall) && (!from[D_Up] || !from[D_Down])) + if ((hmType == HM_Waterfall) && (!from[D_Up] || !from[D_Down])) { pokemod.validationMsg("A waterfall tile must be accessible from above and below"); valid = false; } - else if ((hmType == H_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == UINT_MAX) || (pokemod.getTile(pokemod.getTileIndex(under)).getHMType() != H_Surf) || (pokemod.getTile(pokemod.getTileIndex(under)).getHMType() != H_Dive))) + else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == UINT_MAX) || (pokemod.getTileByID(under).getHMType() != HM_Surf) || (pokemod.getTileByID(under).getHMType() != HM_Dive))) { pokemod.validationMsg("Invalid under tile"); valid = false; } - else if ((hmType == H_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == UINT_MAX) || (pokemod.getTile(pokemod.getTileIndex(under)).getHMType() != H_None))) + else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == UINT_MAX) || (pokemod.getTileByID(under).getHMType() != HM_End))) { pokemod.validationMsg("Invalid under tile"); valid = false; } - else if ((hmType == H_RockClimb) && (!from[D_Up] || !from[D_Down])) + else if ((hmType == HM_RockClimb) && (!from[D_Up] || !from[D_Down])) { pokemod.validationMsg("A rock climb tile must be accessible from above and below"); valid = false; } - if (forceType < F_End) + if (forceType < End) { - if (((forceType == F_Slip) || (forceType == F_Force) || (forceType == F_Push)) && (D_End <= forceDirection)) + if (((forceType == Slip) || (forceType == Force) || (forceType == Push)) && (D_End <= forceDirection)) { pokemod.validationMsg("Invalid force direction"); valid = false; @@ -184,7 +182,7 @@ void PokeMod::Tile::setWildChanceDenominator(const unsigned d) throw(Exception) void PokeMod::Tile::setHMType(const unsigned h) throw(BoundsException) { - if (H_End <= h) + if (HM_End <= h) throw(BoundsException("Tile", "hmType")); hmType = h; under = UINT_MAX; @@ -192,7 +190,7 @@ void PokeMod::Tile::setHMType(const unsigned h) throw(BoundsException) void PokeMod::Tile::setUnder(const unsigned u) throw(Exception) { - if ((hmType != H_Whirlpool) || (hmType != H_Cut) || (hmType != H_RockSmash)) + if ((hmType != HM_Whirlpool) || (hmType != HM_Cut) || (hmType != HM_RockSmash)) throw(UnusedException("Tile", "under")); if ((u == id) || (pokemod.getTileIndex(u) == UINT_MAX)) throw(BoundsException("Tile", "under")); @@ -201,13 +199,15 @@ void PokeMod::Tile::setUnder(const unsigned u) throw(Exception) void PokeMod::Tile::setForceType(const unsigned f) throw(BoundsException) { - if (F_End <= f) + if (End <= f) throw(BoundsException("Tile", "forceType")); forceType = f; } -void PokeMod::Tile::setForceDirection(const unsigned f) throw(BoundsException) +void PokeMod::Tile::setForceDirection(const unsigned f) throw(Exception) { + if ((forceType == None) || (forceType == Stop)) + throw(UnusedException("Tile", "forceDirection")); if (D_End <= f) throw(BoundsException("Tile", "forceDirection")); forceDirection = f; |
