summaryrefslogtreecommitdiffstats
path: root/pokemod
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-06-30 01:37:51 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-06-30 01:37:51 +0000
commita423cf3db8fa90cc09d2f92ff892e4fcdda4af16 (patch)
tree174b821adc5e089a313657499e0df740d7184fca /pokemod
parent300e44b68e075d7fd78287e10262b0d502f4898d (diff)
downloadsigen-a423cf3db8fa90cc09d2f92ff892e4fcdda4af16.tar.gz
sigen-a423cf3db8fa90cc09d2f92ff892e4fcdda4af16.tar.xz
sigen-a423cf3db8fa90cc09d2f92ff892e4fcdda4af16.zip
[FIX] Replaced Point with QPoint (less duplicate code)
[FIX] Fraction and Point widgets are more compact [FIX] Fleshed out more of the TeamMember [FIX] Map tilemap editor now expands to fill all available area [FIX] Added priority values to abilities and moves [FIX] Added option for ATB-like battle rounds git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@217 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod')
-rw-r--r--pokemod/Ability.cpp14
-rw-r--r--pokemod/Ability.h3
-rw-r--r--pokemod/CMakeLists.txt1
-rw-r--r--pokemod/Hat.h11
-rw-r--r--pokemod/Macros.h10
-rw-r--r--pokemod/Map.cpp2
-rw-r--r--pokemod/Map.h2
-rw-r--r--pokemod/MapEffect.cpp8
-rw-r--r--pokemod/MapEffect.h8
-rw-r--r--pokemod/MapTrainer.cpp8
-rw-r--r--pokemod/MapTrainer.h8
-rw-r--r--pokemod/MapWarp.cpp8
-rw-r--r--pokemod/MapWarp.h10
-rw-r--r--pokemod/Matrix.h16
-rw-r--r--pokemod/Move.cpp15
-rw-r--r--pokemod/Move.h1
-rw-r--r--pokemod/Nature.cpp10
-rw-r--r--pokemod/Nature.h2
-rw-r--r--pokemod/Point.h104
-rw-r--r--pokemod/Pokemod.h1
-rw-r--r--pokemod/Rules.cpp14
-rw-r--r--pokemod/Rules.h3
22 files changed, 101 insertions, 158 deletions
diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp
index 0d536765..385dd572 100644
--- a/pokemod/Ability.cpp
+++ b/pokemod/Ability.cpp
@@ -31,6 +31,7 @@ Pokemod::Ability::Ability(const Ability& ability) :
Pokemod::Ability::Ability(const Pokemod* parent, const int id) :
Object("Ability", parent, id),
m_name(""),
+ m_priority(0),
m_description(""),
m_script("", "")
{
@@ -65,6 +66,7 @@ void Pokemod::Ability::load(const QDomElement& xml)
{
LOAD_BEGIN();
LOAD(QString, name);
+ LOAD(int, priority);
LOAD(QString, description);
LOAD(Script, script);
}
@@ -73,6 +75,7 @@ QDomElement Pokemod::Ability::save() const
{
SAVE_CREATE();
SAVE(QString, name);
+ SAVE(int, priority);
SAVE(QString, description);
SAVE(Script, script);
return xml;
@@ -83,6 +86,11 @@ void Pokemod::Ability::setName(const QString& name)
CHECK(name);
}
+void Pokemod::Ability::setPriority(const int priority)
+{
+ CHECK(priority);
+}
+
void Pokemod::Ability::setDescription(const QString& description)
{
CHECK(description);
@@ -98,6 +106,11 @@ QString Pokemod::Ability::name() const
return m_name;
}
+int Pokemod::Ability::priority() const
+{
+ return m_priority;
+}
+
QString Pokemod::Ability::description() const
{
return m_description;
@@ -113,6 +126,7 @@ Pokemod::Ability& Pokemod::Ability::operator=(const Ability& rhs)
if (this == &rhs)
return *this;
COPY(name);
+ COPY(priority);
COPY(description);
COPY(script);
return *this;
diff --git a/pokemod/Ability.h b/pokemod/Ability.h
index 9a2aa898..f050f6b8 100644
--- a/pokemod/Ability.h
+++ b/pokemod/Ability.h
@@ -44,16 +44,19 @@ class POKEMOD_EXPORT Ability : public Object
QDomElement save() const;
void setName(const QString& name);
+ void setPriority(const int priority);
void setDescription(const QString& description);
void setScript(const Script& script);
QString name() const;
+ int priority() const;
QString description() const;
Script script() const;
Ability& operator=(const Ability& rhs);
private:
QString m_name;
+ int m_priority;
QString m_description;
Script m_script;
};
diff --git a/pokemod/CMakeLists.txt b/pokemod/CMakeLists.txt
index bf06f867..83b9dd64 100644
--- a/pokemod/CMakeLists.txt
+++ b/pokemod/CMakeLists.txt
@@ -49,7 +49,6 @@ SET(pokemod_HEADERS
Hat.h
Macros.h
Matrix.h
- Point.h
Script.h
)
SET(pokemod_DEVEL
diff --git a/pokemod/Hat.h b/pokemod/Hat.h
index 005972d1..7edd4bbb 100644
--- a/pokemod/Hat.h
+++ b/pokemod/Hat.h
@@ -34,8 +34,8 @@ template<class T> class Hat
T pick() const;
T take();
- void setCount(const T& key, const unsigned weight);
- void add(const T& key, const unsigned weight);
+ void setCount(const T& key, const int weight);
+ void add(const T& key, const int weight);
unsigned count() const;
unsigned count(const T& key) const;
double chance(const T& key) const;
@@ -43,7 +43,7 @@ template<class T> class Hat
unsigned operator[](const T& key) const;
private:
QMap<T, unsigned> m_objects;
- unsigned m_count;
+ int m_count;
};
template<class T> inline Hat<T>::Hat() :
@@ -72,7 +72,7 @@ template<class T> inline T Hat<T>::take()
return chosen;
}
-template<class T> inline void Hat<T>::setCount(const T& key, const unsigned weight)
+template<class T> inline void Hat<T>::setCount(const T& key, const int weight)
{
if (m_objects.contains(key))
m_count -= m_objects[key];
@@ -85,7 +85,7 @@ template<class T> inline void Hat<T>::setCount(const T& key, const unsigned weig
m_objects.remove(key);
}
-template<class T> inline void Hat<T>::add(const T& key, const unsigned weight)
+template<class T> inline void Hat<T>::add(const T& key, const int weight)
{
m_objects[key] += weight;
m_count += weight;
@@ -112,6 +112,7 @@ template<class T> inline unsigned Hat<T>::operator[](const T& key) const
{
return count(key);
}
+
}
#endif
diff --git a/pokemod/Macros.h b/pokemod/Macros.h
index f28d34e9..d10f609a 100644
--- a/pokemod/Macros.h
+++ b/pokemod/Macros.h
@@ -21,9 +21,7 @@
// Qt includes
#include <QtCore/QBuffer>
-/**
- * @todo The macros should probably be replaced by protected static members of \a Pokemod::Object
- */
+// TODO: The macros should probably be replaced by protected static members of Object
#define LOAD_NODE(variable) xml.firstChildElement(variable)
#define LOAD_DATA(node) node.firstChild().toText().data()
@@ -38,7 +36,7 @@
#define LOAD_int(node) LOAD_DATA(node).toInt()
#define LOAD_QString LOAD_DATA
#define LOAD_Fraction(node) Fraction(node.attribute("numerator", "1").toInt(), node.attribute("denominator", "1").toInt())
-#define LOAD_Point(node) Point(node.attribute("x", "0").toInt(), node.attribute("y", "0").toInt())
+#define LOAD_QPoint(node) QPoint(node.attribute("x", "0").toInt(), node.attribute("y", "0").toInt())
// FIXME: QPixmap::fromData static member would be nice
#define LOAD_QPixmap(node) QPixmap::fromImage(QImage::fromData(QByteArray::fromBase64(LOAD_DATA(node).toUtf8())))
#define LOAD_QByteArray(node) QByteArray::fromBase64(LOAD_DATA(node).toUtf8())
@@ -114,8 +112,8 @@
Fraction frac_##variable = value; \
xml_##variable.setAttribute("numerator", frac_##variable.numerator()); \
xml_##variable.setAttribute("denominator", frac_##variable.denominator())
-#define SAVE_Point(variable, value) \
- Point point_##variable = value; \
+#define SAVE_QPoint(variable, value) \
+ QPoint point_##variable = value; \
xml_##variable.setAttribute("x", point_##variable.x()); \
xml_##variable.setAttribute("y", point_##variable.y())
#define SAVE_QPixmap(variable, value) \
diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp
index 93815983..7138db15 100644
--- a/pokemod/Map.cpp
+++ b/pokemod/Map.cpp
@@ -236,7 +236,7 @@ int Pokemod::Map::height() const
return m_tile.height();
}
-Pokemod::Point Pokemod::Map::size() const
+QPoint Pokemod::Map::size() const
{
return m_tile.size();
}
diff --git a/pokemod/Map.h b/pokemod/Map.h
index 2d6933c9..916e78d3 100644
--- a/pokemod/Map.h
+++ b/pokemod/Map.h
@@ -80,7 +80,7 @@ class POKEMOD_EXPORT Map : public Object
int tile(const int row, const int column) const;
int width() const;
int height() const;
- Point size() const;
+ QPoint size() const;
const MapEffect* effect(const int index) const;
MapEffect* effect(const int index);
diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp
index 2f333f2c..1d677140 100644
--- a/pokemod/MapEffect.cpp
+++ b/pokemod/MapEffect.cpp
@@ -66,7 +66,7 @@ void Pokemod::MapEffect::load(const QDomElement& xml)
{
LOAD_BEGIN();
LOAD(QString, name);
- LOAD(Point, coordinate);
+ LOAD(QPoint, coordinate);
LOAD(QPixmap, skin);
LOAD(bool, isGhost);
LOAD(Script, script);
@@ -76,7 +76,7 @@ QDomElement Pokemod::MapEffect::save() const
{
SAVE_CREATE();
SAVE(QString, name);
- SAVE(Point, coordinate);
+ SAVE(QPoint, coordinate);
SAVE(QPixmap, skin);
SAVE(bool, isGhost);
SAVE(Script, script);
@@ -88,7 +88,7 @@ void Pokemod::MapEffect::setName(const QString& name)
CHECK(name);
}
-void Pokemod::MapEffect::setCoordinate(const Point& coordinate)
+void Pokemod::MapEffect::setCoordinate(const QPoint& coordinate)
{
if ((static_cast<const Map*>(parent())->width() <= coordinate.x()) || (static_cast<const Map*>(parent())->height() <= coordinate.y()))
{
@@ -124,7 +124,7 @@ QString Pokemod::MapEffect::name() const
return m_name;
}
-Pokemod::Point Pokemod::MapEffect::coordinate() const
+QPoint Pokemod::MapEffect::coordinate() const
{
return m_coordinate;
}
diff --git a/pokemod/MapEffect.h b/pokemod/MapEffect.h
index d86bf3d1..3a3fa2cc 100644
--- a/pokemod/MapEffect.h
+++ b/pokemod/MapEffect.h
@@ -20,10 +20,10 @@
// Pokemod includes
#include "Object.h"
-#include "Point.h"
#include "Script.h"
// Qt includes
+#include <QtCore/QPoint>
#include <QtGui/QPixmap>
namespace Pokemod
@@ -47,13 +47,13 @@ class POKEMOD_EXPORT MapEffect : public Object
QDomElement save() const;
void setName(const QString& name);
- void setCoordinate(const Point& coordinate);
+ void setCoordinate(const QPoint& coordinate);
void setSkin(const QPixmap& skin);
void setIsGhost(const bool isGhost);
void setScript(const Script& script);
QString name() const;
- Point coordinate() const;
+ QPoint coordinate() const;
QPixmap skin() const;
bool isGhost() const;
Script script() const;
@@ -61,7 +61,7 @@ class POKEMOD_EXPORT MapEffect : public Object
MapEffect& operator=(const MapEffect& rhs);
private:
QString m_name;
- Point m_coordinate;
+ QPoint m_coordinate;
QPixmap m_skin;
bool m_isGhost;
Script m_script;
diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp
index 31507ec5..d16ab3c0 100644
--- a/pokemod/MapTrainer.cpp
+++ b/pokemod/MapTrainer.cpp
@@ -86,7 +86,7 @@ void Pokemod::MapTrainer::load(const QDomElement& xml)
LOAD_BEGIN();
LOAD(QString, name);
LOAD(int, trainerClass);
- LOAD(Point, coordinate);
+ LOAD(QPoint, coordinate);
LOAD(int, numberFight);
LOAD(Script, script);
LOAD_SUB(newTeamMember, MapTrainerTeamMember);
@@ -98,7 +98,7 @@ QDomElement Pokemod::MapTrainer::save() const
SAVE_CREATE();
SAVE(QString, name);
SAVE(int, trainerClass);
- SAVE(Point, coordinate);
+ SAVE(QPoint, coordinate);
SAVE(int, numberFight);
SAVE(Script, script);
SAVE_SUB(MapTrainerTeamMember, teamMembers);
@@ -120,7 +120,7 @@ void Pokemod::MapTrainer::setTrainerClass(const int trainerClass)
CHECK(trainerClass);
}
-void Pokemod::MapTrainer::setCoordinate(const Point& coordinate)
+void Pokemod::MapTrainer::setCoordinate(const QPoint& coordinate)
{
if ((static_cast<const Map*>(parent())->width() <= coordinate.x()) || (static_cast<const Map*>(parent())->height() <= coordinate.y()))
{
@@ -165,7 +165,7 @@ int Pokemod::MapTrainer::trainerClass() const
return m_trainerClass;
}
-Pokemod::Point Pokemod::MapTrainer::coordinate() const
+QPoint Pokemod::MapTrainer::coordinate() const
{
return m_coordinate;
}
diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h
index 23fd7927..f77d0a97 100644
--- a/pokemod/MapTrainer.h
+++ b/pokemod/MapTrainer.h
@@ -20,11 +20,11 @@
// Pokemod includes
#include "Object.h"
-#include "Point.h"
#include "Script.h"
// Qt includes
#include <QtCore/QList>
+#include <QtCore/QPoint>
namespace Pokemod
{
@@ -50,14 +50,14 @@ class POKEMOD_EXPORT MapTrainer : public Object
void setName(const QString& name);
void setTrainerClass(const int trainerClass);
- void setCoordinate(const Point& coordinate);
+ void setCoordinate(const QPoint& coordinate);
void setNumberFight(const int numberFight);
void setScript(const Script& script);
void setLeadTeamMember(const int leadTeamMember);
QString name() const;
int trainerClass() const;
- Point coordinate() const;
+ QPoint coordinate() const;
int numberFight() const;
Script script() const;
int leadTeamMember() const;
@@ -83,7 +83,7 @@ class POKEMOD_EXPORT MapTrainer : public Object
QString m_name;
int m_trainerClass;
- Point m_coordinate;
+ QPoint m_coordinate;
int m_numberFight;
Script m_script;
int m_leadTeamMember;
diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp
index 872fe894..b261228b 100644
--- a/pokemod/MapWarp.cpp
+++ b/pokemod/MapWarp.cpp
@@ -70,7 +70,7 @@ void Pokemod::MapWarp::load(const QDomElement& xml)
{
LOAD_BEGIN();
LOAD(QString, name);
- LOAD(Point, coordinate);
+ LOAD(QPoint, coordinate);
LOAD(int, type);
LOAD(int, toMap);
LOAD(int, toWarp);
@@ -81,7 +81,7 @@ QDomElement Pokemod::MapWarp::save() const
{
SAVE_CREATE();
SAVE(QString, name);
- SAVE(Point, coordinate);
+ SAVE(QPoint, coordinate);
SAVE(int, type);
SAVE(int, toMap);
SAVE(int, toWarp);
@@ -94,7 +94,7 @@ void Pokemod::MapWarp::setName(const QString& name)
CHECK(name);
}
-void Pokemod::MapWarp::setCoordinate(const Point& coordinate)
+void Pokemod::MapWarp::setCoordinate(const QPoint& coordinate)
{
if ((static_cast<const Map*>(parent())->width() <= coordinate.x()) || (static_cast<const Map*>(parent())->height() <= coordinate.y()))
{
@@ -149,7 +149,7 @@ QString Pokemod::MapWarp::name() const
return m_name;
}
-Pokemod::Point Pokemod::MapWarp::coordinate() const
+QPoint Pokemod::MapWarp::coordinate() const
{
return m_coordinate;
}
diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h
index 02d11dd2..e3f7fa63 100644
--- a/pokemod/MapWarp.h
+++ b/pokemod/MapWarp.h
@@ -20,9 +20,11 @@
// Pokemod includes
#include "Object.h"
-#include "Point.h"
#include "Script.h"
+// Qt includes
+#include <QtCore/QPoint>
+
namespace Pokemod
{
// Forward declarations
@@ -54,14 +56,14 @@ class POKEMOD_EXPORT MapWarp : public Object
QDomElement save() const;
void setName(const QString& name);
- void setCoordinate(const Point& coordinate);
+ void setCoordinate(const QPoint& coordinate);
void setType(const int type);
void setToMap(const int toMap);
void setToWarp(const int toWarp);
void setScript(const Script& script);
QString name() const;
- Point coordinate() const;
+ QPoint coordinate() const;
int type() const;
int toMap() const;
int toWarp() const;
@@ -70,7 +72,7 @@ class POKEMOD_EXPORT MapWarp : public Object
MapWarp& operator=(const MapWarp& rhs);
private:
QString m_name;
- Point m_coordinate;
+ QPoint m_coordinate;
int m_type;
int m_toMap;
int m_toWarp;
diff --git a/pokemod/Matrix.h b/pokemod/Matrix.h
index 77cf3595..e1961d2c 100644
--- a/pokemod/Matrix.h
+++ b/pokemod/Matrix.h
@@ -20,9 +20,9 @@
// Pokemod includes
#include "Global.h"
-#include "Point.h"
// Qt includes
+#include <QtCore/QPoint>
#include <QtCore/QVector>
namespace Pokemod
@@ -52,7 +52,7 @@ template<class T> class POKEMOD_EXPORT Matrix
int height() const;
int width() const;
- Point size() const;
+ QPoint size() const;
T& operator()(const int row, const int column);
T operator()(const int row, const int column) const;
@@ -79,7 +79,7 @@ template<class T> inline Matrix<T>::Matrix(const Matrix<T>& rhs)
template<class T> inline void Matrix<T>::addRow(const T& value)
{
- if (size() == Point(0, 0))
+ if (size() == QPoint(0, 0))
m_matrix.append(QVector<T>(1, value));
else
m_matrix.append(QVector<T>(width(), value));
@@ -87,7 +87,7 @@ template<class T> inline void Matrix<T>::addRow(const T& value)
template<class T> inline void Matrix<T>::addColumn(const T& value)
{
- if (size() == Point(0, 0))
+ if (size() == QPoint(0, 0))
m_matrix.append(QVector<T>(1, value));
else
{
@@ -98,7 +98,7 @@ template<class T> inline void Matrix<T>::addColumn(const T& value)
template<class T> inline void Matrix<T>::insertRow(const int row, const T& value)
{
- if (size() == Point(0, 0))
+ if (size() == QPoint(0, 0))
m_matrix.append(QVector<T>(1, value));
else
{
@@ -109,7 +109,7 @@ template<class T> inline void Matrix<T>::insertRow(const int row, const T& value
template<class T> inline void Matrix<T>::insertColumn(const int column, const T& value)
{
- if (size() == Point(0, 0))
+ if (size() == QPoint(0, 0))
m_matrix.append(QVector<T>(1, value));
else
{
@@ -200,9 +200,9 @@ template<class T> inline int Matrix<T>::width() const
return 0;
}
-template<class T> inline Point Matrix<T>::size() const
+template<class T> inline QPoint Matrix<T>::size() const
{
- return Point(height(), width());
+ return QPoint(height(), width());
}
template<class T> inline T& Matrix<T>::operator()(const int row, const int column)
diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp
index 5393e427..1b0422d9 100644
--- a/pokemod/Move.cpp
+++ b/pokemod/Move.cpp
@@ -40,7 +40,7 @@ Pokemod::Move::Move(const Pokemod* parent, const int id) :
m_special(false),
m_overworld(false),
m_powerPoints(0),
- m_priority(1),
+ m_priority(0),
m_description(""),
m_script("", "")
{
@@ -84,6 +84,7 @@ void Pokemod::Move::load(const QDomElement& xml)
LOAD(bool, special);
LOAD(bool, overworld);
LOAD(int, powerPoints);
+ LOAD(int, priority);
LOAD(QString, description);
LOAD(Script, script);
}
@@ -98,6 +99,7 @@ QDomElement Pokemod::Move::save() const
SAVE(bool, special);
SAVE(bool, overworld);
SAVE(int, powerPoints);
+ SAVE(int, priority);
SAVE(QString, description);
SAVE(Script, script);
return xml;
@@ -153,6 +155,11 @@ void Pokemod::Move::setPowerPoints(const int powerPoints)
CHECK(powerPoints);
}
+void Pokemod::Move::setPriority(const int priority)
+{
+ CHECK(priority);
+}
+
void Pokemod::Move::setDescription(const QString& description)
{
CHECK(description);
@@ -198,6 +205,11 @@ int Pokemod::Move::powerPoints() const
return m_powerPoints;
}
+int Pokemod::Move::priority() const
+{
+ return m_priority;
+}
+
QString Pokemod::Move::description() const
{
return m_description;
@@ -219,6 +231,7 @@ Pokemod::Move& Pokemod::Move::operator=(const Move& rhs)
COPY(special);
COPY(overworld);
COPY(powerPoints);
+ COPY(priority);
COPY(description);
COPY(script);
return *this;
diff --git a/pokemod/Move.h b/pokemod/Move.h
index fc55ae26..32ee6a18 100644
--- a/pokemod/Move.h
+++ b/pokemod/Move.h
@@ -51,6 +51,7 @@ class POKEMOD_EXPORT Move : public Object
void setSpecial(const bool special);
void setOverworld(const bool overworld);
void setPowerPoints(const int powerPoints);
+ void setPriority(const int priority);
void setDescription(const QString& description);
void setScript(const Script& script);
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index 3ae75b96..52e597b6 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -34,7 +34,7 @@ Pokemod::Nature::Nature(const Pokemod* parent, const int id) :
m_name(""),
m_weight(1)
{
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < (ST_End_GSC - ST_No_HP_Start); ++i)
m_stat[i].set(1, 1);
}
@@ -64,7 +64,7 @@ void Pokemod::Nature::load(const QDomElement& xml)
{
LOAD_BEGIN();
LOAD(QString, name);
- LOAD_ARRAY(Fraction, stat, ST_End_GSC);
+ LOAD_ARRAY(Fraction, stat, ST_End_GSC - ST_No_HP_Start);
LOAD(int, weight);
}
@@ -72,7 +72,7 @@ QDomElement Pokemod::Nature::save() const
{
SAVE_CREATE();
SAVE(QString, name);
- SAVE_ARRAY(Fraction, stat, ST_End_GSC);
+ SAVE_ARRAY(Fraction, stat, ST_End_GSC - ST_No_HP_Start);
SAVE(int, weight);
return xml;
}
@@ -84,7 +84,7 @@ void Pokemod::Nature::setName(const QString& name)
void Pokemod::Nature::setStat(const int stat, const Fraction& multiplier)
{
- if ((static_cast<const Pokemod*>(pokemod())->rules()->specialSplit() ? ST_End_GSC : ST_End_RBY) <= stat)
+ if ((stat < ST_No_HP_Start) || ((static_cast<const Pokemod*>(pokemod())->rules()->specialSplit() ? ST_End_GSC : ST_End_RBY) <= stat))
{
emit(error(bounds("stat")));
return;
@@ -127,7 +127,7 @@ Pokemod::Nature& Pokemod::Nature::operator=(const Nature& rhs)
if (this == &rhs)
return *this;
COPY(name);
- COPY_ARRAY(stat, ST_End_GSC);
+ COPY_ARRAY(stat, ST_End_GSC - ST_No_HP_Start);
COPY(weight);
return *this;
}
diff --git a/pokemod/Nature.h b/pokemod/Nature.h
index c1c6dbbd..228ccf31 100644
--- a/pokemod/Nature.h
+++ b/pokemod/Nature.h
@@ -53,7 +53,7 @@ class POKEMOD_EXPORT Nature : public Object
Nature& operator=(const Nature& rhs);
private:
QString m_name;
- Fraction m_stat[ST_End_GSC];
+ Fraction m_stat[ST_End_GSC - ST_No_HP_Start];
int m_weight;
};
}
diff --git a/pokemod/Point.h b/pokemod/Point.h
deleted file mode 100644
index f5b0c890..00000000
--- a/pokemod/Point.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com>
- *
- * 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 __POKEMOD_POINT__
-#define __POKEMOD_POINT__
-
-// Pokemod includes
-#include "Global.h"
-
-namespace Pokemod
-{
-class POKEMOD_EXPORT Point
-{
- public:
- Point(const int x = 0, const int y = 0);
- Point(const Point& rhs);
-
- void set(const int x, const int y);
- void setX(const int x);
- void setY(const int y);
-
- int x() const;
- int y() const;
-
- Point& operator=(const Point& rhs);
- bool operator==(const Point& rhs) const;
- bool operator!=(const Point& rhs) const;
- private:
- int m_x;
- int m_y;
-};
-
-inline Point::Point(const int x, const int y) :
- m_x(x),
- m_y(y)
-{
-}
-
-inline Point::Point(const Point& rhs)
-{
- *this = rhs;
-}
-
-inline void Point::set(const int x, const int y)
-{
- m_x = x;
- m_y = y;
-}
-
-inline void Point::setX(const int x)
-{
- m_x = x;
-}
-
-inline void Point::setY(const int y)
-{
- m_y = y;
-}
-
-inline int Point::x() const
-{
- return m_x;
-}
-
-inline int Point::y() const
-{
- return m_y;
-}
-
-inline Point::Point& Point::operator=(const Point& rhs)
-{
- if (this == &rhs)
- return *this;
- m_x = rhs.m_x;
- m_y = rhs.m_y;
- return *this;
-}
-
-inline bool Point::operator==(const Point& rhs) const
-{
- return ((m_x == rhs.m_x) && (m_y == rhs.m_y));
-}
-
-inline bool Point::operator!=(const Point& rhs) const
-{
- return !(*this == rhs);
-}
-}
-
-#endif
diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h
index 1cfebc69..76a858b3 100644
--- a/pokemod/Pokemod.h
+++ b/pokemod/Pokemod.h
@@ -22,7 +22,6 @@
#include "Fraction.h"
#include "Matrix.h"
#include "Object.h"
-#include "Point.h"
// Qt includes
#include <QtCore/QList>
diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp
index ded6a566..5e3a0b47 100644
--- a/pokemod/Rules.cpp
+++ b/pokemod/Rules.cpp
@@ -35,6 +35,7 @@ Pokemod::Rules::Rules(const Pokemod* parent) :
m_genderAllowed(false),
m_breedingAllowed(false),
m_criticalDomains(false),
+ m_useTurns(true),
m_numBoxes(0),
m_boxSize(1),
m_maxParty(1),
@@ -103,6 +104,7 @@ void Pokemod::Rules::load(const QDomElement& xml)
LOAD(bool, genderAllowed);
LOAD(bool, breedingAllowed);
LOAD(bool, criticalDomains);
+ LOAD(bool, useTurns);
LOAD(int, numBoxes);
LOAD(int, boxSize);
LOAD(int, maxParty);
@@ -135,6 +137,7 @@ QDomElement Pokemod::Rules::save() const
SAVE(bool, genderAllowed);
SAVE(bool, breedingAllowed);
SAVE(bool, criticalDomains);
+ SAVE(bool, useTurns);
SAVE(int, numBoxes);
SAVE(int, boxSize);
SAVE(int, maxParty);
@@ -182,6 +185,11 @@ void Pokemod::Rules::setCriticalDomains(const bool criticalDomains)
CHECK(criticalDomains);
}
+void Pokemod::Rules::setUseTurns(const bool useTurns)
+{
+ CHECK(useTurns);
+}
+
void Pokemod::Rules::setNumBoxes(const int numBoxes)
{
CHECK(numBoxes);
@@ -367,6 +375,11 @@ bool Pokemod::Rules::criticalDomains() const
return m_criticalDomains;
}
+bool Pokemod::Rules::useTurns() const
+{
+ return m_useTurns;
+}
+
int Pokemod::Rules::numBoxes() const
{
return m_numBoxes;
@@ -494,6 +507,7 @@ Pokemod::Rules& Pokemod::Rules::operator=(const Rules& rhs)
COPY(genderAllowed);
COPY(breedingAllowed);
COPY(criticalDomains);
+ COPY(useTurns);
COPY(numBoxes);
COPY(boxSize);
COPY(maxParty);
diff --git a/pokemod/Rules.h b/pokemod/Rules.h
index b2e5099b..77436003 100644
--- a/pokemod/Rules.h
+++ b/pokemod/Rules.h
@@ -47,6 +47,7 @@ class POKEMOD_EXPORT Rules : public Object
void setGenderAllowed(const bool genderAllowed);
void setBreedingAllowed(const bool breedingAllowed);
void setCriticalDomains(const bool criticalDomains);
+ void setUseTurns(const bool useTurns);
void setNumBoxes(const int numBoxes);
void setBoxSize(const int boxSize);
void setMaxParty(const int maxParty);
@@ -75,6 +76,7 @@ class POKEMOD_EXPORT Rules : public Object
bool genderAllowed() const;
bool breedingAllowed() const;
bool criticalDomains() const;
+ bool useTurns() const;
int numBoxes() const;
int boxSize() const;
int maxParty() const;
@@ -105,6 +107,7 @@ class POKEMOD_EXPORT Rules : public Object
bool m_genderAllowed;
bool m_breedingAllowed;
bool m_criticalDomains;
+ bool m_useTurns;
int m_numBoxes;
int m_boxSize;
int m_maxParty;