diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2007-09-21 15:36:22 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2007-09-21 15:36:22 +0000 |
| commit | 5b55d13ead7e352ee1feaae72009e8abf5bd071a (patch) | |
| tree | 6c2838312dd7f42769280e24e8abc16b53c165cb /pokemod/Tile.cpp | |
| parent | e94d9893b8753e72adb92b2c5eb203830ddf641c (diff) | |
[FIX] Neural Network methods complete
[FIX] Wrapped Node up into the layer
[FIX] Wrapped NatureEffect into Nature
[FIX] Getting around to fixing up the design of the PokéMod stuff
[FIX] Creating new subclasses now returns pointer to new subclass
[FIX] Simplified interfaces
[FIX] Minor style issues
[FIX] Renamed CoinItem to CoinListObject
[FIX] Renamed MapTrainerTeam to MapTrainerPokemon
[FIX] Renamed MapWildPokemon to MapWildListPokemon
[FIX] Moved global enums to relevant classes
[FIX] Removed general logging features
[DEL] pokemod/Debug.{h, cpp}
[DEL] pokemod/Path.{h, cpp}
[FIX] Using QFile rather than custom Path class for checking for files
[FIX] Set* methods now return a bool to let the caller know if anything actually changed (if it can fail, otherwise it is void)
[ADD] Compliation without errors is required for pokemod from now on before commits
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@24 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Tile.cpp')
| -rw-r--r-- | pokemod/Tile.cpp | 851 |
1 files changed, 363 insertions, 488 deletions
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp index f514bb3e..6068f7d1 100644 --- a/pokemod/Tile.cpp +++ b/pokemod/Tile.cpp @@ -1,488 +1,363 @@ -/////////////////////////////////////////////////////////////////////////////
-// Name: pokemod/Tile.cpp
-// Purpose: Define a tile for the map
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Thu May 31 2007 13:52:39
-// Copyright: ©2007 Nerdy Productions
-// Licence:
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTTile or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program. If not, see <http://www.gnu.org/licenses/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include "Tile.h"
-
-PokeGen::PokeMod::Tile::Tile(const Pokemod *par, const unsigned _id) :
- name(""),
- pic(""),
- fromUp(false),
- fromDown(false),
- fromLeft(false),
- fromRight(false),
- isWild(false),
- wildChance(1, 1),
- waterType(UINT_MAX),
- underWater(UINT_MAX),
- isCuttable(false),
- underCut(UINT_MAX),
- canHeadbutt(false),
- isRockClimb(false),
- forceType(UINT_MAX),
- forceDirection(UINT_MAX)
-{
- LogCtor("Tile", id);
- id = _id;
- pokemod = par;
-}
-
-PokeGen::PokeMod::Tile::Tile(const Pokemod *par, Ini &ini, const unsigned _id)
-{
- LogCtorIni("Tile", id);
- pokemod = par;
- ImportIni(ini, _id);
- if (id == UINT_MAX)
- LogIdError("Tile");
-}
-
-PokeGen::PokeMod::Tile::~Tile()
-{
- LogDtor("Tile", id, name);
-}
-
-void PokeGen::PokeMod::Tile::Validate()
-{
- LogValidateStart("Tile", id, name);
- if (name == "")
- {
- LogVarNotSet("Tile", id, "Name", name);
- isValid = false;
- }
- if (!pic.DoesExist())
- {
- if (pic == "")
- LogVarNotSet("Tile", id, "pic", name);
- else
- LogVarNotValid("Tile", id, "pic", name);
- isValid = false;
- }
- if (WTRT_END <= waterType)
- {
- LogVarNotValid("Tile", id, "waterType", name);
- isValid = false;
- }
- else if (waterType == WTRT_WATERFALL)
- {
- if (!fromDown)
- {
- Log::Write(QString("Tile: Waterfall needs to be accessible from below in %u (%s)", id, name.c_str()), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
- isValid = false;
- }
- }
- else if (waterType == WTRT_WHIRLPOOL)
- {
- if (!pokemod->GetTile(underWater))
- {
- LogVarNotValid("Tile", id, "underWater", name);
- isValid = false;
- }
- }
- if (isCuttable)
- {
- if (!pokemod->GetTile(underCut))
- {
- LogVarNotValid("Tile", id, "underCut", name);
- isValid = false;
- }
- }
- if (isRockClimb)
- {
- if (!fromDown)
- {
- Log::Write(QString("Tile: Rock Climbing needs to be accessible from below in %u (%s)", id, name.c_str()), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
- isValid = false;
- }
- }
- if (forceType < FT_END)
- {
- if ((forceType == FT_SLIP) || (forceType == FT_FORCE) || (forceType == FT_PUSH))
- {
- if (DIR_END <= forceDirection)
- {
- LogVarNotValid("Tile", id, "forceDirection", name);
- isValid = false;
- }
- }
- }
- else
- {
- LogVarNotValid("Tile", id, "forceType", name);
- isValid = false;
- }
- LogValidateOver("Tile", id, isValid, name);
-}
-
-void PokeGen::PokeMod::Tile::ImportIni(Ini &ini, const unsigned _id)
-{
- LogImportStart("Tile");
- if (_id == UINT_MAX)
- {
- ini.GetValue("id", id);
- if (id == UINT_MAX)
- LogIdNotFound("Tile");
- }
- else
- id = _id;
- unsigned i;
- unsigned j;
- ini.GetValue("name", name);
- ini.GetValue("pic", pic);
- ini.GetValue("fromUp", fromUp, false);
- ini.GetValue("fromDown", fromDown, false);
- ini.GetValue("fromLeft", fromLeft, false);
- ini.GetValue("fromRight", fromRight, false);
- ini.GetValue("isWild", isWild, false);
- ini.GetValue("wildChance-n", i, 1);
- ini.GetValue("wildChance-d", j, 1);
- wildChance.Set(i, j);
- ini.GetValue("waterType", waterType);
- ini.GetValue("underWater", underWater);
- ini.GetValue("isCuttable", isCuttable, false);
- ini.GetValue("underCut", underCut);
- ini.GetValue("canHeadbutt", canHeadbutt, false);
- ini.GetValue("isRockClimb", isRockClimb, false);
- ini.GetValue("forceType", forceType);
- ini.GetValue("forceDirection", forceDirection);
- LogImportOver("Tile", id, name);
-}
-
-void PokeGen::PokeMod::Tile::ExportIni(QFile &fout) const
-{
- LogExportStart("Tile", id, name);
- Ini exTile("Tile");
- exTile.AddField("id", id);
- exTile.AddField("name", name);
- exTile.AddField("pic", pic);
- exTile.AddField("fromUp", fromUp);
- exTile.AddField("fromDown", fromDown);
- exTile.AddField("fromLeft", fromLeft);
- exTile.AddField("fromRight", fromRight);
- exTile.AddField("isWild", isWild);
- exTile.AddField("wildChance-n", wildChance.GetNum());
- exTile.AddField("wildChance-d", wildChance.GetDenom());
- exTile.AddField("waterType", waterType);
- exTile.AddField("underWater", underWater);
- exTile.AddField("isCuttable", isCuttable);
- exTile.AddField("underCut", underCut);
- exTile.AddField("canHeadbutt", canHeadbutt);
- exTile.AddField("isRockClimb", isRockClimb);
- exTile.AddField("forceType", forceType);
- exTile.AddField("forceDirection", forceDirection);
- exTile.Export(fout);
- LogExportOver("Tile", id, name);
-}
-
-void PokeGen::PokeMod::Tile::SetName(const QString &n)
-{
- LogSetVar("Tile", id, "name", n);
- name = n;
-}
-
-void PokeGen::PokeMod::Tile::SetPic(const Path &p)
-{
- LogSetVar("Tile", id, "pic", p, name);
- pic = p;
-}
-
-void PokeGen::PokeMod::Tile::SetFromUp(const bool f)
-{
- LogSetVar("Tile", id, "fromUp", f, name);
- fromUp = f;
-}
-
-void PokeGen::PokeMod::Tile::SetFromDown(const bool f)
-{
- LogSetVar("Tile", id, "fromDown", f, name);
- fromDown = f;
-}
-
-void PokeGen::PokeMod::Tile::SetFromLeft(const bool f)
-{
- LogSetVar("Tile", id, "fromLeft", f, name);
- fromLeft = f;
-}
-
-void PokeGen::PokeMod::Tile::SetFromRight(const bool f)
-{
- LogSetVar("Tile", id, "fromRight", f, name);
- fromRight = f;
-}
-
-void PokeGen::PokeMod::Tile::SetIsWild(const bool i)
-{
- LogSetVar("Tile", id, "isWild", i, name);
- isWild = i;
-}
-
-void PokeGen::PokeMod::Tile::SetWildChance(const Frac &w)
-{
- LogSetVar("Tile", id, "wildChance", w.GetNum(), w.GetDenom(), name);
- wildChance = w;
-}
-
-void PokeGen::PokeMod::Tile::SetWildChance(const unsigned n, const unsigned d)
-{
- LogSetVar("Tile", id, "wildChance", n, d, name);
- wildChance.Set(n, d);
-}
-
-void PokeGen::PokeMod::Tile::SetWildChanceNumerator(const unsigned n)
-{
- LogSetVar("Tile", id, "wildChance numerator", n, name);
- wildChance.SetNum(n);
-}
-
-void PokeGen::PokeMod::Tile::SetWildChanceDenominator(const unsigned d)
-{
- LogSetVar("Tile", id, "wildChance denominator", d, name);
- wildChance.SetDenom(d);
-}
-
-void PokeGen::PokeMod::Tile::SetWaterType(const unsigned w)
-{
- LogSetVar("Tile", id, "waterType", w, name);
- if (w < WTRT_END)
- waterType = w;
-}
-
-void PokeGen::PokeMod::Tile::SetWaterType(const QString &w)
-{
- SetWaterType(FindIn(WTRT_END, w, WaterTypeStr));
-}
-
-void PokeGen::PokeMod::Tile::SetUnderWater(const unsigned u)
-{
- LogSetVar("Tile", id, "underWater", u, name);
- if (pokemod->GetTile(u))
- underWater = u;
-}
-
-void PokeGen::PokeMod::Tile::SetUnderWater(const QString &u)
-{
- LogSetVar("Tile", id, "underWater string", u, name);
- if (const Tile *t = pokemod->GetTile(u))
- underWater = t->GetId();
-}
-
-void PokeGen::PokeMod::Tile::SetIsCuttable(const bool i)
-{
- LogSetVar("Tile", id, "isCuttable", i, name);
- isCuttable = i;
-}
-
-void PokeGen::PokeMod::Tile::SetUnderCut(const unsigned u)
-{
- LogSetVar("Tile", id, "underCut", u, name);
- if (pokemod->GetTile(u))
- underCut = u;
-}
-
-void PokeGen::PokeMod::Tile::SetUnderCut(const QString &u)
-{
- LogSetVar("Tile", id, "underCut string", u, name);
- if (const Tile *t = pokemod->GetTile(u))
- underCut = t->GetId();
-}
-
-void PokeGen::PokeMod::Tile::SetCanHeadbutt(const bool c)
-{
- LogSetVar("Tile", id, "canHeadbutt", c, name);
- canHeadbutt = c;
-}
-
-void PokeGen::PokeMod::Tile::SetIsRockClimb(const bool i)
-{
- LogSetVar("Tile", id, "isRockClimb", i, name);
- isRockClimb = i;
-}
-
-void PokeGen::PokeMod::Tile::SetForceType(const unsigned f)
-{
- LogSetVar("Tile", id, "forceType", f, name);
- if (f < FT_END)
- forceType = f;
-}
-
-void PokeGen::PokeMod::Tile::SetForceType(const QString &f)
-{
- SetForceType(FindIn(FT_END, f, ForceTypeStr));
-}
-
-void PokeGen::PokeMod::Tile::SetForceDirection(const unsigned f)
-{
- LogSetVar("Tile", id, "forceDirection", f, name);
- if (f < DIR_END)
- forceDirection = f;
-}
-
-void PokeGen::PokeMod::Tile::SetForceDirection(const QString &f)
-{
- SetForceType(FindIn(DIR_END, f, DirectionStr));
-}
-
-QString PokeGen::PokeMod::Tile::GetName() const
-{
- LogFetchVar("Tile", id, "name", name);
- return name;
-}
-
-PokeGen::PokeMod::Path PokeGen::PokeMod::Tile::GetPic() const
-{
- LogFetchVar("Tile", id, "pic", pic, name);
- return pic;
-}
-
-bool PokeGen::PokeMod::Tile::GetFromUp() const
-{
- LogFetchVar("Tile", id, "fromUp", fromUp, name);
- return fromUp;
-}
-
-bool PokeGen::PokeMod::Tile::GetFromDown() const
-{
- LogFetchVar("Tile", id, "fromDown", fromDown, name);
- return fromDown;
-}
-
-bool PokeGen::PokeMod::Tile::GetFromLeft() const
-{
- LogFetchVar("Tile", id, "fromLeft", fromLeft, name);
- return fromLeft;
-}
-
-bool PokeGen::PokeMod::Tile::GetFromRight() const
-{
- LogFetchVar("Tile", id, "fromRight", fromRight, name);
- return fromRight;
-}
-
-bool PokeGen::PokeMod::Tile::GetIsWild() const
-{
- LogFetchVar("Tile", id, "isWild", isWild, name);
- return isWild;
-}
-
-PokeGen::PokeMod::Frac PokeGen::PokeMod::Tile::GetWildChance() const
-{
- LogFetchVar("Tile", id, "wildChance", 0, name);
- return wildChance;
-}
-
-unsigned PokeGen::PokeMod::Tile::GetWildChanceNumerator() const
-{
- LogFetchVar("Tile", id, "wildChance numerator", wildChance.GetNum(), name);
- return wildChance.GetNum();
-}
-
-unsigned PokeGen::PokeMod::Tile::GetWildChanceDenominator() const
-{
- LogFetchVar("Tile", id, "wildChance denominator", wildChance.GetDenom(), name);
- return wildChance.GetDenom();
-}
-
-unsigned PokeGen::PokeMod::Tile::GetWaterType() const
-{
- LogFetchVar("Tile", id, "waterType", waterType, name);
- return waterType;
-}
-
-QString PokeGen::PokeMod::Tile::GetWaterTypeString() const
-{
- LogFetchVar("Tile", id, "waterType string", waterType, name);
- if (waterType < WTRT_END)
- return WaterTypeStr[waterType];
- return "";
-}
-
-unsigned PokeGen::PokeMod::Tile::GetUnderWater() const
-{
- LogFetchVar("Tile", id, "underWater", underWater, name);
- return underWater;
-}
-
-QString PokeGen::PokeMod::Tile::GetUnderWaterString() const
-{
- LogFetchVar("Tile", id, "underWater", underWater, name);
- if (const Tile *t = pokemod->GetTile(underWater))
- return t->GetName();
- return "";
-}
-
-bool PokeGen::PokeMod::Tile::GetIsCuttable() const
-{
- LogFetchVar("Tile", id, "isCuttable", isCuttable, name);
- return isCuttable;
-}
-
-unsigned PokeGen::PokeMod::Tile::GetUnderCut() const
-{
- LogFetchVar("Tile", id, "underCut", underCut, name);
- return underCut;
-}
-
-QString PokeGen::PokeMod::Tile::GetUnderCutString() const
-{
- LogFetchVar("Tile", id, "underCut string", underCut, name);
- if (const Tile *t = pokemod->GetTile(underCut))
- return t->GetName();
- return "";
-}
-
-bool PokeGen::PokeMod::Tile::GetCanHeadbutt() const
-{
- LogFetchVar("Tile", id, "canHeadbutt", canHeadbutt, name);
- return canHeadbutt;
-}
-
-bool PokeGen::PokeMod::Tile::GetIsRockClimb() const
-{
- LogFetchVar("Tile", id, "isRockClimb", isRockClimb, name);
- return isRockClimb;
-}
-
-unsigned PokeGen::PokeMod::Tile::GetForceType() const
-{
- LogFetchVar("Tile", id, "forceType", forceType, name);
- return forceType;
-}
-
-QString PokeGen::PokeMod::Tile::GetForceTypeString() const
-{
- LogFetchVar("Tile", id, "forceType string", forceType, name);
- if (forceType < FT_END)
- return ForceTypeStr[forceType];
- return "";
-}
-
-unsigned PokeGen::PokeMod::Tile::GetForceDirection() const
-{
- LogFetchVar("Tile", id, "forceDirection", forceDirection, name);
- return forceDirection;
-}
-
-QString PokeGen::PokeMod::Tile::GetForceDirectionString() const
-{
- LogFetchVar("Tile", id, "forceDirection string", forceDirection, name);
- if (forceDirection < DIR_END)
- return DirectionStr[forceDirection];
- return "";
-}
+///////////////////////////////////////////////////////////////////////////// +// Name: pokemod/Tile.cpp +// Purpose: Define a tile for the map +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Thu May 31 2007 13:52:39 +// Copyright: ©2007 Nerdy Productions +// Licence: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTTile or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see <http://www.gnu.org/licenses/>. +///////////////////////////////////////////////////////////////////////////// + +#include "Tile.h" + +PokeGen::PokeMod::Tile::Tile(const Pokemod* par, const unsigned _id) : + Object(_id, par), + name(""), + pic(""), + fromUp(false), + fromDown(false), + fromLeft(false), + fromRight(false), + isWild(false), + wildChance(1, 1), + waterType(UINT_MAX), + underWater(UINT_MAX), + isCuttable(false), + underCut(UINT_MAX), + canHeadbutt(false), + isRockClimb(false), + forceType(UINT_MAX), + forceDirection(UINT_MAX) +{ +} + +PokeGen::PokeMod::Tile::Tile(const Pokemod* par, Ini& ini, const unsigned _id) : + Object(_id, par), + pic("") +{ + ImportIni(ini, _id); +} + +bool PokeGen::PokeMod::Tile::Validate() +{ + pokemod->ValidationMsg(QString("---Tile \"%1\" with id %2---").arg(name).arg(id), Pokemod::V_Msg); + if (name == "") + { + pokemod->ValidationMsg("Name is not defined"); + isValid = false; + } + if (!QFile(pokemod->GetPath() + "images/tiles/" + pic + ".png").exists()) + { + pokemod->ValidationMsg("Cannot find tile image"); + isValid = false; + } + if (waterType < W_End) + { + if ((waterType == W_Waterfall) && (!fromUp || !fromDown)) + { + pokemod->ValidationMsg("A waterfall tile must be accessible from above and below"); + isValid = false; + } + else if ((waterType == W_Whirlpool) && (pokemod->GetTileByID(underWater) == UINT_MAX)) + { + pokemod->ValidationMsg("Invalid under water tile"); + isValid = false; + } + } + else + { + pokemod->ValidationMsg("Invalid water type"); + isValid = false; + } + if (isCuttable && (pokemod->GetTileByID(underCut) == UINT_MAX)) + { + pokemod->ValidationMsg("Invalid under cut tile"); + isValid = false; + } + if (isRockClimb && (!fromUp || !fromDown)) + { + pokemod->ValidationMsg("A rock climb tile must be accessible from above and below"); + isValid = false; + } + if (forceType < F_End) + { + if (((forceType == F_Slip) || (forceType == F_Force) || (forceType == F_Push)) && (DIR_End <= forceDirection)) + { + pokemod->ValidationMsg("Invalid force direction"); + isValid = false; + } + } + else + { + pokemod->ValidationMsg("Invalid force type"); + isValid = false; + } + return isValid; +} + +void PokeGen::PokeMod::Tile::ImportIni(Ini& ini, const unsigned _id) +{ + if (_id == UINT_MAX) + ini.GetValue("id", id); + else + id = _id; + unsigned i; + unsigned j; + ini.GetValue("name", name); + ini.GetValue("pic", pic); + ini.GetValue("fromUp", fromUp, false); + ini.GetValue("fromDown", fromDown, false); + ini.GetValue("fromLeft", fromLeft, false); + ini.GetValue("fromRight", fromRight, false); + ini.GetValue("isWild", isWild, false); + ini.GetValue("wildChance-n", i, 1); + ini.GetValue("wildChance-d", j, 1); + wildChance.Set(i, j); + ini.GetValue("waterType", waterType); + ini.GetValue("underWater", underWater); + ini.GetValue("isCuttable", isCuttable, false); + ini.GetValue("underCut", underCut); + ini.GetValue("canHeadbutt", canHeadbutt, false); + ini.GetValue("isRockClimb", isRockClimb, false); + ini.GetValue("forceType", forceType); + ini.GetValue("forceDirection", forceDirection); +} + +void PokeGen::PokeMod::Tile::ExportIni(QFile& fout) const +{ + Ini exTile("Tile"); + exTile.AddField("id", id); + exTile.AddField("name", name); + exTile.AddField("pic", pic); + exTile.AddField("fromUp", fromUp); + exTile.AddField("fromDown", fromDown); + exTile.AddField("fromLeft", fromLeft); + exTile.AddField("fromRight", fromRight); + exTile.AddField("isWild", isWild); + exTile.AddField("wildChance-n", wildChance.GetNum()); + exTile.AddField("wildChance-d", wildChance.GetDenom()); + exTile.AddField("waterType", waterType); + exTile.AddField("underWater", underWater); + exTile.AddField("isCuttable", isCuttable); + exTile.AddField("underCut", underCut); + exTile.AddField("canHeadbutt", canHeadbutt); + exTile.AddField("isRockClimb", isRockClimb); + exTile.AddField("forceType", forceType); + exTile.AddField("forceDirection", forceDirection); + exTile.Export(fout); +} + +void PokeGen::PokeMod::Tile::SetName(const QString& n) +{ + name = n; +} + +bool PokeGen::PokeMod::Tile::SetPic(const QString& p) +{ + int dirPos = p.lastIndexOf(PM_DEF_SEP); + int extPos = p.lastIndexOf('.'); + if ((dirPos == -1) || (extPos == -1)) + return false; + pic = p.mid(dirPos + 1, extPos - dirPos - 1); + QFile file(pokemod->GetPath() + "images/tiles/" + pic + ".png"); + if (file.exists() && !file.remove()) + return false; + return QFile::copy(p, pokemod->GetPath() + "images/tiles/" + pic + ".png"); +} + +void PokeGen::PokeMod::Tile::SetFromUp(const bool f) +{ + fromUp = f; +} + +void PokeGen::PokeMod::Tile::SetFromDown(const bool f) +{ + fromDown = f; +} + +void PokeGen::PokeMod::Tile::SetFromLeft(const bool f) +{ + fromLeft = f; +} + +void PokeGen::PokeMod::Tile::SetFromRight(const bool f) +{ + fromRight = f; +} + +void PokeGen::PokeMod::Tile::SetIsWild(const bool i) +{ + isWild = i; +} + +bool PokeGen::PokeMod::Tile::SetWildChance(const unsigned n, const unsigned d) +{ + return wildChance.Set(n, d); +} + +bool PokeGen::PokeMod::Tile::SetWildChanceNumerator(const unsigned n) +{ + return wildChance.SetNum(n); +} + +bool PokeGen::PokeMod::Tile::SetWildChanceDenominator(const unsigned d) +{ + return wildChance.SetDenom(d); +} + +bool PokeGen::PokeMod::Tile::SetWaterType(const unsigned w) +{ + if (w < W_End) + { + waterType = w; + underWater = UINT_MAX; + } + return (waterType == w); +} + +bool PokeGen::PokeMod::Tile::SetUnderWater(const unsigned u) +{ + if (pokemod->GetTileByID(u) != UINT_MAX) + underWater = u; + return (underWater == u); +} + +void PokeGen::PokeMod::Tile::SetIsCuttable(const bool i) +{ + isCuttable = i; + if (!isCuttable) + underCut = UINT_MAX; +} + +bool PokeGen::PokeMod::Tile::SetUnderCut(const unsigned u) +{ + if (pokemod->GetTileByID(u) != UINT_MAX) + underCut = u; + return (underCut == u); +} + +void PokeGen::PokeMod::Tile::SetCanHeadbutt(const bool c) +{ + canHeadbutt = c; +} + +void PokeGen::PokeMod::Tile::SetIsRockClimb(const bool i) +{ + isRockClimb = i; +} + +bool PokeGen::PokeMod::Tile::SetForceType(const unsigned f) +{ + if (f < F_End) + forceType = f; + return (forceType == f); +} + +bool PokeGen::PokeMod::Tile::SetForceDirection(const unsigned f) +{ + if (f < DIR_End) + forceDirection = f; + return (forceDirection == f); +} + +QString PokeGen::PokeMod::Tile::GetName() const +{ + return name; +} + +QString PokeGen::PokeMod::Tile::GetPic() const +{ + return pic; +} + +bool PokeGen::PokeMod::Tile::GetFromUp() const +{ + return fromUp; +} + +bool PokeGen::PokeMod::Tile::GetFromDown() const +{ + return fromDown; +} + +bool PokeGen::PokeMod::Tile::GetFromLeft() const +{ + return fromLeft; +} + +bool PokeGen::PokeMod::Tile::GetFromRight() const +{ + return fromRight; +} + +bool PokeGen::PokeMod::Tile::GetIsWild() const +{ + return isWild; +} + +PokeGen::PokeMod::Frac PokeGen::PokeMod::Tile::GetWildChance() const +{ + return wildChance; +} + +unsigned PokeGen::PokeMod::Tile::GetWildChanceNumerator() const +{ + return wildChance.GetNum(); +} + +unsigned PokeGen::PokeMod::Tile::GetWildChanceDenominator() const +{ + return wildChance.GetDenom(); +} + +unsigned PokeGen::PokeMod::Tile::GetWaterType() const +{ + return waterType; +} + +unsigned PokeGen::PokeMod::Tile::GetUnderWater() const +{ + return underWater; +} + +bool PokeGen::PokeMod::Tile::GetIsCuttable() const +{ + return isCuttable; +} + +unsigned PokeGen::PokeMod::Tile::GetUnderCut() const +{ + return underCut; +} + +bool PokeGen::PokeMod::Tile::GetCanHeadbutt() const +{ + return canHeadbutt; +} + +bool PokeGen::PokeMod::Tile::GetIsRockClimb() const +{ + return isRockClimb; +} + +unsigned PokeGen::PokeMod::Tile::GetForceType() const +{ + return forceType; +} + +unsigned PokeGen::PokeMod::Tile::GetForceDirection() const +{ + return forceDirection; +} |
