diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-01-23 04:50:24 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-01-23 04:50:24 +0000 |
| commit | ef250617e8163c535931be045aa4e9d59163ace7 (patch) | |
| tree | 5b76323ec66a63c3fca589b088b310c3fdaba2b7 | |
| parent | efa80ce427e40070e36e5ab86d2f6dbf4ad50648 (diff) | |
[FIX] Grammer in Changelog
[FIX] Made pokemod classes contain their names for later ease
[ADD] PokéModr main window form
[FIX] Ini and Exception includes fixed
[FIX] BugCatcher bugs fixed
[FIX] .pro files fixed
[ADD] PokéModr main GUI almost complete
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@40 6ecfd1a5-f3ed-3746-8530-beee90d26b22
55 files changed, 856 insertions, 472 deletions
@@ -1,10 +1,23 @@ ----------------- +Rev: 40 +Date: 22 January 2008 +User: MathStuf +----------------- +[FIX] Grammer in Changelog +[FIX] Made pokemod classes contain their names for later ease +[ADD] PokéModr main window form +[FIX] Ini and Exception includes fixed +[FIX] BugCatcher bugs fixed +[FIX] .pro files fixed +[ADD] PokéModr main GUI almost complete + +----------------- Rev: 39 Date: 21 January 2008 User: MathStuf ----------------- [FIX] Some linker errors in pokemod and general -[FIX] More enum cahr*[] to QStringList +[FIX] More enum char*[] to QStringList [FIX] Widgets in PokéModr gui [ADD] Rules GUI logic diff --git a/battle/battle.pro b/battle/battle.pro index f24900da..ff39021e 100644 --- a/battle/battle.pro +++ b/battle/battle.pro @@ -1,5 +1,6 @@ OBJECTS_DIR = ../../obj/battle DESTDIR = ../../lib +LANGUAGE = C++ TEMPLATE = lib LIBS += -L../../lib -lgeneral -lpokemod diff --git a/general/BugCatcher.cpp b/general/BugCatcher.cpp new file mode 100644 index 00000000..eff96816 --- /dev/null +++ b/general/BugCatcher.cpp @@ -0,0 +1,25 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: general/BugCatcher.cpp +// Purpose: Exceptions get sent here +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Jan 22 14:47:50 2008 +// Copyright: ©2007-2008 Ben Boeckel and 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 +// MERCHANTABILITY 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 "BugCatcher.h" + +KAboutData* BugCatcher::about = NULL; diff --git a/general/BugCatcher.h b/general/BugCatcher.h index 9249d677..9d20c617 100644 --- a/general/BugCatcher.h +++ b/general/BugCatcher.h @@ -23,25 +23,30 @@ #ifndef __BUGCATCHER__ #define __BUGCATCHER__ -#include <kaboutdata.h> #include <kbugreport.h> #include "Exception.h" class BugCatcher { public: - BugCatcher(KAboutData* data) : - about(data) + static void setAbout(KAboutData* data) { + about = data; } - void report(const Exception& e) + static void deleteAbout() { + about = NULL; + } + static void report(const Exception& e) + { + if (!about) + return; KBugReport bug(NULL, true, about); bug.setMessageBody(e.getMsg()); bug.exec(); } private: - KAboutData* about; + static KAboutData* about; }; #endif diff --git a/general/Exception.h b/general/Exception.h index 5197e88d..29d31115 100644 --- a/general/Exception.h +++ b/general/Exception.h @@ -23,6 +23,8 @@ #ifndef __EXCEPTIONS__ #define __EXCEPTIONS__ +#include <QString> + class Exception { public: diff --git a/general/Ini.cpp b/general/Ini.cpp index 0e65f2b1..c7186bf6 100644 --- a/general/Ini.cpp +++ b/general/Ini.cpp @@ -21,7 +21,6 @@ ///////////////////////////////////////////////////////////////////////////// #include <QDir> -#include <QFile> #include <QStringList> #include <QTextStream> #include "Ini.h" @@ -30,7 +29,7 @@ Ini::Ini() { } -Ini::Ini(const QString& fname) +Ini::Ini(const QString& fname) throw(Exception) { load(fname); } @@ -94,27 +93,22 @@ void Ini::addField(const QString& n, const bool v) void Ini::addField(const QString& n, const unsigned char v) { - fields[n] = QString("%1").arg(v); + fields[n] = QString::number(v); } void Ini::addField(const QString& n, const int v) { - fields[n] = QString("%1").arg(v); + fields[n] = QString::number(v); } void Ini::addField(const QString& n, const unsigned v) { - fields[n] = QString("%1").arg(v); -} - -void Ini::addField(const QString& n, const float v) -{ - fields[n] = QString("%1").arg(v); + fields[n] = QString::number(v); } void Ini::addField(const QString& n, const double v) { - fields[n] = QString("%1").arg(v); + fields[n] = QString::number(v); } void Ini::addField(const QString& n, const QString& v) @@ -179,19 +173,6 @@ void Ini::getValue(const QString& field, unsigned& val, const unsigned def) val = def; } -void Ini::getValue(const QString& field, float& val, const float def) -{ - if (!fields.contains(field)) - { - val = def; - return; - } - bool ok; - val = fields[field].toFloat(&ok); - if (!ok) - val = def; -} - void Ini::getValue(const QString& field, double& val, const double def) { if (!fields.contains(field)) @@ -214,3 +195,8 @@ void Ini::getValue(const QString& field, QString& val, const QString& def) } val = fields[field]; } + +QStringList Ini::getFields() const +{ + return fields.keys(); +} diff --git a/general/Ini.h b/general/Ini.h index 2a3da696..bcd42686 100644 --- a/general/Ini.h +++ b/general/Ini.h @@ -23,15 +23,17 @@ #ifndef __INI__ #define __INI__ +#include <QFile> #include <QMap> #include <QString> +#include <QStringList> #include "Exception.h" class Ini { public: Ini(); - Ini(const QString& fname); + Ini(const QString& fname) throw(Exception); void load(const QString& fname) throw(Exception); void save(const QString& fname) const throw(Exception); @@ -40,7 +42,6 @@ class Ini void addField(const QString& n, const unsigned char v); void addField(const QString& n, const int v); void addField(const QString& n, const unsigned v); - void addField(const QString& n, const float v); void addField(const QString& n, const double v); void addField(const QString& n, const QString& v); @@ -49,16 +50,17 @@ class Ini void getValue(const QString& field, unsigned char& val, const unsigned char def = UCHAR_MAX); void getValue(const QString& field, int& val, const int def = INT_MAX); void getValue(const QString& field, unsigned& val, const unsigned def = UINT_MAX); - void getValue(const QString& field, float& val, const float def = 0); void getValue(const QString& field, double& val, const double def = 0); void getValue(const QString& field, QString& val, const QString& def = ""); + + QStringList getFields() const; protected: enum LinePos { Field = 0, Value = 1 }; - + void load(QFile& fin) throw(InvalidException); void save(QFile& fout) const; diff --git a/general/general.pro b/general/general.pro index dc8166d3..63962d81 100644 --- a/general/general.pro +++ b/general/general.pro @@ -1,5 +1,6 @@ OBJECTS_DIR = ../../obj/general DESTDIR = ../../lib +LANGUAGE = C++ TEMPLATE = lib CONFIG += qt warn_on dll diff --git a/menus/menus.pro b/menus/menus.pro index 96d70111..b72aa98f 100644 --- a/menus/menus.pro +++ b/menus/menus.pro @@ -1,5 +1,6 @@ OBJECTS_DIR = ../../obj/menus DESTDIR = ../../lib +LANGUAGE = C++ TEMPLATE = lib LIBS += -L../../lib -lgeneral -lpokemod diff --git a/overworld/overworld.pro b/overworld/overworld.pro index 1cbb6fa6..0ed172c8 100644 --- a/overworld/overworld.pro +++ b/overworld/overworld.pro @@ -1,5 +1,6 @@ OBJECTS_DIR = ../../obj/overworld DESTDIR = ../../lib +LANGUAGE = C++ TEMPLATE = lib LIBS += -L../../lib -lgeneral -lpokemod diff --git a/pokegen.pro b/pokegen.pro index b8533e2b..856397ae 100755 --- a/pokegen.pro +++ b/pokegen.pro @@ -1,4 +1,5 @@ VERSION = 0.0.1 +LANGUAGE = C++ TEMPLATE = subdirs CONFIG += ordered qt warn_on diff --git a/pokegen/pokegen.pro b/pokegen/pokegen.pro index f251f962..138bb14d 100644 --- a/pokegen/pokegen.pro +++ b/pokegen/pokegen.pro @@ -1,5 +1,6 @@ OBJECTS_DIR = ../../obj/pokegen DESTDIR = ../../bin +LANGUAGE = C++ TEMPLATE = app LIBS += -L../../lib -lgeneral -lpokemod -loverworld -lbattle -laudio -lmenus diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp index 9e8b89bd..e3bdb8b6 100644 --- a/pokemod/Ability.cpp +++ b/pokemod/Ability.cpp @@ -31,19 +31,19 @@ #include "Ability.h" Ability::Ability(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Ability", par, _id), name("") { } Ability::Ability(const Pokemod& par, const Ability& a, const unsigned _id) : - Object(par, _id) + Object("Ability", par, _id) { *this = a; } Ability::Ability(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Ability", par, _id) { load(fname, _id); } @@ -133,14 +133,14 @@ QString Ability::getName() const const AbilityEffect& Ability::getEffect(const unsigned i) const throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Ability")); + throw(IndexException(className)); return effects.at(i); } AbilityEffect& Ability::getEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Ability")); + throw(IndexException(className)); return effects[i]; } @@ -190,7 +190,7 @@ AbilityEffect& Ability::newEffect(const AbilityEffect& e) void Ability::deleteEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Ability")); + throw(IndexException(className)); effects.removeAt(i); } diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp index dd47c900..3bb638e3 100644 --- a/pokemod/AbilityEffect.cpp +++ b/pokemod/AbilityEffect.cpp @@ -37,7 +37,7 @@ const QStringList AbilityEffect::SideStr = QStringList() << "Above" << "Below"; AbilityEffect::AbilityEffect(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("AbilityEffect", par, _id), chance(1, 1), effect(UINT_MAX), val1(UINT_MAX), @@ -50,13 +50,13 @@ AbilityEffect::AbilityEffect(const Pokemod& par, const unsigned _id) : } AbilityEffect::AbilityEffect(const Pokemod& par, const AbilityEffect& e, const unsigned _id) : - Object(par, _id) + Object("AbilityEffect", par, _id) { *this = e; } AbilityEffect::AbilityEffect(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("AbilityEffect", par, _id) { load(fname, _id); } @@ -259,7 +259,7 @@ void AbilityEffect::setChanceDenom(const unsigned d) throw(Exception) void AbilityEffect::setEffect(const unsigned e) throw(BoundsException) { if (E_End <= e) - throw(BoundsException("AbilityEffect", "effect")); + throw(BoundsException(className, "effect")); effect = e; val1 = UINT_MAX; val2 = UINT_MAX; @@ -272,34 +272,34 @@ void AbilityEffect::setVal1(const unsigned v1) throw(Exception) { case E_Stats: if ((ST_HP == val1) || (ST_End_Battle <= val1) || ((val1 == ST_SpecialDefense) && !pokemod.getRules().getSpecialSplit())) - throw(BoundsException("AbilityEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_Status: if (STS_End <= v1) - throw(BoundsException("AbilityEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_Ability: if (pokemod.getAbilityIndex(v1) == UINT_MAX) - throw(BoundsException("AbilityEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_AccuracyPowerTrade: if (PA_End <= v1) - throw(BoundsException("AbilityEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_ItemEffect: if (IT_End <= v1) - throw(BoundsException("AbilityEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_Type: if (pokemod.getTypeIndex(v1) == UINT_MAX) - throw(BoundsException("AbilityEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_Weather: if (W_End_All <= v1) - throw(BoundsException("AbilityEffect", "val1")); + throw(BoundsException(className, "val1")); break; default: - throw(UnusedException("AbilityEffect", "val1")); + throw(UnusedException(className, "val1")); break; } val1 = v1; @@ -311,23 +311,23 @@ void AbilityEffect::setVal2(const unsigned v2) throw(Exception) { case E_Stats: if (BM_End <= v2) - throw(BoundsException("AbilityEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Status: case E_Weather: if (C_End <= v2) - throw(BoundsException("AbilityEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Ability: if (I_End <= v2) - throw(BoundsException("AbilityEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Type: if (B_End <= v2) - throw(BoundsException("AbilityEffect", "val2")); + throw(BoundsException(className, "val2")); break; default: - throw(UnusedException("AbilityEffect", "val2")); + throw(UnusedException(className, "val2")); break; } val2 = v2; @@ -346,14 +346,14 @@ void AbilityEffect::setVal3(const int v3) throw(Exception) case E_Type: case E_FastHatch: if ((v3 < 0) || (100 < v3)) - throw(BoundsException("AbilityEffect", "val3")); + throw(BoundsException(className, "val3")); break; case E_Stats: if ((v3 < -12) || (12 < v3)) - throw(BoundsException("AbilityEffect", "val3")); + throw(BoundsException(className, "val3")); break; default: - throw(UnusedException("AbilityEffect", "val3")); + throw(UnusedException(className, "val3")); break; } val3 = v3; @@ -362,7 +362,7 @@ void AbilityEffect::setVal3(const int v3) throw(Exception) void AbilityEffect::setTrigger(const unsigned t) throw(BoundsException) { if (T_End <= t) - throw(BoundsException("AbilityEffect", "trigger")); + throw(BoundsException(className, "trigger")); trigger = t; tval1 = UINT_MAX; tval2.set(1, 1); @@ -374,26 +374,26 @@ void AbilityEffect::setTval1(const unsigned tv1) throw(Exception) { case T_Weather: if (W_End_All <= tv1) - throw(BoundsException("AbilityEffect", "tval1")); + throw(BoundsException(className, "tval1")); break; case T_Type: if (pokemod.getTypeIndex(tv1) == UINT_MAX) - throw(BoundsException("AbilityEffect", "tval1")); + throw(BoundsException(className, "tval1")); break; case T_HPBoundary: if (S_End <= tv1) - throw(BoundsException("AbilityEffect", "tval1")); + throw(BoundsException(className, "tval1")); break; case T_StatChange: if ((ST_HP == tval1) || (ST_End_Battle <= tval1) || ((tval1 == ST_SpecialDefense) && !pokemod.getRules().getSpecialSplit())) - throw(BoundsException("AbilityEffect", "tval1")); + throw(BoundsException(className, "tval1")); break; case T_Status: if (STS_End <= tv1) - throw(BoundsException("AbilityEffect", "tval1")); + throw(BoundsException(className, "tval1")); break; default: - throw(UnusedException("AbilityEffect", "tval1")); + throw(UnusedException(className, "tval1")); break; } tval1 = tv1; @@ -402,21 +402,21 @@ void AbilityEffect::setTval1(const unsigned tv1) throw(Exception) void AbilityEffect::setTval2(const unsigned n, const unsigned d) throw(Exception) { if (trigger != T_HPBoundary) - throw(UnusedException("AbilityEffect", "tval2")); + throw(UnusedException(className, "tval2")); tval2.set(n, d); } void AbilityEffect::setTval2Num(const unsigned n) throw(Exception) { if (trigger != T_HPBoundary) - throw(UnusedException("AbilityEffect", "tval2")); + throw(UnusedException(className, "tval2")); tval2.setNum(n); } void AbilityEffect::setTval2Denom(const unsigned d) throw(Exception) { if (trigger != T_HPBoundary) - throw(UnusedException("AbilityEffect", "tval2")); + throw(UnusedException(className, "tval2")); tval2.setDenom(d); } diff --git a/pokemod/Author.cpp b/pokemod/Author.cpp index 6352bde5..760a2162 100644 --- a/pokemod/Author.cpp +++ b/pokemod/Author.cpp @@ -25,7 +25,7 @@ #include "Author.h" Author::Author(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Author", par, _id), name(""), email(""), role("") @@ -33,13 +33,13 @@ Author::Author(const Pokemod& par, const unsigned _id) : } Author::Author(const Pokemod& par, const Author& a, const unsigned _id) : - Object(par, _id) + Object("Author", par, _id) { *this = a; } Author::Author(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Author", par, _id) { load(fname, _id); } diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp index 8b41d456..e9ee6380 100644 --- a/pokemod/Badge.cpp +++ b/pokemod/Badge.cpp @@ -25,7 +25,7 @@ #include "Badge.h" Badge::Badge(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Badge", par, _id), name(""), obey(0) { @@ -36,13 +36,13 @@ Badge::Badge(const Pokemod& par, const unsigned _id) : } Badge::Badge(const Pokemod& par, const Badge& b, const unsigned _id) : - Object(par, _id) + Object("Badge", par, _id) { *this = b; } Badge::Badge(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Badge", par, _id) { load(fname, _id); } @@ -120,52 +120,52 @@ void Badge::setFace(const QString& f) throw(Exception) { QFile file(QString("%1/badge/%2/face.png").arg(pokemod.getPath()).arg(name)); if (file.exists() && !file.remove()) - throw(ReplaceException("Badge", file.fileName())); + throw(ReplaceException(className, file.fileName())); if (!QFile::copy(f, QString("%1/badge/%2/face.png").arg(pokemod.getPath()).arg(name))) - throw(SaveException("Badge", file.fileName())); + throw(SaveException(className, file.fileName())); } void Badge::setBadge(const QString& b) throw(Exception) { QFile file(QString("%1/badge/%2/badge.png").arg(pokemod.getPath()).arg(name)); if (file.exists() && !file.remove()) - throw(ReplaceException("Badge", file.fileName())); + throw(ReplaceException(className, file.fileName())); if (!QFile::copy(b, QString("%1/badge/%2/badge.png").arg(pokemod.getPath()).arg(name))) - throw(SaveException("Badge", file.fileName())); + throw(SaveException(className, file.fileName())); } void Badge::setObey(const unsigned o) throw(BoundsException) { if (pokemod.getRules().getMaxLevel() < o) - throw(BoundsException("Badge", "obey")); + throw(BoundsException(className, "obey")); obey = o; } void Badge::setStat(const unsigned s, const unsigned n, const unsigned d) throw(Exception) { if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s) - throw(BoundsException("Badge", "stat")); + throw(BoundsException(className, "stat")); stats[s].set(n, d); } void Badge::setStatNum(const unsigned s, const unsigned n) throw(Exception) { if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s) - throw(BoundsException("Badge", "stat")); + throw(BoundsException(className, "stat")); stats[s].setNum(n); } void Badge::setStatDenom(const unsigned s, const unsigned d) throw(Exception) { if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s) - throw(BoundsException("Badge", "stat")); + throw(BoundsException(className, "stat")); stats[s].setDenom(d); } void Badge::setHm(const unsigned h, const bool hb) throw(BoundsException) { if (HM_End_All <= h) - throw(BoundsException("Badge", "hm")); + throw(BoundsException(className, "hm")); hm[h] = hb; } @@ -182,14 +182,14 @@ unsigned Badge::getObey() const Frac Badge::getStat(const unsigned s) const throw(BoundsException) { if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s) - throw(BoundsException("Badge", "stat")); + throw(BoundsException(className, "stat")); return stats[s]; } bool Badge::getHm(const unsigned h) const throw(BoundsException) { if (HM_End_All <= h) - throw(BoundsException("Badge", "hm")); + throw(BoundsException(className, "hm")); return hm[h]; } diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp index 581f0d6e..5dd0f3df 100644 --- a/pokemod/CoinList.cpp +++ b/pokemod/CoinList.cpp @@ -32,20 +32,20 @@ #include "CoinList.h" CoinList::CoinList(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("ClassName", par, _id), name(""), value(0) { } CoinList::CoinList(const Pokemod& par, const CoinList& c, const unsigned _id) : - Object(par, _id) + Object("ClassName", par, _id) { *this = c; } CoinList::CoinList(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("ClassName", par, _id) { load(fname, _id); } @@ -178,7 +178,7 @@ void CoinList::setValue(const unsigned v) throw(Exception) } } } - throw(Exception("CoinList", "no compatable coin cases")); + throw(Exception(className, "no compatable coin cases")); } QString CoinList::getName() const @@ -194,14 +194,14 @@ unsigned CoinList::getValue() const const CoinListObject& CoinList::getItem(const unsigned i) const throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("CoinList")); + throw(IndexException(className)); return items.at(i); } CoinListObject& CoinList::getItem(const unsigned i) throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("CoinList")); + throw(IndexException(className)); return items[i]; } @@ -251,7 +251,7 @@ CoinListObject& CoinList::newItem(const CoinListObject& o) void CoinList::deleteItem(const unsigned i) throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("CoinList")); + throw(IndexException(className)); items.removeAt(i); } diff --git a/pokemod/CoinListObject.cpp b/pokemod/CoinListObject.cpp index fcc4579a..f3c48388 100644 --- a/pokemod/CoinListObject.cpp +++ b/pokemod/CoinListObject.cpp @@ -26,7 +26,7 @@ const QStringList CoinListObject::TypeStr = QStringList() << "Item" << "Pokémon"; CoinListObject::CoinListObject(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("CoinListObject", par, _id), type(Item), object(UINT_MAX), amount(1), @@ -35,13 +35,13 @@ CoinListObject::CoinListObject(const Pokemod& par, const unsigned _id) : } CoinListObject::CoinListObject(const Pokemod& par, const CoinListObject& o, const unsigned _id) : - Object(par, _id) + Object("CoinListObject", par, _id) { *this = o; } CoinListObject::CoinListObject(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("CoinListObject", par, _id) { load(fname, _id); } @@ -106,7 +106,7 @@ void CoinListObject::save(const QString& coinList) const throw(Exception) void CoinListObject::setType(const unsigned t) throw(BoundsException) { if (End <= t) - throw(BoundsException("CoinListObject", "type")); + throw(BoundsException(className, "type")); type = t; object = UINT_MAX; } @@ -114,14 +114,14 @@ void CoinListObject::setType(const unsigned t) throw(BoundsException) void CoinListObject::setObject(const unsigned o) throw(BoundsException) { if (((type == Item) && (pokemod.getItemIndex(object) == UINT_MAX)) || ((type == Pokemon) && (pokemod.getSpeciesIndex(object) == UINT_MAX))) - throw(BoundsException("CoinListObject", "object")); + throw(BoundsException(className, "object")); object = o; } void CoinListObject::setAmount(const unsigned a) throw(BoundsException) { if (!a) - throw(BoundsException("CoinListObject", "amount")); + throw(BoundsException(className, "amount")); amount = a; } diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp index 829a53f7..a907fb2b 100644 --- a/pokemod/Dialog.cpp +++ b/pokemod/Dialog.cpp @@ -36,19 +36,19 @@ const QStringList Dialog::CommandAbbrStr = QStringList() << "FF" << "SF" << "UF" const QList<unsigned> Dialog::CommandNumArgs = QList<unsigned>() << 1 << 1 << 1 << 1 << 3 << 2 << 2 << 1 << 4 << 4 << 4 << 1 << 5 << 3 << 7 << 4 << 1 << 4 << 1 << 4 << 6 << 3 << 6 << 5 << 5 << 4 << 4 << 5 << 6 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 3 << 1 << 1 << 3 << 0 << 0 << 0 << 0 << 0 << 0; Dialog::Dialog(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Dialog", par, _id), dialog("") { } Dialog::Dialog(const Pokemod& par, const Dialog& d, const unsigned _id) : - Object(par, _id) + Object("Dialog", par, _id) { *this = d; } Dialog::Dialog(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Dialog", par, _id) { load(fname, _id); } @@ -668,14 +668,14 @@ void Dialog::load(const QString& fname, const unsigned _id) throw(Exception) ini.getValue("id", id); else id = _id; - ini.getValue("dialog", dialog); + ini.getValue(className, dialog); } void Dialog::save() const throw(Exception) { Ini ini; ini.addField("id", id); - ini.addField("dialog", dialog); + ini.addField(className, dialog); ini.save(QString("%1/dialog/%2.pini").arg(pokemod.getPath()).arg(id)); } @@ -692,7 +692,7 @@ QString Dialog::getDialog() const void Dialog::insertDialogCommand(const QString& cmd, const long pos) throw(BoundsException) { if (dialog.length() < pos) - throw(BoundsException("Dialog" , "command")); + throw(BoundsException(className , "command")); dialog.insert(pos, cmd); } diff --git a/pokemod/EggGroup.cpp b/pokemod/EggGroup.cpp index 90d10b14..bd7e2078 100644 --- a/pokemod/EggGroup.cpp +++ b/pokemod/EggGroup.cpp @@ -24,19 +24,19 @@ #include "EggGroup.h" EggGroup::EggGroup(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("EggGroup", par, _id), name("") { } EggGroup::EggGroup(const Pokemod& par, const EggGroup& e, const unsigned _id) : - Object(par, _id) + Object("EggGroup", par, _id) { *this = e; } EggGroup::EggGroup(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("EggGroup", par, _id) { load(fname, _id); } diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index 43e7066b..57bba3eb 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -30,7 +30,7 @@ #include "Item.h" Item::Item(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Item", par, _id), name(""), sellable(false), type(UINT_MAX), @@ -40,13 +40,13 @@ Item::Item(const Pokemod& par, const unsigned _id) : } Item::Item(const Pokemod& par, const Item& i, const unsigned _id) : - Object(par, _id) + Object("Item", par, _id) { *this = i; } Item::Item(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Item", par, _id) { load(fname, _id); } @@ -149,7 +149,7 @@ void Item::setSellable(const bool s) void Item::setType(const unsigned t) throw(BoundsException) { if (pokemod.getItemTypeIndex(t) == UINT_MAX) - throw(BoundsException("Item", "type")); + throw(BoundsException(className, "type")); type = t; } @@ -191,14 +191,14 @@ QString Item::getDescription() const const ItemEffect& Item::getEffect(const unsigned i) const throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Item")); + throw(IndexException(className)); return effects.at(i); } ItemEffect& Item::getEffectByID(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Item")); + throw(IndexException(className)); return effects[i]; } @@ -248,7 +248,7 @@ ItemEffect& Item::newEffect(const ItemEffect& e) void Item::deleteEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Item")); + throw(IndexException(className)); effects.removeAt(i); } diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp index 47ff017f..bcfb863f 100644 --- a/pokemod/ItemEffect.cpp +++ b/pokemod/ItemEffect.cpp @@ -35,7 +35,7 @@ const QStringList ItemEffect::BallTypeStr = QStringList() << "Regular" << "Maste const QStringList ItemEffect::BerryTypeStr = QStringList() << "HP Cure" << "Status Cure"; ItemEffect::ItemEffect(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("ItemEffect", par, _id), overworld(false), battle(false), held(false), @@ -48,13 +48,13 @@ ItemEffect::ItemEffect(const Pokemod& par, const unsigned _id) : } ItemEffect::ItemEffect(const Pokemod& par, const ItemEffect& e, const unsigned _id) : - Object(par, _id) + Object("ItemEffect", par, _id) { *this = e; } ItemEffect::ItemEffect(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("ItemEffect", par, _id) { load(fname, _id); } @@ -357,7 +357,7 @@ void ItemEffect::setOverworld(const bool o) throw(Exception) case E_Acorn: case E_Evolution: if (!o) - throw(Exception("ItemEffect", "overworld mismatch")); + throw(Exception(className, "overworld mismatch")); break; case E_Flinch: case E_First: @@ -370,7 +370,7 @@ void ItemEffect::setOverworld(const bool o) throw(Exception) case E_Ball: case E_Berry: if (o) - throw(Exception("ItemEffect", "overworld mismatch")); + throw(Exception(className, "overworld mismatch")); break; } overworld = o; @@ -389,7 +389,7 @@ void ItemEffect::setHeld(const bool h) void ItemEffect::setEffect(const unsigned e) throw(Exception) { if (E_End <= e) - throw(BoundsException("ItemEffect", "effect out-of-bounds")); + throw(BoundsException(className, "effect out-of-bounds")); switch (e) { case E_Revive: @@ -410,7 +410,7 @@ void ItemEffect::setEffect(const unsigned e) throw(Exception) case E_Acorn: case E_Evolution: if (!overworld) - throw(Exception("ItemEffect", "overworld mismatch")); + throw(Exception(className, "overworld mismatch")); break; case E_Flinch: case E_First: @@ -423,7 +423,7 @@ void ItemEffect::setEffect(const unsigned e) throw(Exception) case E_Ball: case E_Berry: if (overworld) - throw(Exception("ItemEffect", "overworld mismatch")); + throw(Exception(className, "overworld mismatch")); break; } effect = e; @@ -440,23 +440,23 @@ void ItemEffect::setVal1(const int v1) throw(Exception) case E_HPCure: case E_Revive: if ((val4 != R_Absolute) || !val1) - throw(BoundsException("ItemEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_LevelBoost: case E_ShieldBattle: case E_PPBoost: case E_Repel: if (!val1) - throw(BoundsException("ItemEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_StatBoost: case E_Acorn: if ((val1 < 0) || (65536 <= val1)) - throw(BoundsException("ItemEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_ModifyStatBattle: if ((val1 < -6) || (6 < val1)) - throw(BoundsException("ItemEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_Fish: case E_Coin: @@ -467,11 +467,11 @@ void ItemEffect::setVal1(const int v1) throw(Exception) { case B_Regular: if (256 <= (unsigned)val1) - throw(BoundsException("ItemEffect", "val1")); + throw(BoundsException(className, "val1")); break; case B_Level: if (pokemod.getRules().getMaxLevel() < (unsigned)val1) - throw(BoundsException("ItemEffect", "val1")); + throw(BoundsException(className, "val1")); break; case B_Master: case B_Love: @@ -484,11 +484,11 @@ void ItemEffect::setVal1(const int v1) throw(Exception) case B_Weight: break; default: - throw(BoundsException("ItemEffect", "val1")); + throw(BoundsException(className, "val1")); } break; default: - throw(UnusedException("ItemEffect", "val1")); + throw(UnusedException(className, "val1")); break; } val1 = v1; @@ -501,66 +501,66 @@ void ItemEffect::setVal2(const unsigned v2) throw(Exception) case E_HPCure: case E_Revive: if (R_End <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_CureStatus: if (STS_End <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_StatBoost: if ((val2 <= 0) || (65536 <= val2)) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_ModifyStatBattle: if (ST_End_Battle <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_ShieldBattle: if (SP_End <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_TypeBoost: if (pokemod.getTypeIndex(val2) == UINT_MAX) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_PPRestore: if (A_End <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Repel: if (RP_End <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Escape: if (ES_End <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_TM: case E_HM: if (pokemod.getMoveIndex(val2) == UINT_MAX) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Ball: if (B_End <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Scope: break; case E_Berry: if (B2_End <= val2) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Coin: case E_CoinCase: if (val2 <= 0) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_Acorn: if (pokemod.getItemIndex(val2) == UINT_MAX) - throw(BoundsException("ItemEffect", "val2")); + throw(BoundsException(className, "val2")); break; default: - throw(UnusedException("ItemEffect", "val2")); + throw(UnusedException(className, "val2")); break; } val2 = v2; @@ -572,7 +572,7 @@ void ItemEffect::setVal3(const unsigned v3) throw(Exception) { case E_StatBoost: if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= val3) - throw(BoundsException("ItemEffect", "val3")); + throw(BoundsException(className, "val3")); break; case E_Ball: switch (val2) @@ -583,25 +583,25 @@ void ItemEffect::setVal3(const unsigned v3) throw(Exception) break; case B_Area: if (MapWildList::End <= val3) - throw(BoundsException("ItemEffect", "val3")); + throw(BoundsException(className, "val3")); break; case B_Time: if (pokemod.getTimeIndex(val3) == UINT_MAX) - throw(BoundsException("ItemEffect", "val3")); + throw(BoundsException(className, "val3")); break; case B_Stat: if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= val3) - throw(BoundsException("ItemEffect", "val3")); + throw(BoundsException(className, "val3")); break; case B_Type: if (pokemod.getTypeIndex(val3) == UINT_MAX) - throw(BoundsException("ItemEffect", "val3")); + throw(BoundsException(className, "val3")); break; case B_Regular: case B_Master: case B_Love: case B_Battle: - throw(UnusedException("ItemEffect", "val3")); + throw(UnusedException(className, "val3")); break; } break; @@ -610,19 +610,19 @@ void ItemEffect::setVal3(const unsigned v3) throw(Exception) { case B2_HPCure: if (REL_End <= val3) - throw(BoundsException("ItemEffect", "val3")); + throw(BoundsException(className, "val3")); break; case B2_StatusCure: if (STS_End <= val3) - throw(BoundsException("ItemEffect", "val3")); + throw(BoundsException(className, "val3")); break; default: - throw(UnusedException("ItemEffect", "val3")); + throw(UnusedException(className, "val3")); break; } break; default: - throw(UnusedException("ItemEffect", "val3")); + throw(UnusedException(className, "val3")); break; } val3 = v3; @@ -648,14 +648,14 @@ void ItemEffect::setVal4(const unsigned n, const unsigned d) throw(Exception) case E_CoinCase: case E_Acorn: case E_Evolution: - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); case E_Ball: if (val2 == B_Master) - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); break; case E_Berry: if (val2 != B2_HPCure) - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); break; } val4.set(n, d); @@ -681,14 +681,14 @@ void ItemEffect::setVal4Num(const unsigned n) throw(Exception) case E_CoinCase: case E_Acorn: case E_Evolution: - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); case E_Ball: if (val2 == B_Master) - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); break; case E_Berry: if (val2 != B2_HPCure) - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); break; } val4.setNum(n); @@ -714,14 +714,14 @@ void ItemEffect::setVal4Denom(const unsigned d) throw(Exception) case E_CoinCase: case E_Acorn: case E_Evolution: - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); case E_Ball: if (val2 == B_Master) - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); break; case E_Berry: if (val2 != B2_HPCure) - throw(UnusedException("ItemEffect", "val4")); + throw(UnusedException(className, "val4")); break; } val4.setDenom(d); diff --git a/pokemod/ItemType.cpp b/pokemod/ItemType.cpp index 6caa0a41..ee1ee613 100644 --- a/pokemod/ItemType.cpp +++ b/pokemod/ItemType.cpp @@ -25,7 +25,7 @@ #include "ItemType.h" ItemType::ItemType(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("ItemType", par, _id), name(""), computer(0), player(1) @@ -33,13 +33,13 @@ ItemType::ItemType(const Pokemod& par, const unsigned _id) : } ItemType::ItemType(const Pokemod& par, const ItemType& i, const unsigned _id) : - Object(par, _id) + Object("ItemType", par, _id) { *this = i; } ItemType::ItemType(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("ItemType", par, _id) { load(fname, _id); } @@ -96,7 +96,7 @@ void ItemType::setComputer(const unsigned c) void ItemType::setPlayer(const unsigned p) throw(BoundsException) { if (!p) - throw(BoundsException("ItemType", "player")); + throw(BoundsException(className, "player")); player = p; } diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp index e3d90465..a57d58fd 100644 --- a/pokemod/Map.cpp +++ b/pokemod/Map.cpp @@ -30,7 +30,7 @@ const QStringList Map::TypeStr = QStringList() << "Outdoor" << "Dungeon" << "Building"; Map::Map(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Map", par, _id), name(""), flyWarp(UINT_MAX), type(UINT_MAX) @@ -38,13 +38,13 @@ Map::Map(const Pokemod& par, const unsigned _id) : } Map::Map(const Pokemod& par, const Map& m, const unsigned _id) : - Object(par, _id) + Object("Map", par, _id) { *this = m; } Map::Map(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Map", par, _id) { load(fname, _id); } @@ -344,14 +344,14 @@ void Map::setName(const QString& n) void Map::setFlyWarp(const unsigned f) throw(BoundsException) { if (getWarpIndex(f) == UINT_MAX) - throw(BoundsException("Map", "warp")); + throw(BoundsException(className, "warp")); flyWarp = f; } void Map::setType(const unsigned t) throw(BoundsException) { if (End <= t) - throw(BoundsException("Map", "type")); + throw(BoundsException(className, "type")); type = t; } @@ -373,7 +373,7 @@ unsigned Map::getType() const void Map::setTile(unsigned x, unsigned y, unsigned _id) throw(BoundsException) { if (pokemod.getTileIndex(_id) == UINT_MAX) - throw(BoundsException("Map", "tile")); + throw(BoundsException(className, "tile")); tiles(x, y) = _id; } @@ -425,14 +425,14 @@ unsigned Map::getHeight() const const MapEffect& Map::getEffect(const unsigned i) const throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); return effects.at(i); } MapEffect& Map::getEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); return effects[i]; } @@ -482,21 +482,21 @@ MapEffect& Map::newEffect(const MapEffect& e) void Map::deleteEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); effects.removeAt(i); } const MapTrainer& Map::getTrainer(const unsigned i) const throw(IndexException) { if (getTrainerCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); return trainers.at(i); } MapTrainer& Map::getTrainer(const unsigned i) throw(IndexException) { if (getTrainerCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); return trainers[i]; } @@ -546,21 +546,21 @@ MapTrainer& Map::newTrainer(const MapTrainer& t) void Map::deleteTrainer(const unsigned i) throw(IndexException) { if (getTrainerCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); trainers.removeAt(i); } const MapWarp& Map::getWarp(const unsigned i) const throw(IndexException) { if (getWarpCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); return warps.at(i); } MapWarp& Map::getWarp(const unsigned i) throw(IndexException) { if (getWarpCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); return warps[i]; } @@ -610,21 +610,21 @@ MapWarp& Map::newWarp(const MapWarp& w) void Map::deleteWarp(const unsigned i) throw(IndexException) { if (getWarpCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); warps.removeAt(i); } const MapWildList& Map::getWildList(const unsigned i) const throw(IndexException) { if (getWildListCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); return wildLists.at(i); } MapWildList& Map::getWildList(const unsigned i) throw(IndexException) { if (getWildListCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); return wildLists[i]; } @@ -674,7 +674,7 @@ MapWildList& Map::newWildList(const MapWildList& w) void Map::deleteWildList(const unsigned i) throw(IndexException) { if (getWildListCount() <= i) - throw(IndexException("Map")); + throw(IndexException(className)); wildLists.removeAt(i); } diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp index df59f432..e731a2af 100644 --- a/pokemod/MapEffect.cpp +++ b/pokemod/MapEffect.cpp @@ -28,7 +28,7 @@ const QStringList MapEffect::MapEffectStr = QStringList() << "Item" << "PC" << " const QStringList MapEffect::PCTypeStr = QStringList() << "Item" << "Pokémon" << "PokéDex" << "Hall of Fame" << "All"; MapEffect::MapEffect(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("MapEffect", par, _id), name(""), coordinate(0, 0), existFlag(0, 0), @@ -44,13 +44,13 @@ MapEffect::MapEffect(const Pokemod& par, const unsigned _id) : } MapEffect::MapEffect(const Pokemod& par, const MapEffect& e, const unsigned _id) : - Object(par, _id) + Object("MapEffect", par, _id) { *this = e; } MapEffect::MapEffect(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("MapEffect", par, _id) { load(fname, _id); } @@ -201,14 +201,14 @@ void MapEffect::setExistFlagStatus(const unsigned s) void MapEffect::setSkin(const QString& s) throw(Exception) { if (!QFile::exists(QString("%1/image/skin/%2.png").arg(pokemod.getPath()).arg(s))) - throw(Exception("MapEffect", "skin does not exist")); + throw(Exception(className, "skin does not exist")); skin = s; } void MapEffect::setEffect(const unsigned e) throw(BoundsException) { if (E_End <= e) - throw(BoundsException("MapEffect", "effect")); + throw(BoundsException(className, "effect")); effect = e; val1 = UINT_MAX; val2 = UINT_MAX; @@ -217,7 +217,7 @@ void MapEffect::setEffect(const unsigned e) throw(BoundsException) void MapEffect::setVal1(const unsigned v1) throw(UnusedException) { if ((effect != E_StrengthBlock) && (effect != E_Button)) - throw(UnusedException("MapEffect", "val1")); + throw(UnusedException(className, "val1")); val1 = v1; } @@ -227,19 +227,19 @@ void MapEffect::setVal2(const unsigned v2) throw(Exception) { case E_Item: if (pokemod.getItemIndex(val2) == UINT_MAX) - throw(BoundsException("MapEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_PC: if (PC_End <= val2) - throw(BoundsException("MapEffect", "val2")); + throw(BoundsException(className, "val2")); break; case E_StrengthBlock: case E_Button: if (Flag::End <= val2) - throw(BoundsException("MapEffect", "val2")); + throw(BoundsException(className, "val2")); break; default: - throw(UnusedException("MapEffect", "val2")); + throw(UnusedException(className, "val2")); break; } val2 = v2; @@ -248,7 +248,7 @@ void MapEffect::setVal2(const unsigned v2) throw(Exception) void MapEffect::setDirection(const unsigned d) throw(BoundsException) { if (D_End_None <= d) - throw(BoundsException("MapEffect", "direction")); + throw(BoundsException(className, "direction")); direction = d; } @@ -265,7 +265,7 @@ void MapEffect::setCanMove(const bool c) void MapEffect::setDialog(const unsigned d) throw(BoundsException) { if (pokemod.getDialogIndex(d) == UINT_MAX) - throw(BoundsException("MapEffect", "dialog")); + throw(BoundsException(className, "dialog")); dialog = d; } diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp index 14a964fc..01c5d5a9 100644 --- a/pokemod/MapTrainer.cpp +++ b/pokemod/MapTrainer.cpp @@ -31,7 +31,7 @@ #include "MapTrainer.h" MapTrainer::MapTrainer(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("MapTrainer", par, _id), name(""), coordinate(0, 0), skin(""), @@ -48,13 +48,13 @@ MapTrainer::MapTrainer(const Pokemod& par, const unsigned _id) : } MapTrainer::MapTrainer(const Pokemod& par, const MapTrainer& t, const unsigned _id) : - Object(par, _id) + Object("MapTrainer", par, _id) { *this = t; } MapTrainer::MapTrainer(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("MapTrainer", par, _id) { load(fname, _id); } @@ -228,7 +228,7 @@ void MapTrainer::setCoordinateY(const unsigned y) void MapTrainer::setSkin(const QString& s) throw(OpenException) { if (!QFile::exists(QString("%1/image/skin/%2.png").arg(pokemod.getPath()).arg(s))) - throw(OpenException("MapTrainer", QString("%1/image/skin/%2.png").arg(pokemod.getPath()).arg(s))); + throw(OpenException(className, QString("%1/image/skin/%2.png").arg(pokemod.getPath()).arg(s))); skin = s; } @@ -240,21 +240,21 @@ void MapTrainer::setSight(const unsigned s) void MapTrainer::setDirection(const unsigned d) throw(BoundsException) { if (D_End_None <= d) - throw(BoundsException("MapTrainer", "direction")); + throw(BoundsException(className, "direction")); direction = d; } void MapTrainer::setNumFight(const unsigned n) throw(BoundsException) { if (!n || (pokemod.getRules().getMaxFight() < n)) - throw(BoundsException("MapTrainer", "numFight")); + throw(BoundsException(className, "numFight")); numFight = n; } void MapTrainer::setAI(const QString& a) throw(OpenException) { if (!QFile::exists(QString("%1/ai/%2.pai").arg(pokemod.getPath()).arg(a))) - throw(OpenException("MapTrainer", QString("%1/ai/%2.pai").arg(pokemod.getPath()).arg(a))); + throw(OpenException(className, QString("%1/ai/%2.pai").arg(pokemod.getPath()).arg(a))); ai = a; } @@ -276,28 +276,28 @@ void MapTrainer::setAppearFlagStatus(const unsigned s) void MapTrainer::setOverworldDialog(const unsigned o) throw(BoundsException) { if (pokemod.getDialogIndex(o) == UINT_MAX) - throw(BoundsException("MapTrainer", "overworldDialog")); + throw(BoundsException(className, "overworldDialog")); overworldDialog = o; } void MapTrainer::setWinDialog(const unsigned w) throw(BoundsException) { if (pokemod.getDialogIndex(w) == UINT_MAX) - throw(BoundsException("MapTrainer", "winDialog")); + throw(BoundsException(className, "winDialog")); winDialog = w; } void MapTrainer::setLoseDialog(const unsigned l) throw(BoundsException) { if (pokemod.getDialogIndex(l) == UINT_MAX) - throw(BoundsException("MapTrainer", "loseDialog")); + throw(BoundsException(className, "loseDialog")); loseDialog = l; } void MapTrainer::setLeadTeamMember(const unsigned l) throw(BoundsException) { if (getTeamMemberCount() <= l) - throw(BoundsException("MapTrainer", "leadTeamMember")); + throw(BoundsException(className, "leadTeamMember")); leadTeamMember = l; } @@ -364,14 +364,14 @@ unsigned MapTrainer::getLeadTeamMember() const const MapTrainerTeamMember& MapTrainer::getTeamMember(const unsigned i) const throw(IndexException) { if (getTeamMemberCount() <= i) - throw(IndexException("MapTrainer")); + throw(IndexException(className)); return teamMembers.at(i); } MapTrainerTeamMember& MapTrainer::getTeamMember(const unsigned i) throw(IndexException) { if (getTeamMemberCount() <= i) - throw(IndexException("MapTrainer")); + throw(IndexException(className)); return teamMembers[i]; } @@ -421,7 +421,7 @@ MapTrainerTeamMember& MapTrainer::newTeamMember(const MapTrainerTeamMember& p) void MapTrainer::deleteTeamMember(const unsigned i) throw(IndexException) { if (getTeamMemberCount() <= i) - throw(IndexException("MapTrainer")); + throw(IndexException(className)); teamMembers.removeAt(i); } diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp index 45e84bb3..b894b7d7 100644 --- a/pokemod/MapTrainerTeamMember.cpp +++ b/pokemod/MapTrainerTeamMember.cpp @@ -28,7 +28,7 @@ #include "MapTrainerTeamMember.h" MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("MapTrainerTeamMember", par, _id), species(UINT_MAX), level(UINT_MAX), nature(UINT_MAX) @@ -36,13 +36,13 @@ MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const unsigned _i } MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const MapTrainerTeamMember& t, const unsigned _id) : - Object(par, _id) + Object("MapTrainerTeamMember", par, _id) { *this = t; } MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("MapTrainerTeamMember", par, _id) { load(fname, _id); } @@ -136,14 +136,14 @@ void MapTrainerTeamMember::save(const QString& map, const QString& trainer) cons void MapTrainerTeamMember::setSpecies(const unsigned s) throw(BoundsException) { if (pokemod.getSpeciesIndex(s) == UINT_MAX) - throw(BoundsException("MapTrainerTeamMember", "species")); + throw(BoundsException(className, "species")); species = s; } void MapTrainerTeamMember::setLevel(const unsigned l) throw(BoundsException) { if (pokemod.getRules().getMaxLevel() < l) - throw(BoundsException("MapTrainerTeamMember", "level")); + throw(BoundsException(className, "level")); level = l; } @@ -156,22 +156,22 @@ void MapTrainerTeamMember::setItem(const unsigned itm, const bool it) throw(Exce if (i.next() == itm) { if (it) - throw(Exception("MapTrainerTeamMember", "item already used")); + throw(Exception(className, "item already used")); else i.remove(); } } if (!it) - throw(Exception("MapTrainerTeamMember", "item wasn\'t being used anyway")); + throw(Exception(className, "item wasn\'t being used anyway")); if (pokemod.getRules().getHoldItems() <= unsigned(items.size())) - throw(Exception("MapTrainerTeamMember", "too many items")); + throw(Exception(className, "too many items")); items.append(itm); } void MapTrainerTeamMember::setNature(const unsigned n) throw(BoundsException) { if (!pokemod.getRules().getNatureAllowed() || (pokemod.getNatureIndex(n) == UINT_MAX)) - throw(BoundsException("MapTrainerTeamMember", "nature")); + throw(BoundsException(className, "nature")); nature = n; } diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp index 733b66c5..315f92a6 100644 --- a/pokemod/MapWarp.cpp +++ b/pokemod/MapWarp.cpp @@ -28,7 +28,7 @@ const QStringList MapWarp::TypeStr = QStringList() << "Door/Stair" << "Warp Pad" << "Hole" << "Boundary"; MapWarp::MapWarp(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("MapWarp", par, _id), name(""), coordinate(0, 0), directionOut(UINT_MAX), @@ -46,13 +46,13 @@ MapWarp::MapWarp(const Pokemod& par, const unsigned _id) : } MapWarp::MapWarp(const Pokemod& par, const MapWarp& w, const unsigned _id) : - Object(par, _id) + Object("MapWarp", par, _id) { *this = w; } MapWarp::MapWarp(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("MapWarp", par, _id) { load(fname, _id); } @@ -178,21 +178,21 @@ void MapWarp::setCoordinateY(const unsigned y) void MapWarp::setFrom(const unsigned d, const bool f) throw(BoundsException) { if (D_End <= d) - throw(BoundsException("MapWarp", "direction")); + throw(BoundsException(className, "direction")); from[d] = f; } void MapWarp::setDirectionOut(const unsigned d) throw(BoundsException) { if (D_End <= d) - throw(BoundsException("MapWarp", "direction")); + throw(BoundsException(className, "direction")); directionOut = d; } void MapWarp::setWarpType(const unsigned w) throw(BoundsException) { if (End <= w) - throw(BoundsException("MapWarp", "warpType")); + throw(BoundsException(className, "warpType")); warpType = w; } @@ -214,7 +214,7 @@ void MapWarp::setIsFoggy(const bool i) void MapWarp::setToMap(const unsigned t) throw(BoundsException) { if (pokemod.getMapIndex(t) == UINT_MAX) - throw(BoundsException("MapWarp", "toMap")); + throw(BoundsException(className, "toMap")); toMap = t; toWarp = UINT_MAX; } @@ -222,9 +222,9 @@ void MapWarp::setToMap(const unsigned t) throw(BoundsException) void MapWarp::setToWarp(const unsigned t) throw(BoundsException) { if (pokemod.getMapIndex(toMap) == UINT_MAX) - throw(BoundsException("MapWarp", "toMap")); + throw(BoundsException(className, "toMap")); if (pokemod.getMapByID(toMap).getWarpIndex(t) == UINT_MAX) - throw(BoundsException("MapWarp", "toWarp")); + throw(BoundsException(className, "toWarp")); } void MapWarp::setWorkingFlag(const unsigned f, const unsigned s) @@ -245,7 +245,7 @@ void MapWarp::setWorkingFlagStatus(const unsigned s) void MapWarp::setDialog(const unsigned d) throw(BoundsException) { if (pokemod.getDialogIndex(d) == UINT_MAX) - throw(BoundsException("MapWarp", "dialog")); + throw(BoundsException(className, "dialog")); dialog = d; } @@ -262,7 +262,7 @@ Point MapWarp::getCoordinate() const bool MapWarp::getFrom(const unsigned d) const throw(BoundsException) { if (D_End <= d) - throw(BoundsException("MapWarp", "direction")); + throw(BoundsException(className, "direction")); return from[d]; } diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp index b55e06c2..f4523983 100644 --- a/pokemod/MapWildList.cpp +++ b/pokemod/MapWildList.cpp @@ -34,7 +34,7 @@ const QStringList MapWildList::ControlStr = QStringList() << "Grass" << "Surfing" << "Fishing" << "Dive" << "Headbutt" << "Rock Smash"; MapWildList::MapWildList(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("MapWildList", par, _id), control(UINT_MAX), value(INT_MAX), scope(INT_MAX) @@ -42,13 +42,13 @@ MapWildList::MapWildList(const Pokemod& par, const unsigned _id) : } MapWildList::MapWildList(const Pokemod& par, const MapWildList& w, const unsigned _id) : - Object(par, _id) + Object("MapWildList", par, _id) { *this = w; } MapWildList::MapWildList(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("MapWildList", par, _id) { load(fname, _id); } @@ -174,7 +174,7 @@ void MapWildList::save(const QString& map) const throw(Exception) void MapWildList::setControl(const unsigned c) throw(BoundsException) { if (End <= c) - throw(BoundsException("MapWildList", "control")); + throw(BoundsException(className, "control")); control = c; } @@ -190,13 +190,13 @@ void MapWildList::setTime(const unsigned ts, const bool t) throw(Exception) if (i.next() == ts) { if (t) - throw(Exception("MapWildList", "time already used")); + throw(Exception(className, "time already used")); else i.remove(); } } if (!t) - throw(Exception("MapWildList", "time wasn\'t being used anyway")); + throw(Exception(className, "time wasn\'t being used anyway")); times.append(ts); } @@ -233,14 +233,14 @@ int MapWildList::getScope() const const MapWildListEncounter& MapWildList::getEncounter(const unsigned i) const throw(IndexException) { if (getEncounterCount() <= i) - throw(IndexException("MapWildList")); + throw(IndexException(className)); return encounters.at(i); } MapWildListEncounter& MapWildList::getEncounter(const unsigned i) throw(IndexException) { if (getEncounterCount() <= i) - throw(IndexException("MapWildList")); + throw(IndexException(className)); return encounters[i]; } @@ -290,7 +290,7 @@ MapWildListEncounter& MapWildList::newEncounter(const MapWildListEncounter& p) void MapWildList::deleteEncounter(const unsigned i) throw(IndexException) { if (getEncounterCount() <= i) - throw(IndexException("MapWildList")); + throw(IndexException(className)); encounters.removeAt(i); } diff --git a/pokemod/MapWildListEncounter.cpp b/pokemod/MapWildListEncounter.cpp index d3960262..59725df0 100644 --- a/pokemod/MapWildListEncounter.cpp +++ b/pokemod/MapWildListEncounter.cpp @@ -25,7 +25,7 @@ #include "MapWildListEncounter.h" MapWildListEncounter::MapWildListEncounter(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("MapWildListEncounter", par, _id), species(UINT_MAX), level(1), weight(1) @@ -33,13 +33,13 @@ MapWildListEncounter::MapWildListEncounter(const Pokemod& par, const unsigned _i } MapWildListEncounter::MapWildListEncounter(const Pokemod& par, const MapWildListEncounter& p, const unsigned _id) : - Object(par, _id) + Object("MapWildListEncounter", par, _id) { *this = p; } MapWildListEncounter::MapWildListEncounter(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("MapWildListEncounter", par, _id) { load(fname, _id); } @@ -91,21 +91,21 @@ void MapWildListEncounter::save(const QString& map, const unsigned listId) const void MapWildListEncounter::setSpecies(const unsigned s) throw(BoundsException) { if (pokemod.getSpeciesIndex(s) == UINT_MAX) - throw(BoundsException("MapWildListEncounter", "species")); + throw(BoundsException(className, "species")); species = s; } void MapWildListEncounter::setLevel(const unsigned l) throw(BoundsException) { if (!level || (pokemod.getRules().getMaxLevel() <= level)) - throw(BoundsException("MapWildListEncounter", "level")); + throw(BoundsException(className, "level")); level = l; } void MapWildListEncounter::setWeight(const unsigned w) throw(BoundsException) { if (!w) - throw(BoundsException("MapWildListEncounter", "weight")); + throw(BoundsException(className, "weight")); weight = w; } diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp index 326a0368..bcea9c7f 100644 --- a/pokemod/Move.cpp +++ b/pokemod/Move.cpp @@ -32,7 +32,7 @@ const QStringList Move::TargetStr = QStringList() << "Player" << "Enemy" << "Bot const QStringList Move::ChoiceStr = QStringList() << "Player" << "Enemy" << "Random"; Move::Move(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Move", par, _id), name(""), accuracy(1, 1), power(0), @@ -51,13 +51,13 @@ Move::Move(const Pokemod& par, const unsigned _id) : } Move::Move(const Pokemod& par, const Move& m, const unsigned _id) : - Object(par, _id) + Object("Move", par, _id) { *this = m; } Move::Move(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Move", par, _id) { load(fname, _id); } @@ -215,7 +215,7 @@ void Move::setAccuracyDenom(const unsigned d) throw(Exception) void Move::setType(const unsigned t) throw(BoundsException) { if (pokemod.getTypeIndex(t) == UINT_MAX) - throw(BoundsException("Move", "type")); + throw(BoundsException(className, "type")); type = t; } @@ -227,28 +227,28 @@ void Move::setSpecial(const bool s) void Move::setPowerPoints(const unsigned p) throw(BoundsException) { if (!p) - throw(BoundsException("Move", "powerPoints")); + throw(BoundsException(className, "powerPoints")); powerPoints = p; } void Move::setTarget(const unsigned t) throw(BoundsException) { if (T_End <= t) - throw(BoundsException("Move", "target")); + throw(BoundsException(className, "target")); target = t; } void Move::setNumTargets(const unsigned n) throw(BoundsException) { if (!n || ((pokemod.getRules().getMaxFight() << 1) < n)) - throw(BoundsException("Move", "numTargets")); + throw(BoundsException(className, "numTargets")); numTargets = n; } void Move::setTargetChoice(const unsigned t) throw(BoundsException) { if (C_End <= t) - throw(BoundsException("Move", "targetChoice")); + throw(BoundsException(className, "targetChoice")); targetChoice = t; } @@ -350,14 +350,14 @@ QString Move::getDescription() const const MoveEffect& Move::getEffect(const unsigned i) const throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Move")); + throw(IndexException(className)); return effects.at(i); } MoveEffect& Move::getEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Move")); + throw(IndexException(className)); return effects[i]; } @@ -407,7 +407,7 @@ MoveEffect& Move::newEffect(const MoveEffect& e) void Move::deleteEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) - throw(IndexException("Move")); + throw(IndexException(className)); effects.removeAt(i); } diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp index 5fc53fc6..1da7ef6f 100644 --- a/pokemod/MoveEffect.cpp +++ b/pokemod/MoveEffect.cpp @@ -27,7 +27,7 @@ const QStringList MoveEffect::EffectStr = QStringList() << "Damage" << "Status" << "Confuse" << "Stat" << "StealHP" << "Counter" << "Selfdestruct" << "Need Status" << "Mirror" << "GetMoney" << "Never Miss" << "Steal Types" << "Clear Effects" << "Wait And Return" << "Self Confuse" << "Force Switch" << "Hit Multiple" << "Hit Multiple Turns" << "Flinch" << "One Hit K.O." << "Recoil" << "Recover" << "Rest" << "Sheild" << "Substitute" << "Recharge" << "Rage" << "Mimic" << "Random Move" << "Seed" << "Disable" << "Cut HM" << "Fly HM" << "Surf HM" << "Strength HM" << "Flash HM" << "Rock Smash HM" << "Rock Climb HM" << "Whirlpool HM" << "Waterfall HM" << "Share HP HM " << "Escape HM"; MoveEffect::MoveEffect(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("MoveEffect", par, _id), chance(1, 1), effect(UINT_MAX), val1(UINT_MAX), @@ -38,13 +38,13 @@ MoveEffect::MoveEffect(const Pokemod& par, const unsigned _id) : } MoveEffect::MoveEffect(const Pokemod& par, const MoveEffect& e, const unsigned _id) : - Object(par, _id) + Object("MoveEffect", par, _id) { *this = e; } MoveEffect::MoveEffect(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("MoveEffect", par, _id) { load(fname, _id); } @@ -114,7 +114,7 @@ void MoveEffect::setChanceDenom(const unsigned d) throw(Exception) void MoveEffect::setEffect(const unsigned e) throw(BoundsException) { if (E_End <= e) - throw(BoundsException("MoveEffect", "effect")); + throw(BoundsException(className, "effect")); effect = e; val1 = UINT_MAX; val2 = UINT_MAX; @@ -128,28 +128,28 @@ void MoveEffect::setVal1(const unsigned v1) throw(Exception) { case E_Damage: if (D_End <= v1) - throw(BoundsException("MoveEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_Status: case E_NeedStatus: if (STS_End <= v1) - throw(BoundsException("MoveEffect", "val1")); + throw(BoundsException(className, "val1")); throw; case E_Stat: if (ST_End_Battle <= v1) - throw(BoundsException("MoveEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_Counter: case E_Shield: if (MT_End <= v1) - throw(BoundsException("MoveEffect", "val1")); + throw(BoundsException(className, "val1")); break; case E_Recoil: if (R_End <= v1) - throw(BoundsException("MoveEffect", "val1")); + throw(BoundsException(className, "val1")); break; default: - throw(BoundsException("MoveEffect", "val1")); + throw(BoundsException(className, "val1")); break; } val1 = v1; @@ -161,10 +161,10 @@ void MoveEffect::setVal2(const unsigned v2) throw(Exception) { case E_Damage: if ((D_Level <= val1) || !v2) - throw(BoundsException("MoveEffect", "val2")); + throw(BoundsException(className, "val2")); break; default: - throw(BoundsException("MoveEffect", "val2")); + throw(BoundsException(className, "val2")); break; } val2 = v2; diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp index 1c6fc06d..b2e93227 100644 --- a/pokemod/Nature.cpp +++ b/pokemod/Nature.cpp @@ -25,7 +25,7 @@ #include "Nature.h" Nature::Nature(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Nature", par, _id), name(""), weight(1) { @@ -34,13 +34,13 @@ Nature::Nature(const Pokemod& par, const unsigned _id) : } Nature::Nature(const Pokemod& par, const Nature& n, const unsigned _id) : - Object(par, _id) + Object("Nature", par, _id) { *this = n; } Nature::Nature(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Nature", par, _id) { load(fname, _id); } @@ -102,28 +102,28 @@ void Nature::setName(const QString& n) void Nature::setStat(const unsigned s, const unsigned n, const unsigned d) throw(Exception) { if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s) - throw(BoundsException("Nature", "stat")); + throw(BoundsException(className, "stat")); stats[s].set(n, d); } void Nature::setStatNum(const unsigned s, const unsigned n) throw(Exception) { if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s) - throw(BoundsException("Nature", "stat")); + throw(BoundsException(className, "stat")); stats[s].setNum(n); } void Nature::setStatDenom(const unsigned s, const unsigned d) throw(Exception) { if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s) - throw(BoundsException("Nature", "stat")); + throw(BoundsException(className, "stat")); stats[s].setDenom(d); } void Nature::setWeight(const unsigned w) throw(BoundsException) { if (!w) - throw(BoundsException("Nature", "weight")); + throw(BoundsException(className, "weight")); weight = w; } @@ -135,7 +135,7 @@ QString Nature::getName() const Frac Nature::getStat(const unsigned s) const throw(BoundsException) { if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s) - throw(BoundsException("Nature", "stat")); + throw(BoundsException(className, "stat")); return stats[s]; } diff --git a/pokemod/Object.h b/pokemod/Object.h index 038e448f..67bdab52 100644 --- a/pokemod/Object.h +++ b/pokemod/Object.h @@ -23,21 +23,21 @@ #ifndef __POKEMOD_OBJECT__ #define __POKEMOD_OBJECT__ -#include "../general/Exception.h" - class Pokemod; class Object { public: - Object(const Pokemod& par, const unsigned _id) : + Object(const QString& name, const Pokemod& par, const unsigned _id) : id(_id), + className(name), pokemod(par) { } virtual ~Object() { } + virtual void load(const QString& fname, const unsigned _id = UINT_MAX) throw(Exception) = 0; const Pokemod& getPokemod() const { @@ -58,10 +58,16 @@ class Object { return (id != UINT_MAX); } + + const QString& getClassName() const + { + return className; + } protected: - virtual bool validate() const; + virtual bool validate() const = 0; unsigned id; + const QString className; const Pokemod& pokemod; }; diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index 5e76ad79..9585bbdd 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -33,7 +33,7 @@ const QStringList Pokemod::ValidationStr = QStringList() << "Message" << "Warn" << "Error"; Pokemod::Pokemod(const QString& fname) : - Object(*this, 0), + Object("Pokemod", *this, 0), valOutput(NULL), title(""), version(""), @@ -933,9 +933,9 @@ unsigned Pokemod::maxCompatability(const Pokemod& p) const void Pokemod::validationMsg(const QString& msg, Validation val) const throw(Exception) { if (!valOutput) - throw(Exception("Pokemod", "valOutput isn\'t set")); + throw(Exception(className, "valOutput isn\'t set")); if (V_End < val) - throw(BoundsException("Pokemod", "val")); + throw(BoundsException(className, "val")); (*valOutput) << ValidationStr[val] << QDateTime::currentDateTime().toString(" (yyyyMMdd hh:mm:ss.zzz ddd): ") << msg; } @@ -967,16 +967,16 @@ void Pokemod::setDescription(const QString& d) void Pokemod::setStartMap(const unsigned s) throw(BoundsException) { if (getMapIndex(s) == UINT_MAX) - throw(BoundsException("Pokemod", "startMap")); + throw(BoundsException(className, "startMap")); startMap = s; } void Pokemod::setStartWarp(const unsigned s) throw(BoundsException) { if (getMapIndex(startMap) == UINT_MAX) - throw(BoundsException("Pokemod", "startMap")); + throw(BoundsException(className, "startMap")); if (getMapByID(startMap).getWarpIndex(s) == UINT_MAX) - throw(BoundsException("Pokemod", "startWarp")); + throw(BoundsException(className, "startWarp")); startWarp = s; } @@ -984,54 +984,54 @@ void Pokemod::setWalkSkin(const QString& fname) throw(Exception) { QFile file(QString("%1/image/skin/walk.png").arg(getPath())); if (file.exists() && !file.remove()) - throw(RemoveException("Pokemod", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/image/skin/walk.png").arg(getPath()))) - throw(SaveException("Pokemod", file.fileName())); + throw(SaveException(className, file.fileName())); } void Pokemod::setBikeSkin(const QString& fname) throw(Exception) { QFile file(QString("%1/image/skin/bike.png").arg(getPath())); if (file.exists() && !file.remove()) - throw(RemoveException("Pokemod", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/image/skin/bike.png").arg(getPath()))) - throw(SaveException("Pokemod", file.fileName())); + throw(SaveException(className, file.fileName())); } void Pokemod::setSurfSkin(const QString& fname) throw(Exception) { QFile file(QString("%1/image/skin/surf.png").arg(getPath())); if (file.exists() && !file.remove()) - throw(RemoveException("Pokemod", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/image/skin/surf.png").arg(getPath()))) - throw(SaveException("Pokemod", file.fileName())); + throw(SaveException(className, file.fileName())); } void Pokemod::setFlySkin(const QString& fname) throw(Exception) { QFile file(QString("%1/image/skin/fly.png").arg(getPath())); if (file.exists() && !file.remove()) - throw(RemoveException("Pokemod", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/image/skin/fly.png").arg(getPath()))) - throw(SaveException("Pokemod", file.fileName())); + throw(SaveException(className, file.fileName())); } void Pokemod::setFishSkin(const QString& fname) throw(Exception) { QFile file(QString("%1/image/skin/fish.png").arg(getPath())); if (file.exists() && !file.remove()) - throw(RemoveException("Pokemod", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/image/skin/fish.png").arg(getPath()))) - throw(SaveException("Pokemod", file.fileName())); + throw(SaveException(className, file.fileName())); } void Pokemod::setSurfFishSkin(const QString& fname) throw(Exception) { QFile file(QString("%1/image/skin/surfFish.png").arg(getPath())); if (file.exists() && !file.remove()) - throw(RemoveException("Pokemod", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/image/skin/surfFish.png").arg(getPath()))) - throw(SaveException("Pokemod", file.fileName())); + throw(SaveException(className, file.fileName())); } void Pokemod::setSuperPCUname(const QString& u) @@ -1132,14 +1132,14 @@ Rules& Pokemod::getRules() const Ability& Pokemod::getAbility(const unsigned i) const throw(IndexException) { if (getAbilityCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return abilities.at(i); } Ability& Pokemod::getAbility(const unsigned i) throw(IndexException) { if (getAbilityCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return abilities[i]; } @@ -1189,21 +1189,21 @@ Ability& Pokemod::newAbility(const Ability& a) void Pokemod::deleteAbility(const unsigned i) throw(IndexException) { if (getAbilityCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); abilities.removeAt(i); } const Author& Pokemod::getAuthor(const unsigned i) const throw(IndexException) { if (getAuthorCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return authors.at(i); } Author& Pokemod::getAuthor(const unsigned i) throw(IndexException) { if (getAuthorCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return authors[i]; } @@ -1253,21 +1253,21 @@ Author& Pokemod::newAuthor(const Author& a) void Pokemod::deleteAuthor(const unsigned i) throw(IndexException) { if (getAuthorCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); authors.removeAt(i); } const Badge& Pokemod::getBadge(const unsigned i) const throw(IndexException) { if (i < getBadgeCount()) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return badges.at(i); } Badge& Pokemod::getBadge(const unsigned i) throw(IndexException) { if (i < getBadgeCount()) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return badges[i]; } @@ -1317,21 +1317,21 @@ Badge& Pokemod::newBadge(const Badge& b) void Pokemod::deleteBadge(const unsigned i) throw(IndexException) { if (getBadgeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); badges.removeAt(i); } const CoinList& Pokemod::getCoinList(const unsigned i) const throw(IndexException) { if (getCoinListCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return coinLists.at(i); } CoinList& Pokemod::getCoinList(const unsigned i) throw(IndexException) { if (getCoinListCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return coinLists[i]; } @@ -1381,21 +1381,21 @@ CoinList& Pokemod::newCoinList(const CoinList& c) void Pokemod::deleteCoinList(const unsigned i) throw(IndexException) { if (getCoinListCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); coinLists.removeAt(i); } const Dialog& Pokemod::getDialog(const unsigned i) const throw(IndexException) { if (getDialogCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return dialogs.at(i); } Dialog& Pokemod::getDialog(const unsigned i) throw(IndexException) { if (getDialogCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return dialogs[i]; } @@ -1445,21 +1445,21 @@ Dialog& Pokemod::newDialog(const Dialog& d) void Pokemod::deleteDialog(const unsigned i) throw(IndexException) { if (getDialogCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); dialogs.removeAt(i); } const EggGroup& Pokemod::getEggGroup(const unsigned i) const throw(IndexException) { if (getEggGroupCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return eggGroups.at(i); } EggGroup& Pokemod::getEggGroup(const unsigned i) throw(IndexException) { if (getEggGroupCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return eggGroups[i]; } @@ -1509,21 +1509,21 @@ EggGroup& Pokemod::newEggGroup(const EggGroup& e) void Pokemod::deleteEggGroup(const unsigned i) throw(IndexException) { if (getEggGroupCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); eggGroups.removeAt(i); } const Item& Pokemod::getItem(const unsigned i) const throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return items.at(i); } Item& Pokemod::getItem(const unsigned i) throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return items[i]; } @@ -1573,21 +1573,21 @@ Item& Pokemod::newItem(const Item& i) void Pokemod::deleteItem(const unsigned i) throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); items.removeAt(i); } const ItemType& Pokemod::getItemType(const unsigned i) const throw(IndexException) { if (getItemTypeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return itemTypes.at(i); } ItemType& Pokemod::getItemType(const unsigned i) throw(IndexException) { if (getItemTypeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return itemTypes[i]; } @@ -1637,21 +1637,21 @@ ItemType& Pokemod::newItemType(const ItemType& i) void Pokemod::deleteItemType(const unsigned i) throw(IndexException) { if (getItemTypeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); itemTypes.removeAt(i); } const Map& Pokemod::getMap(const unsigned i) const throw(IndexException) { if (getMapCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return maps.at(i); } Map& Pokemod::getMap(const unsigned i) throw(IndexException) { if (getMapCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return maps[i]; } @@ -1701,21 +1701,21 @@ Map& Pokemod::newMap(const Map& m) void Pokemod::deleteMap(const unsigned i) throw(IndexException) { if (getMapCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); maps.removeAt(i); } const Move& Pokemod::getMove(const unsigned i) const throw(IndexException) { if (getMoveCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return moves.at(i); } Move& Pokemod::getMove(const unsigned i) throw(IndexException) { if (getMoveCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return moves[i]; } @@ -1765,21 +1765,21 @@ Move& Pokemod::newMove(const Move& m) void Pokemod::deleteMove(const unsigned i) throw(IndexException) { if (getMoveCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); moves.removeAt(i); } const Nature& Pokemod::getNature(const unsigned i) const throw(IndexException) { if (getNatureCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return natures.at(i); } Nature& Pokemod::getNature(const unsigned i) throw(IndexException) { if (getNatureCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return natures[i]; } @@ -1829,21 +1829,21 @@ Nature& Pokemod::newNature(const Nature& n) void Pokemod::deleteNature(const unsigned i) throw(IndexException) { if (getNatureCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); natures.removeAt(i); } const Species& Pokemod::getSpecies(const unsigned i) const throw(IndexException) { if (getSpeciesCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return species.at(i); } Species& Pokemod::getSpecies(const unsigned i) throw(IndexException) { if (getSpeciesCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return species[i]; } @@ -1893,21 +1893,21 @@ Species& Pokemod::newSpecies(const Species& s) void Pokemod::deleteSpecies(const unsigned i) throw(IndexException) { if (getSpeciesCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); species.removeAt(i); } const Store& Pokemod::getStore(const unsigned i) const throw(IndexException) { if (getStoreCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return stores.at(i); } Store& Pokemod::getStore(const unsigned i) throw(IndexException) { if (getStoreCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return stores[i]; } @@ -1957,21 +1957,21 @@ Store& Pokemod::newStore(const Store& s) void Pokemod::deleteStore(const unsigned i) throw(IndexException) { if (getStoreCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); stores.removeAt(i); } const Tile& Pokemod::getTile(const unsigned i) const throw(IndexException) { if (getTileCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return tiles.at(i); } Tile& Pokemod::getTile(const unsigned i) throw(IndexException) { if (getTileCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return tiles[i]; } @@ -2021,21 +2021,21 @@ Tile& Pokemod::newTile(const Tile& t) void Pokemod::deleteTile(const unsigned i) throw(IndexException) { if (getTileCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); tiles.removeAt(i); } const Time& Pokemod::getTime(const unsigned i) const throw(IndexException) { if (getTimeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return times.at(i); } Time& Pokemod::getTime(const unsigned i) throw(IndexException) { if (getTimeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return times[i]; } @@ -2085,21 +2085,21 @@ Time& Pokemod::newTime(const Time& t) void Pokemod::deleteTime(const unsigned i) throw(IndexException) { if (getTimeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); times.removeAt(i); } const Type& Pokemod::getType(const unsigned i) const throw(IndexException) { if (getTypeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return types.at(i); } Type& Pokemod::getType(const unsigned i) throw(IndexException) { if (getTypeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); return types[i]; } @@ -2158,7 +2158,7 @@ Type& Pokemod::newType(const Type& t) void Pokemod::deleteType(const unsigned i) throw(IndexException) { if (getTypeCount() <= i) - throw(IndexException("Pokemod")); + throw(IndexException(className)); typeChart.deleteCol(i); typeChart.deleteRow(i); } diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp index 3e82f599..48f885b5 100644 --- a/pokemod/Rules.cpp +++ b/pokemod/Rules.cpp @@ -26,7 +26,7 @@ const QStringList Rules::DVStr = QStringList() << "16" << "32"; Rules::Rules(const Pokemod& par) : - Object(par, 0), + Object("Rules", par, 0), genderAllowed(false), breedingAllowed(false), holdItems(0), @@ -56,13 +56,13 @@ Rules::Rules(const Pokemod& par) : } Rules::Rules(const Pokemod& par, const Rules& r) : - Object(par, 0) + Object("Rules", par, 0) { *this = r; } Rules::Rules(const Pokemod& par, const QString& fname) : - Object(par, 0) + Object("Rules", par, 0) { load(fname); } @@ -113,7 +113,7 @@ bool Rules::validate() const return valid; } -void Rules::load(const QString& fname) throw(Exception) +void Rules::load(const QString& fname, const unsigned _id) throw(Exception) { Ini ini(fname); unsigned i; @@ -189,7 +189,7 @@ void Rules::setGenderAllowed(const bool g) void Rules::setBreedingAllowed(const bool b) throw(Exception) { if (!genderAllowed) - throw(Exception("Rules", "cannot breed without genders")); + throw(Exception(className, "cannot breed without genders")); breedingAllowed = b; } @@ -226,28 +226,28 @@ void Rules::setBoxSize(const unsigned b) void Rules::setMaxParty(const unsigned m) throw(BoundsException) { if (!m) - throw(BoundsException("Rules", "maxParty")); + throw(BoundsException(className, "maxParty")); maxParty = m; } void Rules::setMaxFight(const unsigned m) throw(BoundsException) { if (maxParty < m) - throw(BoundsException("Rules", "maxFight")); + throw(BoundsException(className, "maxFight")); maxFight = m; } void Rules::setMaxMoves(const unsigned m) throw(BoundsException) { if (!m) - throw(BoundsException("Rules", "maxMoves")); + throw(BoundsException(className, "maxMoves")); maxMoves = m; } void Rules::setMaxLevel(const unsigned m) throw(BoundsException) { if (!m) - throw(BoundsException("Rules", "maxLevel")); + throw(BoundsException(className, "maxLevel")); maxLevel = m; } @@ -274,7 +274,7 @@ void Rules::setSpecialDVSplit(const bool s) void Rules::setMaxDVValue(const unsigned char m) throw(BoundsException) { if ((m != 16) && (m != 32)) - throw(BoundsException("Rules", "maxDVValue")); + throw(BoundsException(className, "maxDVValue")); maxDVValue = m; } @@ -306,16 +306,16 @@ void Rules::setEffortValuesAllowed(const bool e) void Rules::setMaxTotalEV(const unsigned m) throw(Exception) { if (!effortValuesAllowed) - throw(Exception("Rules", "no effort values")); + throw(Exception(className, "no effort values")); maxTotalEV = m; } void Rules::setMaxEVPerStat(const unsigned m) throw(Exception) { if (!effortValuesAllowed) - throw(Exception("Rules", "no effort values")); + throw(Exception(className, "no effort values")); if (maxTotalEV < m) - throw(BoundsException("Rules", "maxEVPerStat")); + throw(BoundsException(className, "maxEVPerStat")); maxEVPerStat = m; } diff --git a/pokemod/Rules.h b/pokemod/Rules.h index baeff901..3d0b764b 100644 --- a/pokemod/Rules.h +++ b/pokemod/Rules.h @@ -39,7 +39,7 @@ class Rules : public Object Rules(const Pokemod& par, const Rules& r); Rules(const Pokemod& par, const QString& fname); - void load(const QString& fname) throw(Exception); + void load(const QString& fname, const unsigned _id = 0) throw(Exception); void save() const throw(Exception); void setGenderAllowed(const bool g); diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp index f4b4b000..ca0af292 100644 --- a/pokemod/Species.cpp +++ b/pokemod/Species.cpp @@ -31,7 +31,7 @@ const QStringList Species::StyleStr = QStringList() << "Fluctuating" << "Fading" << "Slow" << "Normal" << "Fast" << "Erratic"; Species::Species(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Species", par, _id), name(""), growth(UINT_MAX), catchValue(0), @@ -55,13 +55,13 @@ Species::Species(const Pokemod& par, const unsigned _id) : } Species::Species(const Pokemod& par, const Species& s, const unsigned _id) : - Object(par, _id) + Object("Species", par, _id) { *this = s; } Species::Species(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Species", par, _id) { load(fname, _id); } @@ -461,25 +461,25 @@ void Species::setName(const QString& n) void Species::setBaseStat(const unsigned s, const unsigned b) throw(BoundsException) { if ((ST_End_RBY <= s) || ((s == ST_SpecialDefense) && !pokemod.getRules().getSpecialSplit())) - throw(BoundsException("Species", "stat")); + throw(BoundsException(className, "stat")); baseStats[s] = b; } void Species::setEffortValue(const unsigned s, const unsigned e) throw(Exception) { if (!pokemod.getRules().getEffortValuesAllowed()) - throw(Exception("Species", "effortValues not allowed")); + throw(Exception(className, "effortValues not allowed")); if (pokemod.getRules().getMaxEVPerStat() < e) - throw(BoundsException("Species", "effortValue")); + throw(BoundsException(className, "effortValue")); if ((ST_End_RBY <= s) || ((s == ST_SpecialDefense) && !pokemod.getRules().getSpecialSplit())) - throw(BoundsException("Species", "stat")); + throw(BoundsException(className, "stat")); effortValues[s] = e; } void Species::setGrowth(const unsigned g) throw(BoundsException) { if (End <= g) - throw(BoundsException("Species", "growth")); + throw(BoundsException(className, "growth")); growth = g; } @@ -541,7 +541,7 @@ void Species::setHeightFeet(const unsigned f) void Species::setHeightInches(const unsigned char i) throw(BoundsException) { if (12 <= i) - throw(BoundsException("Species", "heightInches")); + throw(BoundsException(className, "heightInches")); heightInches = i; } @@ -554,49 +554,49 @@ void Species::setFrontMaleSprite(const QString& fname) throw(Exception) { QFile file(QString("%1/species/%2/front%3.png").arg(pokemod.getPath()).arg(name).arg(pokemod.getRules().getGenderAllowed() ? "-male" : "")); if (file.exists() && !file.remove()) - throw(RemoveException("Species", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/species/%2/front%3.png").arg(pokemod.getPath()).arg(name).arg(pokemod.getRules().getGenderAllowed() ? "-male" : ""))) - throw(SaveException("Species", file.fileName())); + throw(SaveException(className, file.fileName())); } void Species::setBackMaleSprite(const QString& fname) throw(Exception) { QFile file(QString("%1/species/%2/back%3.png").arg(pokemod.getPath()).arg(name).arg(pokemod.getRules().getGenderAllowed() ? "-male" : "")); if (file.exists() && !file.remove()) - throw(RemoveException("Species", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/species/%2/back%3.png").arg(pokemod.getPath()).arg(name).arg(pokemod.getRules().getGenderAllowed() ? "-male" : ""))) - throw(SaveException("Species", file.fileName())); + throw(SaveException(className, file.fileName())); } void Species::setFrontFemaleSprite(const QString& fname) throw(Exception) { if (!pokemod.getRules().getGenderAllowed()) - throw(Exception("Species", "gender is not allowed")); + throw(Exception(className, "gender is not allowed")); QFile file(QString("%1/species/%2/front-female.png").arg(pokemod.getPath()).arg(name)); if (file.exists() && !file.remove()) - throw(RemoveException("Species", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/species/%2/front-female.png").arg(pokemod.getPath()).arg(name))) - throw(SaveException("Species", file.fileName())); + throw(SaveException(className, file.fileName())); } void Species::setBackFemaleSprite(const QString& fname) throw(Exception) { if (!pokemod.getRules().getGenderAllowed()) - throw(Exception("Species", "gender is not allowed")); + throw(Exception(className, "gender is not allowed")); QFile file(QString("%1/species/%2/back-female.png").arg(pokemod.getPath()).arg(name)); if (file.exists() && !file.remove()) - throw(RemoveException("Species", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/species/%2/back-female.png").arg(pokemod.getPath()).arg(name))) - throw(SaveException("Species", file.fileName())); + throw(SaveException(className, file.fileName())); } void Species::setListSprite(const QString& fname) throw(Exception) { QFile file(QString("%1/species/%2/list.png").arg(pokemod.getPath()).arg(name)); if (file.exists() && !file.remove()) - throw(RemoveException("Species", file.fileName())); + throw(RemoveException(className, file.fileName())); if (!QFile::copy(fname, QString("%1/species/%2/list.png").arg(pokemod.getPath()).arg(name))) - throw(SaveException("Species", file.fileName())); + throw(SaveException(className, file.fileName())); } void Species::setGenderFactor(const unsigned n, const unsigned d) throw(Exception) @@ -617,7 +617,7 @@ void Species::setGenderFactorDenom(const unsigned d) throw(Exception) void Species::setEggSpecies(const unsigned e) throw(BoundsException) { if (pokemod.getSpeciesIndex(e) == UINT_MAX) - throw(BoundsException("Species", "eggSpecies")); + throw(BoundsException(className, "eggSpecies")); eggSpecies = e; } @@ -634,38 +634,38 @@ void Species::setNidoranGroup(const unsigned n) void Species::setType(const unsigned ty, const bool t) throw(Exception) { if (pokemod.getTypeIndex(ty) == UINT_MAX) - throw(BoundsException("Species", "type")); + throw(BoundsException(className, "type")); for (QMutableListIterator<unsigned> i(types); i.hasNext(); ) { if (i.next() == ty) { if (t) - throw(Exception("Species", "type already used")); + throw(Exception(className, "type already used")); else i.remove(); } } if (!t) - throw(Exception("Species", "type wasn\'t being used anyway")); + throw(Exception(className, "type wasn\'t being used anyway")); types.append(ty); } void Species::setEggGroup(const unsigned eg, const bool e) throw(Exception) { if (pokemod.getEggGroupIndex(eg) == UINT_MAX) - throw(BoundsException("Species", "eggGroup")); + throw(BoundsException(className, "eggGroup")); for (QMutableListIterator<unsigned> i(eggGroups); i.hasNext(); ) { if (i.next() == eg) { if (e) - throw(Exception("Species", "egg group already used")); + throw(Exception(className, "egg group already used")); else i.remove(); } } if (!e) - throw(Exception("Species", "egg group wasn\'t being used anyway")); + throw(Exception(className, "egg group wasn\'t being used anyway")); eggGroups.append(eg); } @@ -677,14 +677,14 @@ QString Species::getName() const unsigned Species::getBaseStat(const unsigned s) const throw(BoundsException) { if ((ST_End_RBY <= s) || ((s == ST_SpecialDefense) && !pokemod.getRules().getSpecialSplit())) - throw(BoundsException("Species", "stat")); + throw(BoundsException(className, "stat")); return baseStats[s]; } unsigned Species::getEffortValue(const unsigned s) const throw(BoundsException) { if ((ST_End_RBY <= s) || ((s == ST_SpecialDefense) && !pokemod.getRules().getSpecialSplit())) - throw(BoundsException("Species", "stat")); + throw(BoundsException(className, "stat")); return effortValues[s]; } @@ -781,14 +781,14 @@ bool Species::getEggGroup(const unsigned eg) const const SpeciesAbility& Species::getAbility(const unsigned i) const throw(IndexException) { if (getAbilityCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); return abilities.at(i); } SpeciesAbility& Species::getAbility(const unsigned i) throw(IndexException) { if (getAbilityCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); return abilities[i]; } @@ -838,21 +838,21 @@ SpeciesAbility& Species::newAbility(const SpeciesAbility& a) void Species::deleteAbility(const unsigned i) throw(IndexException) { if (getAbilityCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); abilities.removeAt(i); } const SpeciesEvolution& Species::getEvolution(const unsigned i) const throw(IndexException) { if (getEvolutionCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); return evolutions.at(i); } SpeciesEvolution& Species::getEvolution(const unsigned i) throw(IndexException) { if (getEvolutionCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); return evolutions[i]; } @@ -902,21 +902,21 @@ SpeciesEvolution& Species::newEvolution(const SpeciesEvolution& e) void Species::deleteEvolution(const unsigned i) throw(IndexException) { if (getEvolutionCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); evolutions.removeAt(i); } const SpeciesItem& Species::getItem(const unsigned i) const throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); return items.at(i); } SpeciesItem& Species::getItem(const unsigned i) throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); return items[i]; } @@ -966,21 +966,21 @@ SpeciesItem& Species::newItem(const SpeciesItem& i) void Species::deleteItem(const unsigned i) throw(IndexException) { if (getItemCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); items.removeAt(i); } const SpeciesMove& Species::getMove(const unsigned i) const throw(IndexException) { if (getMoveCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); return moves.at(i); } SpeciesMove& Species::getMove(const unsigned i) throw(IndexException) { if (getMoveCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); return moves[i]; } @@ -1030,7 +1030,7 @@ SpeciesMove& Species::newMove(const SpeciesMove& m) void Species::deleteMove(const unsigned i) throw(IndexException) { if (getMoveCount() <= i) - throw(IndexException("Species")); + throw(IndexException(className)); moves.removeAt(i); } diff --git a/pokemod/SpeciesAbility.cpp b/pokemod/SpeciesAbility.cpp index 41e51c28..1021339f 100644 --- a/pokemod/SpeciesAbility.cpp +++ b/pokemod/SpeciesAbility.cpp @@ -24,20 +24,20 @@ #include "SpeciesAbility.h" SpeciesAbility::SpeciesAbility(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("SpeciesAbility", par, _id), ability(UINT_MAX), weight(1) { } SpeciesAbility::SpeciesAbility(const Pokemod& par, const SpeciesAbility& a, const unsigned _id) : - Object(par, _id) + Object("SpeciesAbility", par, _id) { *this = a; } SpeciesAbility::SpeciesAbility(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("SpeciesAbility", par, _id) { load(fname, _id); } @@ -82,14 +82,14 @@ void SpeciesAbility::save(const QString& species) const throw(Exception) void SpeciesAbility::setAbility(const unsigned a) throw(BoundsException) { if (pokemod.getAbilityIndex(a) == UINT_MAX) - throw(BoundsException("SpeciesAbility", "ability")); + throw(BoundsException(className, "ability")); ability = a; } void SpeciesAbility::setWeight(const unsigned w) throw(BoundsException) { if (!w) - throw(BoundsException("SpeciesAbility", "weight")); + throw(BoundsException(className, "weight")); weight = w; } diff --git a/pokemod/SpeciesEvolution.cpp b/pokemod/SpeciesEvolution.cpp index 6ed220c9..530a93fa 100644 --- a/pokemod/SpeciesEvolution.cpp +++ b/pokemod/SpeciesEvolution.cpp @@ -30,7 +30,7 @@ const QStringList SpeciesEvolution::StyleStr = QStringList() << "Level" << "Happ const QStringList SpeciesEvolution::GiveHoldStr = QStringList() <<"Give" << "Hold"; SpeciesEvolution::SpeciesEvolution(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("SpeciesEvolution", par, _id), species(UINT_MAX), style(UINT_MAX), val1(UINT_MAX), @@ -41,13 +41,13 @@ SpeciesEvolution::SpeciesEvolution(const Pokemod& par, const unsigned _id) : } SpeciesEvolution::SpeciesEvolution(const Pokemod& par, const SpeciesEvolution& e, const unsigned _id) : - Object(par, _id) + Object("SpeciesEvolution", par, _id) { *this = e; } SpeciesEvolution::SpeciesEvolution(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("SpeciesEvolution", par, _id) { load(fname, _id); } @@ -161,14 +161,14 @@ void SpeciesEvolution::save(const QString& species) const throw(Exception) void SpeciesEvolution::setSpecies(const unsigned s) throw(BoundsException) { if (pokemod.getSpeciesIndex(s) == UINT_MAX) - throw(BoundsException("SpeciesEvolution", "species")); + throw(BoundsException(className, "species")); species = s; } void SpeciesEvolution::setStyle(const unsigned s) throw(BoundsException) { if (S_End <= s) - throw(BoundsException("SpeciesEvolution", "style")); + throw(BoundsException(className, "style")); style = s; } @@ -182,22 +182,22 @@ void SpeciesEvolution::setVal1(const unsigned v1) throw(Exception) case S_Stat: case S_Personality: if (REL_End <= v1) - throw(BoundsException("SpeciesEvolution", "val1")); + throw(BoundsException(className, "val1")); break; case S_Item: case S_TradeItem: if (pokemod.getItemIndex(val1) == UINT_MAX) - throw(BoundsException("SpeciesEvolution", "val1")); + throw(BoundsException(className, "val1")); for (unsigned i = 0; (i < pokemod.getItemByID(val1).getEffectCount()) && !ok; ++i) { if (pokemod.getItemByID(val1).getEffect(i).getEffect() == ItemEffect::E_Evolution) ok = true; } if (!ok) - throw(BoundsException("SpeciesEvolution", "val1")); + throw(BoundsException(className, "val1")); break; default: - throw(UnusedException("SpeciesEvolution", "val1")); + throw(UnusedException(className, "val1")); break; } val1 = v1; @@ -212,10 +212,10 @@ void SpeciesEvolution::setVal2(const unsigned v2) throw(Exception) break; case S_Item: if ((G_End <= val2) || ((val2 == G_Hold) && !pokemod.getRules().getHoldItems())) - throw(BoundsException("SpeciesEvolution", "val2")); + throw(BoundsException(className, "val2")); break; default: - throw(UnusedException("SpeciesEvolution", "val2")); + throw(UnusedException(className, "val2")); break; } val2 = v2; @@ -227,10 +227,10 @@ void SpeciesEvolution::setVal3(const unsigned v3) throw(Exception) { case S_Stat: if ((pokemod.getRules().getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= v3) - throw(BoundsException("SpeciesEvolution", "val3")); + throw(BoundsException(className, "val3")); break; default: - throw(UnusedException("SpeciesEvolution", "val3")); + throw(UnusedException(className, "val3")); break; } val3 = v3; @@ -239,7 +239,7 @@ void SpeciesEvolution::setVal3(const unsigned v3) throw(Exception) void SpeciesEvolution::setLevel(const unsigned l) throw(BoundsException) { if (pokemod.getRules().getMaxLevel() < l) - throw(BoundsException("SpeciesEvolution", "level")); + throw(BoundsException(className, "level")); level = l; } diff --git a/pokemod/SpeciesItem.cpp b/pokemod/SpeciesItem.cpp index 61b8abca..0d2429a8 100644 --- a/pokemod/SpeciesItem.cpp +++ b/pokemod/SpeciesItem.cpp @@ -24,20 +24,20 @@ #include "SpeciesItem.h" SpeciesItem::SpeciesItem(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("SpeciesItem", par, _id), item(UINT_MAX), weight(1) { } SpeciesItem::SpeciesItem(const Pokemod& par, const SpeciesItem& i, const unsigned _id) : - Object(par, _id) + Object("SpeciesItem", par, _id) { *this = i; } SpeciesItem::SpeciesItem(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("SpeciesItem", par, _id) { load(fname, _id); } @@ -82,14 +82,14 @@ void SpeciesItem::save(const QString& species) const throw(Exception) void SpeciesItem::setItem(const unsigned i) throw(BoundsException) { if (pokemod.getItemIndex(i) == UINT_MAX) - throw(BoundsException("SpeciesItem", "item")); + throw(BoundsException(className, "item")); item = i; } void SpeciesItem::setWeight(const unsigned w) throw(BoundsException) { if (!w) - throw(BoundsException("SpeciesItem", "weight")); + throw(BoundsException(className, "weight")); weight = w; } diff --git a/pokemod/SpeciesMove.cpp b/pokemod/SpeciesMove.cpp index aad8efad..2d13f011 100644 --- a/pokemod/SpeciesMove.cpp +++ b/pokemod/SpeciesMove.cpp @@ -24,7 +24,7 @@ #include "SpeciesMove.h" SpeciesMove::SpeciesMove(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("SpeciesMove", par, _id), move(UINT_MAX), level(0), wild(0) @@ -32,13 +32,13 @@ SpeciesMove::SpeciesMove(const Pokemod& par, const unsigned _id) : } SpeciesMove::SpeciesMove(const Pokemod& par, const SpeciesMove& m, const unsigned _id) : - Object(par, _id) + Object("SpeciesMove", par, _id) { *this = m; } SpeciesMove::SpeciesMove(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("SpeciesMove", par, _id) { load(fname, _id); } @@ -90,21 +90,21 @@ void SpeciesMove::save(const QString& species) const throw(Exception) void SpeciesMove::setMove(const unsigned m) throw(BoundsException) { if (pokemod.getMoveIndex(m) == UINT_MAX) - throw(BoundsException("SpeciesMove", "move")); + throw(BoundsException(className, "move")); move = m; } void SpeciesMove::setLevel(const unsigned l) throw(BoundsException) { if (pokemod.getRules().getMaxLevel() <= l) - throw(BoundsException("SpeciesMove", "level")); + throw(BoundsException(className, "level")); level = l; } void SpeciesMove::setWild(const unsigned w) throw(BoundsException) { if (pokemod.getRules().getMaxLevel() <= w) - throw(BoundsException("SpeciesMove", "wild")); + throw(BoundsException(className, "wild")); wild = w; } diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp index 1b5333d4..0559ba25 100644 --- a/pokemod/Store.cpp +++ b/pokemod/Store.cpp @@ -27,19 +27,19 @@ #include "Store.h" Store::Store(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Store", par, _id), name("") { } Store::Store(const Pokemod& par, const Store& s, const unsigned _id) : - Object(par, _id) + Object("Store", par, _id) { *this = s; } Store::Store(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Store", par, _id) { load(fname, _id); } @@ -118,19 +118,19 @@ void Store::setName(const QString& n) void Store::setItem(const unsigned itm, const bool it) throw(Exception) { if (pokemod.getItemIndex(itm) == UINT_MAX) - throw(BoundsException("Store", "item")); + throw(BoundsException(className, "item")); for (QMutableListIterator<unsigned> i(items); i.hasNext(); ) { if (i.next() == itm) { if (it) - throw(Exception("Store", "item already used")); + throw(Exception(className, "item already used")); else i.remove(); } } if (!it) - throw(Exception("Store", "item wasn\'t being used anyway")); + throw(Exception(className, "item wasn\'t being used anyway")); items.append(itm); } diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp index b2c6487e..5cc74075 100644 --- a/pokemod/Tile.cpp +++ b/pokemod/Tile.cpp @@ -27,7 +27,7 @@ const QStringList Tile::ForceStr = QStringList() << "None" << "Slip" << "Stop" << "Force" << "Push"; Tile::Tile(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Tile", par, _id), name(""), pic(""), wildChance(1, 1), @@ -41,13 +41,13 @@ Tile::Tile(const Pokemod& par, const unsigned _id) : } Tile::Tile(const Pokemod& par, const Tile& t, const unsigned _id) : - Object(par, _id) + Object("Tile", par, _id) { *this = t; } Tile::Tile(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id), + Object("Tile", par, _id), pic("") { load(fname, _id); @@ -154,14 +154,14 @@ void Tile::setName(const QString& n) void Tile::setPic(const QString& p) throw(OpenException) { if (!QFile::exists(QString("%1/image/tile/%2.png").arg(pokemod.getPath()).arg(p))) - throw(OpenException("Tile", QString("%1/image/tile/%2.png").arg(pokemod.getPath()).arg(p))); + throw(OpenException(className, QString("%1/image/tile/%2.png").arg(pokemod.getPath()).arg(p))); pic = p; } void Tile::setFrom(const unsigned d, const bool f) throw(BoundsException) { if (D_End <= d) - throw(BoundsException("Tile", "direction")); + throw(BoundsException(className, "direction")); from[d] = f; } @@ -183,7 +183,7 @@ void Tile::setWildChanceDenominator(const unsigned d) throw(Exception) void Tile::setHMType(const unsigned h) throw(BoundsException) { if (HM_End <= h) - throw(BoundsException("Tile", "hmType")); + throw(BoundsException(className, "hmType")); hmType = h; under = UINT_MAX; } @@ -191,25 +191,25 @@ void Tile::setHMType(const unsigned h) throw(BoundsException) void Tile::setUnder(const unsigned u) throw(Exception) { if ((hmType != HM_Whirlpool) || (hmType != HM_Cut) || (hmType != HM_RockSmash)) - throw(UnusedException("Tile", "under")); + throw(UnusedException(className, "under")); if ((u == id) || (pokemod.getTileIndex(u) == UINT_MAX)) - throw(BoundsException("Tile", "under")); + throw(BoundsException(className, "under")); under = u; } void Tile::setForceType(const unsigned f) throw(BoundsException) { if (End <= f) - throw(BoundsException("Tile", "forceType")); + throw(BoundsException(className, "forceType")); forceType = f; } void Tile::setForceDirection(const unsigned f) throw(Exception) { if ((forceType == None) || (forceType == Stop)) - throw(UnusedException("Tile", "forceDirection")); + throw(UnusedException(className, "forceDirection")); if (D_End <= f) - throw(BoundsException("Tile", "forceDirection")); + throw(BoundsException(className, "forceDirection")); forceDirection = f; } @@ -226,7 +226,7 @@ QString Tile::getPic() const bool Tile::getFrom(const unsigned d) const throw(BoundsException) { if (D_End <= d) - throw(BoundsException("Tile", "direction")); + throw(BoundsException(className, "direction")); return from[d]; } diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp index b8e3215d..caf78a63 100644 --- a/pokemod/Time.cpp +++ b/pokemod/Time.cpp @@ -24,7 +24,7 @@ #include "Time.h" Time::Time(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Time", par, _id), name(""), startHour(0), startMinute(0) @@ -32,13 +32,13 @@ Time::Time(const Pokemod& par, const unsigned _id) : } Time::Time(const Pokemod& par, const Time& t, const unsigned _id) : - Object(par, _id) + Object("Time", par, _id) { *this = t; } Time::Time(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Time", par, _id) { load(fname, _id); } @@ -95,14 +95,14 @@ void Time::setName(const QString& n) void Time::setStartHour(const unsigned h) throw(BoundsException) { if (24 <= h) - throw(BoundsException("Time", "startHour")); + throw(BoundsException(className, "startHour")); startHour = h; } void Time::setStartMinute(const unsigned m) throw(BoundsException) { if (60 <= m) - throw(BoundsException("Time", "startMinute")); + throw(BoundsException(className, "startMinute")); startMinute = m; } diff --git a/pokemod/Type.cpp b/pokemod/Type.cpp index c2c268cd..f447c756 100644 --- a/pokemod/Type.cpp +++ b/pokemod/Type.cpp @@ -24,20 +24,20 @@ #include "Type.h" Type::Type(const Pokemod& par, const unsigned _id) : - Object(par, _id), + Object("Type", par, _id), name(""), stab(1, 1, true) { } Type::Type(const Pokemod& par, const Type& t, const unsigned _id) : - Object(par, _id) + Object("Type", par, _id) { *this = t; } Type::Type(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) + Object("Type", par, _id) { load(fname, _id); } diff --git a/pokemod/pokemod.pro b/pokemod/pokemod.pro index 0d927da4..fb942c1c 100644 --- a/pokemod/pokemod.pro +++ b/pokemod/pokemod.pro @@ -1,5 +1,6 @@ OBJECTS_DIR = ../../obj/pokemod DESTDIR = ../../lib +LANGUAGE = C++ TEMPLATE = lib LIBS += -L../../lib -lgeneral diff --git a/pokemodr/PokeModTreeItem.h b/pokemodr/PokeModTreeItem.h new file mode 100644 index 00000000..58d20b2f --- /dev/null +++ b/pokemodr/PokeModTreeItem.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokegen/PokeModTreeItem.h +// Purpose: Subclass of QTreeItem that allows information to be tacked on as wel +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Jan 22 19:12:17 2008 +// Copyright: ©2007-2008 Ben Boeckel and 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 +// MERCHANTABILITY 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/>. +///////////////////////////////////////////////////////////////////////////// + +#ifndef __POKEMODR_POKEMODTREEITEM__ +#define __POKEMODR_POKEMODTREEITEM__ + +#include <ktreewidgetitem.h> +#include "../pokemod/Object.h" + +class PokeModTreeItem : public QTreeWidgetItem +{ + public: + PokeModTreeItem(); + + + private: + Object +}; + +#endif diff --git a/pokemodr/PokeModr.cpp b/pokemodr/PokeModr.cpp new file mode 100644 index 00000000..85d8ef8d --- /dev/null +++ b/pokemodr/PokeModr.cpp @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokemodr/PokeModr.cpp +// Purpose: Main function for PokéModr +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Jan 22 14:51:38 2008 +// Copyright: ©2007-2008 Ben Boeckel and 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 +// MERCHANTABILITY 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 <kaboutdata.h> +#include <kapplication.h> +#include <kcmdlineargs.h> +#include <kconfig.h> +#include <kconfiggroup.h> +#include "../general/BugCatcher.h" +#include "PokeModrUI.h" +#include "PokeModr.h" + +int main(int argc, char* argv[]) +{ + KApplication app; + + KAboutData about("pokemodr", "pokemodr", ki18n("PokéModr"), VERSION_STRING, ki18n(""), KAboutData::License_Unknown, ki18n("©2007-2008 Ben Boeckel and Nerdy Productions"), ki18n("This program allows for an easy interface so that PokéMods can be easily created."), "http://sourceforge.net/projects/pokegen"); + about.setLicenseTextFile("LICENSE"); + about.setProgramName(ki18n("PokéModr")); + about.addAuthor(ki18n("Ben Boeckel"), ki18n("Lead Programmer"), "MathStuf@gmail.com", "http://nerdyproductions.sobertillnoon.com"); + about.addCredit(ki18n("Peter Fernandes"), ki18n("Ideas"), "supersonicandtails@gmail.com", "http://www.hypersonicsoft.org"); + about.addCredit(ki18n("Kevin Kofler"), ki18n("Qt, KDE, debugging help"), "kevin.kofler@chello.at", "http://www.tigen.org/kevin.kofler"); + + KCmdLineArgs::init(argc, argv, &about); + + BugCatcher::setAbout(&about); + + KConfig cfg("~/.kde/share/config/pokegenrc"); + + PokeModrUI mainWindow(cfg.group("pokemodr"), cfg.group("pokemodr-recent")); + + return app.exec(); +} diff --git a/pokemodr/PokeModr.h b/pokemodr/PokeModr.h index 9259056f..44076f61 100644 --- a/pokemodr/PokeModr.h +++ b/pokemodr/PokeModr.h @@ -23,6 +23,8 @@ #ifndef __POKEMODR_MAIN__ #define __POKEMODR_MAIN__ +#define VERSION_STRING "0.0.1" +int main(int argc, char* argv[]); #endif diff --git a/pokemodr/PokeModrUI.h b/pokemodr/PokeModrUI.h new file mode 100644 index 00000000..29916215 --- /dev/null +++ b/pokemodr/PokeModrUI.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokegen/PokeModrUI.h +// Purpose: Main window handling +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Jan 22 19:12:17 2008 +// Copyright: ©2007-2008 Ben Boeckel and 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 +// MERCHANTABILITY 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/>. +///////////////////////////////////////////////////////////////////////////// + +#ifndef __POKEMODR_POKEMODRUI__ +#define __POKEMODR_POKEMODRUI__ + +#include <kconfiggroup.h> +#include <krecentfilesaction.h> +#include <QObject> +#include <QWidget> +#include "../general/Exception.h" +#include "../pokemod/Rules.h" +#include "gui/ui_pokemodr.h" + +class PokeModrUI : public QWidget, private Ui::formPokeModr +{ + Q_OBJECT + + public: + PokeModrUI(KConfigGroup cfg, KConfigGroup recent, QWidget* parent = 0); + public slots: + void on_actionNew_triggered(); + void on_actionOpen_triggered(); + void on_actionSave_triggered(); + void on_actionSaveAs_triggered(); + void on_actionSaveAll_triggered(); + void on_actionQuit_triggered(); + void on_actionCopy_triggered(); + void on_actionPaste_triggered(); + void on_actionPreferences_triggered(); + void on_splitter_splitterMoved(const int pos); + void on_treePokemod_clicked(const QTreeWidgetItem* item); + void on_treePokemod_customContextMenuRequested(const QPoint& pos); + private: + void setGui(); + + KRecentFilesAction recent; +}; + +#endif diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp index 9742fbe4..d5cf7e4c 100644 --- a/pokemodr/RulesUI.cpp +++ b/pokemodr/RulesUI.cpp @@ -24,8 +24,6 @@ #include "../general/BugCatcher.h" #include "RulesUI.h" -extern BugCatcher bugs; - RulesUI::RulesUI(Rules& r, QWidget* parent) : QWidget(parent), rules(r.getPokemod(), r), @@ -92,7 +90,7 @@ void RulesUI::on_varBreeding_toggled(const bool b) throw(Exception) } catch (Exception& e) { - bugs.report(e); + BugCatcher::report(e); setGui(); } } @@ -155,7 +153,7 @@ void RulesUI::on_varMaxMoves_valueChanged(const int m) throw(BoundsException) } catch (BoundsException& e) { - bugs.report(e); + BugCatcher::report(e); setGui(); } } @@ -168,7 +166,7 @@ void RulesUI::on_varMaxLevel_valueChanged(const int m) throw(BoundsException) } catch (BoundsException& e) { - bugs.report(e); + BugCatcher::report(e); setGui(); } } @@ -206,7 +204,7 @@ void RulesUI::on_varMaxDV_currentIndexChanged(const QString& m) throw(BoundsExce } catch (BoundsException& e) { - bugs.report(e); + BugCatcher::report(e); setGui(); } } @@ -258,7 +256,7 @@ void RulesUI::on_varPokerusNum_valueChanged(const int p) throw(Exception) } catch (Exception& e) { - bugs.report(e); + BugCatcher::report(e); setGui(); } } @@ -273,7 +271,7 @@ void RulesUI::on_varPokerusDenom_valueChanged(const int p) throw(Exception) } catch (Exception& e) { - bugs.report(e); + BugCatcher::report(e); setGui(); } } diff --git a/pokemodr/RulesUI.h b/pokemodr/RulesUI.h index 7f4ca5f9..df7aba10 100644 --- a/pokemodr/RulesUI.h +++ b/pokemodr/RulesUI.h @@ -27,7 +27,7 @@ #include <QWidget> #include "../general/Exception.h" #include "../pokemod/Rules.h" -#include "ui_rules.h" +#include "gui/ui_rules.h" class RulesUI : public QWidget, private Ui::formRules { diff --git a/pokemodr/gui/pokemodr.ui b/pokemodr/gui/pokemodr.ui new file mode 100644 index 00000000..e7d53cfd --- /dev/null +++ b/pokemodr/gui/pokemodr.ui @@ -0,0 +1,185 @@ +<ui version="4.0" > + <class>mainWindow</class> + <widget class="QMainWindow" name="mainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>774</width> + <height>561</height> + </rect> + </property> + <property name="windowTitle" > + <string>PokéModr</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QVBoxLayout" > + <item> + <widget class="QSplitter" name="splitter" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <widget class="QTreeWidget" name="treeWidget" > + <column> + <property name="text" > + <string>PokéMod Elements</string> + </property> + </column> + </widget> + <widget class="QAbstractScrollArea" native="1" name="formPanel" /> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>774</width> + <height>29</height> + </rect> + </property> + <widget class="QMenu" name="menuFile" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="actionNew" /> + <addaction name="actionOpen" /> + <addaction name="separator" /> + <addaction name="actionSave" /> + <addaction name="actionSaveAs" /> + <addaction name="actionSaveAll" /> + <addaction name="separator" /> + <addaction name="actionQuit" /> + </widget> + <widget class="QMenu" name="menuEdit" > + <property name="title" > + <string>&Edit</string> + </property> + <addaction name="actionCopy" /> + <addaction name="actionPaste" /> + <addaction name="separator" /> + <addaction name="actionPreferences" /> + </widget> + <addaction name="menuFile" /> + <addaction name="menuEdit" /> + </widget> + <action name="actionNew" > + <property name="text" > + <string>&New</string> + </property> + <property name="toolTip" > + <string>Create a new Pokémod</string> + </property> + <property name="shortcut" > + <string>Ctrl+N</string> + </property> + </action> + <action name="actionOpen" > + <property name="text" > + <string>&Open</string> + </property> + <property name="toolTip" > + <string>Open an existing PokéMod</string> + </property> + <property name="shortcut" > + <string>Ctrl+O</string> + </property> + </action> + <action name="actionSave" > + <property name="text" > + <string>&Save</string> + </property> + <property name="toolTip" > + <string>Save current PokéMod</string> + </property> + <property name="shortcut" > + <string>Ctrl+S</string> + </property> + </action> + <action name="actionSaveAs" > + <property name="text" > + <string>Save &As...</string> + </property> + <property name="toolTip" > + <string>Save the current PokéMod into a new file</string> + </property> + <property name="shortcut" > + <string>Ctrl+Shift+S</string> + </property> + </action> + <action name="actionSaveAll" > + <property name="text" > + <string>Save A&ll</string> + </property> + <property name="toolTip" > + <string>Save all opened PokéMods</string> + </property> + <property name="shortcut" > + <string>Ctrl+Alt+S</string> + </property> + </action> + <action name="actionPreferences" > + <property name="text" > + <string>Preferences...</string> + </property> + </action> + <action name="actionQuit" > + <property name="text" > + <string>&Quit</string> + </property> + <property name="toolTip" > + <string>Quit PokéModr</string> + </property> + <property name="shortcut" > + <string>Ctrl+Q</string> + </property> + </action> + <action name="actionCopy" > + <property name="text" > + <string>&Copy</string> + </property> + <property name="toolTip" > + <string>Copy the current object</string> + </property> + <property name="shortcut" > + <string>Ctrl+C</string> + </property> + </action> + <action name="actionPaste" > + <property name="text" > + <string>&Paste</string> + </property> + <property name="toolTip" > + <string>Paste an object</string> + </property> + <property name="shortcut" > + <string>Ctrl+V</string> + </property> + </action> + <action name="actionPreferences" > + <property name="text" > + <string>P&references...</string> + </property> + <property name="iconText" > + <string>Preferences</string> + </property> + <property name="toolTip" > + <string>Open the preferences</string> + </property> + <property name="shortcut" > + <string>Ctrl+P</string> + </property> + </action> + </widget> + <customwidgets> + <customwidget> + <class>QAbstractScrollArea</class> + <extends>QWidget</extends> + <header>qabstractscrollarea.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro index b2991a5c..97cdd45d 100644 --- a/pokemodr/pokemodr.pro +++ b/pokemodr/pokemodr.pro @@ -1,8 +1,11 @@ OBJECTS_DIR = ../../obj/pokemodr DESTDIR = ../../bin +UI_DIR = gui +MOC_DIR = gui +LANGUAGE = C++ TEMPLATE = app LIBS += -L/usr/lib64/kde4/devel -lkdecore -lkdeui -L../../lib -lgeneral -lpokemod - +INCLUDEPATH+= /usr/include/kde4 CONFIG += qt gui warn_on dll |
