diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-02-01 20:21:10 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-02-01 20:21:10 +0000 |
| commit | 91df1e8e35656314a8f6574521f1804d926bddbb (patch) | |
| tree | 84e941b992fcdf35d0c7460fa7c84223a8422958 /pokemod/Tile.cpp | |
| parent | 743f74512606cb24fae199dd45cf1a53837b4d16 (diff) | |
| download | sigen-91df1e8e35656314a8f6574521f1804d926bddbb.tar.gz sigen-91df1e8e35656314a8f6574521f1804d926bddbb.tar.xz sigen-91df1e8e35656314a8f6574521f1804d926bddbb.zip | |
[FIX] Only committed general last time
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@55 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Tile.cpp')
| -rw-r--r-- | pokemod/Tile.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp index 5cc74075..428e9ad3 100644 --- a/pokemod/Tile.cpp +++ b/pokemod/Tile.cpp @@ -26,27 +26,27 @@ const QStringList Tile::ForceStr = QStringList() << "None" << "Slip" << "Stop" << "Force" << "Push"; -Tile::Tile(const Pokemod& par, const unsigned _id) : +Tile::Tile(const Pokemod& par, const int _id) : Object("Tile", par, _id), name(""), pic(""), wildChance(1, 1), - hmType(UINT_MAX), - under(UINT_MAX), - forceType(UINT_MAX), - forceDirection(UINT_MAX) + hmType(-1), + under(-1), + forceType(-1), + forceDirection(-1) { - for (unsigned i = 0; i < D_End; ++i) + for (int i = 0; i < D_End; ++i) from[i] = false; } -Tile::Tile(const Pokemod& par, const Tile& t, const unsigned _id) : +Tile::Tile(const Pokemod& par, const Tile& t, const int _id) : Object("Tile", par, _id) { *this = t; } -Tile::Tile(const Pokemod& par, const QString& fname, const unsigned _id) : +Tile::Tile(const Pokemod& par, const QString& fname, const int _id) : Object("Tile", par, _id), pic("") { @@ -72,12 +72,12 @@ bool Tile::validate() const pokemod.validationMsg("A waterfall tile must be accessible from above and below"); valid = false; } - else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == UINT_MAX) || (pokemod.getTileByID(under).getHMType() != HM_Surf) || (pokemod.getTileByID(under).getHMType() != HM_Dive))) + else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == -1) || (pokemod.getTileByID(under).getHMType() != HM_Surf) || (pokemod.getTileByID(under).getHMType() != HM_Dive))) { pokemod.validationMsg("Invalid under tile"); valid = false; } - else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == UINT_MAX) || (pokemod.getTileByID(under).getHMType() != HM_End))) + else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == -1) || (pokemod.getTileByID(under).getHMType() != HM_End))) { pokemod.validationMsg("Invalid under tile"); valid = false; @@ -103,15 +103,15 @@ bool Tile::validate() const return valid; } -void Tile::load(const QString& fname, const unsigned _id) throw(Exception) +void Tile::load(const QString& fname, const int _id) throw(Exception) { Ini ini(fname); - if (_id == UINT_MAX) + if (_id == -1) ini.getValue("id", id); else id = _id; - unsigned i; - unsigned j; + int i; + int j; ini.getValue("name", name); ini.getValue("pic", pic); ini.getValue("from-up", from[D_Up], false); @@ -158,53 +158,53 @@ void Tile::setPic(const QString& p) throw(OpenException) pic = p; } -void Tile::setFrom(const unsigned d, const bool f) throw(BoundsException) +void Tile::setFrom(const int d, const bool f) throw(BoundsException) { if (D_End <= d) throw(BoundsException(className, "direction")); from[d] = f; } -void Tile::setWildChance(const unsigned n, const unsigned d) throw(Exception) +void Tile::setWildChance(const int n, const int d) throw(Exception) { wildChance.set(n, d); } -void Tile::setWildChanceNumerator(const unsigned n) throw(Exception) +void Tile::setWildChanceNumerator(const int n) throw(Exception) { wildChance.setNum(n); } -void Tile::setWildChanceDenominator(const unsigned d) throw(Exception) +void Tile::setWildChanceDenominator(const int d) throw(Exception) { wildChance.setDenom(d); } -void Tile::setHMType(const unsigned h) throw(BoundsException) +void Tile::setHMType(const int h) throw(BoundsException) { if (HM_End <= h) throw(BoundsException(className, "hmType")); hmType = h; - under = UINT_MAX; + under = -1; } -void Tile::setUnder(const unsigned u) throw(Exception) +void Tile::setUnder(const int u) throw(Exception) { if ((hmType != HM_Whirlpool) || (hmType != HM_Cut) || (hmType != HM_RockSmash)) throw(UnusedException(className, "under")); - if ((u == id) || (pokemod.getTileIndex(u) == UINT_MAX)) + if ((u == id) || (pokemod.getTileIndex(u) == -1)) throw(BoundsException(className, "under")); under = u; } -void Tile::setForceType(const unsigned f) throw(BoundsException) +void Tile::setForceType(const int f) throw(BoundsException) { if (End <= f) throw(BoundsException(className, "forceType")); forceType = f; } -void Tile::setForceDirection(const unsigned f) throw(Exception) +void Tile::setForceDirection(const int f) throw(Exception) { if ((forceType == None) || (forceType == Stop)) throw(UnusedException(className, "forceDirection")); @@ -223,7 +223,7 @@ QString Tile::getPic() const return pic; } -bool Tile::getFrom(const unsigned d) const throw(BoundsException) +bool Tile::getFrom(const int d) const throw(BoundsException) { if (D_End <= d) throw(BoundsException(className, "direction")); @@ -235,22 +235,22 @@ Frac Tile::getWildChance() const return wildChance; } -unsigned Tile::getHMType() const +int Tile::getHMType() const { return hmType; } -unsigned Tile::getUnder() const +int Tile::getUnder() const { return under; } -unsigned Tile::getForceType() const +int Tile::getForceType() const { return forceType; } -unsigned Tile::getForceDirection() const +int Tile::getForceDirection() const { return forceDirection; } @@ -261,7 +261,7 @@ Tile& Tile::operator=(const Tile& rhs) return *this; name = rhs.name; pic = rhs.pic; - for (unsigned i = 0; i < D_End; ++i) + for (int i = 0; i < D_End; ++i) from[i] = rhs.from[i]; wildChance = rhs.wildChance; hmType = rhs.hmType; |
