summaryrefslogtreecommitdiffstats
path: root/pokemod/Pokemod.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-01-22 04:45:02 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-01-22 04:45:02 +0000
commitefa80ce427e40070e36e5ab86d2f6dbf4ad50648 (patch)
treef7443dd268aa82e1819d00c141d98395b7a4a5a7 /pokemod/Pokemod.cpp
parenta1fff27395d1930820e6c007fdedd8e9dc58f0b3 (diff)
downloadsigen-efa80ce427e40070e36e5ab86d2f6dbf4ad50648.tar.gz
sigen-efa80ce427e40070e36e5ab86d2f6dbf4ad50648.tar.xz
sigen-efa80ce427e40070e36e5ab86d2f6dbf4ad50648.zip
[FIX] Some linker errors in pokemod and general
[FIX] More enum char*[] to QStringList [FIX] Widgets in PokéModr gui [ADD] Rules GUI logic git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@39 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Pokemod.cpp')
-rw-r--r--pokemod/Pokemod.cpp154
1 files changed, 150 insertions, 4 deletions
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index ea8f7528..5e76ad79 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -24,14 +24,17 @@
#include <QListIterator>
#include <QMap>
#include <QMapIterator>
-#include <QStringList>
#include <QStringListIterator>
+#include <QTextStream>
+#include <QTime>
#include "../general/Ref.h"
#include "Pokemod.h"
+const QStringList Pokemod::ValidationStr = QStringList() << "Message" << "Warn" << "Error";
+
Pokemod::Pokemod(const QString& fname) :
Object(*this, 0),
- valstream(NULL),
+ valOutput(NULL),
title(""),
version(""),
description(""),
@@ -599,11 +602,130 @@ bool Pokemod::validate() const
return valid;
}
-QString Pokemod::getPath() const
+unsigned Pokemod::getNewAbilityId() const
{
- return path;
+ unsigned i = 0;
+ for (; (i < getAbilityCount()) && (getAbilityIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewAuthorId() const
+{
+ unsigned i = 0;
+ for (; (i < getAuthorCount()) && (getAuthorIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewBadgeId() const
+{
+ unsigned i = 0;
+ for (; (i < getBadgeCount()) && (getBadgeIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewCoinListId() const
+{
+ unsigned i = 0;
+ for (; (i < getCoinListCount()) && (getCoinListIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewDialogId() const
+{
+ unsigned i = 0;
+ for (; (i < getDialogCount()) && (getDialogIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewEggGroupId() const
+{
+ unsigned i = 0;
+ for (; (i < getEggGroupCount()) && (getEggGroupIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewItemId() const
+{
+ unsigned i = 0;
+ for (; (i < getItemCount()) && (getItemIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewItemTypeId() const
+{
+ unsigned i = 0;
+ for (; (i < getItemTypeCount()) && (getItemTypeIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewMapId() const
+{
+ unsigned i = 0;
+ for (; (i < getMapCount()) && (getMapIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewMoveId() const
+{
+ unsigned i = 0;
+ for (; (i < getMoveCount()) && (getMoveIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewNatureId() const
+{
+ unsigned i = 0;
+ for (; (i < getNatureCount()) && (getNatureIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
}
+unsigned Pokemod::getNewSpeciesId() const
+{
+ unsigned i = 0;
+ for (; (i < getSpeciesCount()) && (getSpeciesIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewStoreId() const
+{
+ unsigned i = 0;
+ for (; (i < getStoreCount()) && (getStoreIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+unsigned Pokemod::getNewTileId() const
+{
+ unsigned i = 0;
+ for (; (i < getTileCount()) && (getTileIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+unsigned Pokemod::getNewTimeId() const
+{
+ unsigned i = 0;
+ for (; (i < getTimeCount()) && (getTimeIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+unsigned Pokemod::getNewTypeId() const
+{
+ unsigned i = 0;
+ for (; (i < getTypeCount()) && (getTypeIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
void Pokemod::load(const QString& fname) throw(Exception)
{
Ini ini(fname);
@@ -798,11 +920,35 @@ void Pokemod::save() const throw(Exception)
i.next().save();
}
+QString Pokemod::getPath() const
+{
+ return path;
+}
+
unsigned Pokemod::maxCompatability(const Pokemod& p) const
{
// TODO (Ben #1#): MaxCompatability between two versions
}
+void Pokemod::validationMsg(const QString& msg, Validation val) const throw(Exception)
+{
+ if (!valOutput)
+ throw(Exception("Pokemod", "valOutput isn\'t set"));
+ if (V_End < val)
+ throw(BoundsException("Pokemod", "val"));
+ (*valOutput) << ValidationStr[val] << QDateTime::currentDateTime().toString(" (yyyyMMdd hh:mm:ss.zzz ddd): ") << msg;
+}
+
+void Pokemod::setValOutput(QStringList& s)
+{
+ valOutput = &s;
+}
+
+void Pokemod::unsetValOutput()
+{
+ valOutput = NULL;
+}
+
void Pokemod::setTitle(const QString& t)
{
title = t;