summaryrefslogtreecommitdiffstats
path: root/pokemod/Pokemod.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-02-23 00:30:00 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-02-23 00:30:00 +0000
commit9cd7f4656b01cfb243433e1063c0339b2b96bbd4 (patch)
treeb3faeacc636f956013e2972b950a2c1b9cd85f59 /pokemod/Pokemod.cpp
parent0ee1ea1cef9eec7e0187aa9f8f2dc291775e8864 (diff)
downloadsigen-9cd7f4656b01cfb243433e1063c0339b2b96bbd4.tar.gz
sigen-9cd7f4656b01cfb243433e1063c0339b2b96bbd4.tar.xz
sigen-9cd7f4656b01cfb243433e1063c0339b2b96bbd4.zip
[FIX] Changelog/SVN desynchronization fixed
[FIX] skins UI file cleaned up [FIX] ImageCache no longer uses force argument [FIX] operator= now correctly copies subdata from rhs (instead of reassigning ID numbers) [FIX] Pokemod can now be copied [FIX] Pokemod skin calls cleaned up [ADD] PokemodUI.{h, cpp} [ADD] SkinsUI.{h, cpp} git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@70 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Pokemod.cpp')
-rw-r--r--pokemod/Pokemod.cpp139
1 files changed, 120 insertions, 19 deletions
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 5e433cd0..9272cb5a 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -50,6 +50,13 @@ Pokemod::Pokemod() :
{
}
+Pokemod::Pokemod(const Pokemod& p) :
+ Object("Pokemod", this, 0),
+ rules(this)
+{
+ *this = p;
+}
+
Pokemod::Pokemod(const QString& fname) :
Object("Pokemod", this, 0),
valOutput(NULL),
@@ -95,32 +102,32 @@ bool Pokemod::validate() const
validationMsg("Invalid starting map");
valid = false;
}
- if (!QFile::exists(QString("%1/image/skin/walk.png").arg(getPath())))
+ if (!QFile::exists(getWalkSkin()))
{
validationMsg("Cannot find walking skin");
valid = false;
}
- if (!QFile::exists(QString("%1/image/skin/bike.png").arg(getPath())))
+ if (!QFile::exists(getBikeSkin()))
{
validationMsg("Cannot find biking skin");
valid = false;
}
- if (!QFile::exists(QString("%1/image/skin/surf.png").arg(getPath())))
+ if (!QFile::exists(getSurfSkin()))
{
validationMsg("Cannot find surfing skin");
valid = false;
}
- if (!QFile::exists(QString("%1/image/skin/fly.png").arg(getPath())))
+ if (!QFile::exists(getFlySkin()))
{
validationMsg("Cannot find flying skin");
valid = false;
}
- if (!QFile::exists(QString("%1/image/skin/fish.png").arg(getPath())))
+ if (!QFile::exists(getFishSkin()))
{
validationMsg("Cannot find fishing skin");
valid = false;
}
- if (!QFile::exists(QString("%1/image/skin/surfFish.png").arg(getPath())))
+ if (!QFile::exists(getSurfFishSkin()))
{
validationMsg("Cannot find surf fishing skin");
valid = false;
@@ -383,7 +390,7 @@ bool Pokemod::validate() const
{
if (1 < i.value())
{
- validationMsg(QString("There are %1 Mmps with id %2").arg(i.value()).arg(i.key()));
+ validationMsg(QString("There are %1 maps with id %2").arg(i.value()).arg(i.key()));
valid = false;
}
}
@@ -1000,55 +1007,55 @@ void Pokemod::setStartWarp(const int s) throw(BoundsException)
void Pokemod::setWalkSkin(const QString& fname) throw(Exception)
{
- QFile file(QString("%1/image/skin/walk.png").arg(getPath()));
+ QFile file(getWalkSkin());
if (file.exists() && !file.remove())
throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, QString("%1/image/skin/walk.png").arg(getPath())))
+ if (!QFile::copy(fname, getWalkSkin()))
throw(SaveException(className, file.fileName()));
}
void Pokemod::setBikeSkin(const QString& fname) throw(Exception)
{
- QFile file(QString("%1/image/skin/bike.png").arg(getPath()));
+ QFile file(getBikeSkin());
if (file.exists() && !file.remove())
throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, QString("%1/image/skin/bike.png").arg(getPath())))
+ if (!QFile::copy(fname, getBikeSkin()))
throw(SaveException(className, file.fileName()));
}
void Pokemod::setSurfSkin(const QString& fname) throw(Exception)
{
- QFile file(QString("%1/image/skin/surf.png").arg(getPath()));
+ QFile file(getSurfSkin());
if (file.exists() && !file.remove())
throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, QString("%1/image/skin/surf.png").arg(getPath())))
+ if (!QFile::copy(fname, getSurfSkin()))
throw(SaveException(className, file.fileName()));
}
void Pokemod::setFlySkin(const QString& fname) throw(Exception)
{
- QFile file(QString("%1/image/skin/fly.png").arg(getPath()));
+ QFile file(getFlySkin());
if (file.exists() && !file.remove())
throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, QString("%1/image/skin/fly.png").arg(getPath())))
+ if (!QFile::copy(fname, getFlySkin()))
throw(SaveException(className, file.fileName()));
}
void Pokemod::setFishSkin(const QString& fname) throw(Exception)
{
- QFile file(QString("%1/image/skin/fish.png").arg(getPath()));
+ QFile file(getFishSkin());
if (file.exists() && !file.remove())
throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, QString("%1/image/skin/fish.png").arg(getPath())))
+ if (!QFile::copy(fname, getFishSkin()))
throw(SaveException(className, file.fileName()));
}
void Pokemod::setSurfFishSkin(const QString& fname) throw(Exception)
{
- QFile file(QString("%1/image/skin/surfFish.png").arg(getPath()));
+ QFile file(getSurfFishSkin());
if (file.exists() && !file.remove())
throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, QString("%1/image/skin/surfFish.png").arg(getPath())))
+ if (!QFile::copy(fname, getSurfFishSkin()))
throw(SaveException(className, file.fileName()));
}
@@ -1112,6 +1119,36 @@ int Pokemod::getStartWarp() const
return startWarp;
}
+QString Pokemod::getWalkSkin() const
+{
+ return QString("%1/image/skin/walk.png").arg(getPath());
+}
+
+QString Pokemod::getBikeSkin() const
+{
+ return QString("%1/image/skin/bike.png").arg(getPath());
+}
+
+QString Pokemod::getSurfSkin() const
+{
+ return QString("%1/image/skin/surf.png").arg(getPath());
+}
+
+QString Pokemod::getFlySkin() const
+{
+ return QString("%1/image/skin/fly.png").arg(getPath());
+}
+
+QString Pokemod::getFishSkin() const
+{
+ return QString("%1/image/skin/fish.png").arg(getPath());
+}
+
+QString Pokemod::getSurfFishSkin() const
+{
+ return QString("%1/image/skin/surfFish.png").arg(getPath());
+}
+
QString Pokemod::getSuperPCUname() const
{
return superPCUname;
@@ -2180,3 +2217,67 @@ void Pokemod::deleteType(const int i) throw(IndexException)
typeChart.deleteCol(i);
typeChart.deleteRow(i);
}
+
+Pokemod& Pokemod::operator=(const Pokemod& rhs)
+{
+ if (this == &rhs)
+ return *this;
+ title = rhs.title;
+ version = rhs.version;
+ description = rhs.description;
+ startMap = rhs.startMap;
+ startWarp = rhs.startWarp;
+ superPCUname = rhs.superPCUname;
+ superPCPasswd = rhs.superPCPasswd;
+ typeChart = rhs.typeChart;
+ rules = rhs.rules;
+ abilities.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ abilities.append(Ability(this, *rhs.getAbility(i), rhs.getAbility(i)->getId()));
+ authors.clear();
+ for (int i = 0; i < rhs.getAuthorCount(); ++i)
+ authors.append(Author(this, *rhs.getAuthor(i), rhs.getAuthor(i)->getId()));
+ badges.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ badges.append(Badge(this, *rhs.getBadge(i), rhs.getBadge(i)->getId()));
+ coinLists.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ coinLists.append(CoinList(this, *rhs.getCoinList(i), rhs.getCoinList(i)->getId()));
+ dialogs.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ dialogs.append(Dialog(this, *rhs.getDialog(i), rhs.getDialog(i)->getId()));
+ eggGroups.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ eggGroups.append(EggGroup(this, *rhs.getEggGroup(i), rhs.getEggGroup(i)->getId()));
+ items.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ items.append(Item(this, *rhs.getItem(i), rhs.getItem(i)->getId()));
+ itemTypes.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ itemTypes.append(ItemType(this, *rhs.getItemType(i), rhs.getItemType(i)->getId()));
+ maps.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ maps.append(Map(this, *rhs.getMap(i), rhs.getMap(i)->getId()));
+ moves.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ moves.append(Move(this, *rhs.getMove(i), rhs.getMove(i)->getId()));
+ natures.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ natures.append(Nature(this, *rhs.getNature(i), rhs.getNature(i)->getId()));
+ species.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ species.append(Species(this, *rhs.getSpecies(i), rhs.getSpecies(i)->getId()));
+ stores.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ stores.append(Store(this, *rhs.getStore(i), rhs.getStore(i)->getId()));
+ tiles.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ tiles.append(Tile(this, *rhs.getTile(i), rhs.getTile(i)->getId()));
+ times.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ times.append(Time(this, *rhs.getTime(i), rhs.getTime(i)->getId()));
+ types.clear();
+ for (int i = 0; i < rhs.getAbilityCount(); ++i)
+ types.append(Type(this, *rhs.getType(i), rhs.getType(i)->getId()));
+ return *this;
+}