diff options
Diffstat (limited to 'pokemod/Tile.cpp')
-rw-r--r-- | pokemod/Tile.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp index 11043882..2ef974b8 100644 --- a/pokemod/Tile.cpp +++ b/pokemod/Tile.cpp @@ -34,7 +34,7 @@ Tile::Tile(const Pokemod* par, const int _id) : forceType(-1), forceDirection(-1) { - for (int i = 0; i < D_End; ++i) + for (int i = 0; i < Pokemod::D_End; ++i) from[i] = false; } @@ -64,29 +64,29 @@ bool Tile::validate() const pokemod->validationMsg("Cannot find tile image"); valid = false; } - if ((hmType == HM_Waterfall) && (!from[D_Up] || !from[D_Down])) + if ((hmType == Pokemod::HM_Waterfall) && (!from[Pokemod::D_Up] || !from[Pokemod::D_Down])) { pokemod->validationMsg("A waterfall tile must be accessible from above and below"); valid = false; } - else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod->getTileIndex(under) == -1) || (pokemod->getTileByID(under)->getHMType() != HM_Surf) || (pokemod->getTileByID(under)->getHMType() != HM_Dive))) + else if ((hmType == Pokemod::HM_Whirlpool) && ((under == id) || (pokemod->getTileIndex(under) == -1) || (pokemod->getTileByID(under)->getHMType() != Pokemod::HM_Surf) || (pokemod->getTileByID(under)->getHMType() != Pokemod::HM_Dive))) { pokemod->validationMsg("Invalid under tile"); valid = false; } - else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod->getTileIndex(under) == -1) || (pokemod->getTileByID(under)->getHMType() != HM_End))) + else if ((hmType == Pokemod::HM_Whirlpool) && ((under == id) || (pokemod->getTileIndex(under) == -1) || (pokemod->getTileByID(under)->getHMType() != Pokemod::HM_End))) { pokemod->validationMsg("Invalid under tile"); valid = false; } - else if ((hmType == HM_RockClimb) && (!from[D_Up] || !from[D_Down])) + else if ((hmType == Pokemod::HM_RockClimb) && (!from[Pokemod::D_Up] || !from[Pokemod::D_Down])) { pokemod->validationMsg("A rock climb tile must be accessible from above and below"); valid = false; } if (forceType < End) { - if (((forceType == Slip) || (forceType == Force) || (forceType == Push)) && (D_End <= forceDirection)) + if (((forceType == Slip) || (forceType == Force) || (forceType == Push)) && (Pokemod::D_End <= forceDirection)) { pokemod->validationMsg("Invalid force direction"); valid = false; @@ -110,10 +110,10 @@ void Tile::load(const QString& fname, const int _id) throw(Exception) int i; int j; ini.getValue("name", name); - ini.getValue("from-up", from[D_Up], false); - ini.getValue("from-down", from[D_Down], false); - ini.getValue("from-left", from[D_Left], false); - ini.getValue("from-right", from[D_Right], false); + ini.getValue("from-up", from[Pokemod::D_Up], false); + ini.getValue("from-down", from[Pokemod::D_Down], false); + ini.getValue("from-left", from[Pokemod::D_Left], false); + ini.getValue("from-right", from[Pokemod::D_Right], false); ini.getValue("wildChance-n", i, 1); ini.getValue("wildChance-d", j, 1); wildChance.set(i, j); @@ -128,10 +128,10 @@ void Tile::save() const throw(Exception) Ini ini; ini.addField("id", id); ini.addField("name", name); - ini.addField("from-up", from[D_Up]); - ini.addField("from-down", from[D_Down]); - ini.addField("from-left", from[D_Left]); - ini.addField("from-right", from[D_Right]); + ini.addField("from-up", from[Pokemod::D_Up]); + ini.addField("from-down", from[Pokemod::D_Down]); + ini.addField("from-left", from[Pokemod::D_Left]); + ini.addField("from-right", from[Pokemod::D_Right]); ini.addField("wildChance-n", wildChance.getNum()); ini.addField("wildChance-d", wildChance.getDenom()); ini.addField("hmType", hmType); @@ -157,7 +157,7 @@ void Tile::setPic(const QString& fname) throw(Exception) void Tile::setFrom(const int d, const bool f) throw(BoundsException) { - if (D_End <= d) + if (Pokemod::D_End <= d) throw(BoundsException(className, "direction")); from[d] = f; } @@ -179,7 +179,7 @@ void Tile::setWildChanceDenom(const int d) throw(Exception) void Tile::setHMType(const int h) throw(BoundsException) { - if (HM_End <= h) + if (Pokemod::HM_End <= h) throw(BoundsException(className, "hmType")); hmType = h; under = -1; @@ -189,7 +189,7 @@ void Tile::setUnder(const int u) throw(Exception) { if (hmType != -1) { - if ((hmType != HM_Whirlpool) || (hmType != HM_Cut) || (hmType != HM_RockSmash)) + if ((hmType != Pokemod::HM_Whirlpool) || (hmType != Pokemod::HM_Cut) || (hmType != Pokemod::HM_RockSmash)) throw(UnusedException(className, "under")); if ((u == id) || (pokemod->getTileIndex(u) == -1)) throw(BoundsException(className, "under")); @@ -210,7 +210,7 @@ void Tile::setForceDirection(const int f) throw(Exception) { if (forceType == Stop) throw(UnusedException(className, "forceDirection")); - if (D_End <= f) + if (Pokemod::D_End <= f) throw(BoundsException(className, "forceDirection")); } forceDirection = f; @@ -228,7 +228,7 @@ QString Tile::getPic() const bool Tile::getFrom(const int d) const throw(BoundsException) { - if (D_End <= d) + if (Pokemod::D_End <= d) throw(BoundsException(className, "direction")); return from[d]; } @@ -263,7 +263,7 @@ Tile& Tile::operator=(const Tile& rhs) if (this == &rhs) return *this; name = rhs.name; - for (int i = 0; i < D_End; ++i) + for (int i = 0; i < Pokemod::D_End; ++i) from[i] = rhs.from[i]; wildChance = rhs.wildChance; hmType = rhs.hmType; |