summaryrefslogtreecommitdiffstats
path: root/sigmod
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-10-17 05:46:40 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-10-17 05:46:40 +0000
commitb3e1495f7a626bb4429ff5e4f3ad39ae9654f23b (patch)
tree8a188df964484e7dcf630e792dccfa1766c2f8f0 /sigmod
parent47428274a07bce9be5e62f82aeeb7e57aa21037f (diff)
downloadsigen-b3e1495f7a626bb4429ff5e4f3ad39ae9654f23b.tar.gz
sigen-b3e1495f7a626bb4429ff5e4f3ad39ae9654f23b.tar.xz
sigen-b3e1495f7a626bb4429ff5e4f3ad39ae9654f23b.zip
[FIX] Moved Hat, Fraction, Matrix, and Script to sigcore
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@281 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigmod')
-rw-r--r--sigmod/Ability.cpp12
-rw-r--r--sigmod/Ability.h22
-rw-r--r--sigmod/Badge.cpp8
-rw-r--r--sigmod/Badge.h12
-rw-r--r--sigmod/CMakeLists.txt7
-rw-r--r--sigmod/CoinList.cpp4
-rw-r--r--sigmod/CoinList.h10
-rw-r--r--sigmod/Fraction.cpp177
-rw-r--r--sigmod/Fraction.h131
-rw-r--r--sigmod/GlobalScript.cpp4
-rw-r--r--sigmod/GlobalScript.h10
-rw-r--r--sigmod/Hat.h184
-rw-r--r--sigmod/Item.cpp4
-rw-r--r--sigmod/Item.h10
-rw-r--r--sigmod/Map.cpp4
-rw-r--r--sigmod/Map.h10
-rw-r--r--sigmod/MapEffect.cpp4
-rw-r--r--sigmod/MapEffect.h10
-rw-r--r--sigmod/MapTrainer.cpp4
-rw-r--r--sigmod/MapTrainer.h10
-rw-r--r--sigmod/MapWarp.cpp4
-rw-r--r--sigmod/MapWarp.h10
-rw-r--r--sigmod/Matrix.h348
-rw-r--r--sigmod/Move.cpp16
-rw-r--r--sigmod/Move.h30
-rw-r--r--sigmod/Nature.cpp6
-rw-r--r--sigmod/Nature.h12
-rw-r--r--sigmod/Object.h24
-rw-r--r--sigmod/Script.cpp68
-rw-r--r--sigmod/Script.h94
-rw-r--r--sigmod/Sigmod.cpp12
-rw-r--r--sigmod/Sigmod.h16
-rw-r--r--sigmod/Skin.cpp8
-rw-r--r--sigmod/Skin.h10
-rw-r--r--sigmod/Species.cpp20
-rw-r--r--sigmod/Species.h36
-rw-r--r--sigmod/Status.cpp9
-rw-r--r--sigmod/Status.h16
-rw-r--r--sigmod/Tile.cpp4
-rw-r--r--sigmod/Tile.h10
-rw-r--r--sigmod/Type.cpp4
-rw-r--r--sigmod/Type.h10
-rw-r--r--sigmod/Weather.cpp8
-rw-r--r--sigmod/Weather.h10
44 files changed, 228 insertions, 1194 deletions
diff --git a/sigmod/Ability.cpp b/sigmod/Ability.cpp
index 1296418f..5b4108c0 100644
--- a/sigmod/Ability.cpp
+++ b/sigmod/Ability.cpp
@@ -102,17 +102,17 @@ void Sigmod::Ability::setDescription(const QString& description)
CHECK(description);
}
-void Sigmod::Ability::setBattleScript(const Script& battleScript)
+void Sigmod::Ability::setBattleScript(const Sigcore::Script& battleScript)
{
CHECK(battleScript);
}
-void Sigmod::Ability::setWorldScript(const Script& worldScript)
+void Sigmod::Ability::setWorldScript(const Sigcore::Script& worldScript)
{
CHECK(worldScript);
}
-void Sigmod::Ability::setPriorityScript(const Script& priorityScript)
+void Sigmod::Ability::setPriorityScript(const Sigcore::Script& priorityScript)
{
CHECK(priorityScript);
}
@@ -132,17 +132,17 @@ QString Sigmod::Ability::description() const
return m_description;
}
-Sigmod::Script Sigmod::Ability::battleScript() const
+Sigcore::Script Sigmod::Ability::battleScript() const
{
return m_battleScript;
}
-Sigmod::Script Sigmod::Ability::worldScript() const
+Sigcore::Script Sigmod::Ability::worldScript() const
{
return m_worldScript;
}
-Sigmod::Script Sigmod::Ability::priorityScript() const
+Sigcore::Script Sigmod::Ability::priorityScript() const
{
return m_priorityScript;
}
diff --git a/sigmod/Ability.h b/sigmod/Ability.h
index 8eae68af..e9c84d7c 100644
--- a/sigmod/Ability.h
+++ b/sigmod/Ability.h
@@ -22,9 +22,11 @@
#ifndef SIGMOD_ABILITY
#define SIGMOD_ABILITY
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
namespace Sigmod
{
@@ -126,7 +128,7 @@ class SIGMOD_EXPORT Ability : public Object
*
* \param battleScript The script for the ability when in battle.
*/
- void setBattleScript(const Script& battleScript);
+ void setBattleScript(const Sigcore::Script& battleScript);
/**
* Set the script for the ability when on the world map. This script defines the behavior of the ability when on the world map.
* The following objects are available:
@@ -138,7 +140,7 @@ class SIGMOD_EXPORT Ability : public Object
*
* \param worldScript The script for the ability when on the world map.
*/
- void setWorldScript(const Script& worldScript);
+ void setWorldScript(const Sigcore::Script& worldScript);
/**
* Set the script that determines the priority of the ability. This script allows the ability to change its priority based on what
* is happening in the \link Sigbattle::Arena arena \endlink. The following objects are available:
@@ -153,7 +155,7 @@ class SIGMOD_EXPORT Ability : public Object
*
* \param priorityScript The script that determines the priority of the ability.
*/
- void setPriorityScript(const Script& priorityScript);
+ void setPriorityScript(const Sigcore::Script& priorityScript);
/**
* \sa setName
@@ -178,28 +180,28 @@ class SIGMOD_EXPORT Ability : public Object
*
* \return The script that controls the ability in battle.
*/
- Script battleScript() const;
+ Sigcore::Script battleScript() const;
/**
* \sa setWorldScript
*
* \return The script that controls the ability on the world map.
*/
- Script worldScript() const;
+ Sigcore::Script worldScript() const;
/**
* \sa setPriorityScript
*
* \return The script that changes the priority when necessary.
*/
- Script priorityScript() const;
+ Sigcore::Script priorityScript() const;
Ability& operator=(const Ability& rhs);
private:
QString m_name;
int m_priority;
QString m_description;
- Script m_battleScript;
- Script m_worldScript;
- Script m_priorityScript;
+ Sigcore::Script m_battleScript;
+ Sigcore::Script m_worldScript;
+ Sigcore::Script m_priorityScript;
};
}
diff --git a/sigmod/Badge.cpp b/sigmod/Badge.cpp
index 8a050520..d70833ca 100644
--- a/sigmod/Badge.cpp
+++ b/sigmod/Badge.cpp
@@ -126,7 +126,7 @@ void Sigmod::Badge::setObey(const int obey)
CHECK(obey);
}
-void Sigmod::Badge::setStat(const Stat stat, const Fraction& multiplier)
+void Sigmod::Badge::setStat(const Stat stat, const Sigcore::Fraction& multiplier)
{
if (multiplier < 1)
{
@@ -146,7 +146,7 @@ void Sigmod::Badge::setStat(const Stat stat, const Fraction& multiplier)
CHECK_ARRAY(stat[stat - ST_Attack], multiplier);
}
-void Sigmod::Badge::setStat(const Fraction& multiplier)
+void Sigmod::Badge::setStat(const Sigcore::Fraction& multiplier)
{
if (multiplier < 1)
emit(error(bounds("stat multiplier")));
@@ -172,7 +172,7 @@ int Sigmod::Badge::obey() const
return m_obey;
}
-Sigmod::Fraction Sigmod::Badge::stat(const Stat stat) const
+Sigcore::Fraction Sigmod::Badge::stat(const Stat stat) const
{
switch (stat)
{
@@ -182,7 +182,7 @@ Sigmod::Fraction Sigmod::Badge::stat(const Stat stat) const
return m_stat[stat - ST_Attack];
default:
emit(warning(bounds("stat")));
- return Fraction();
+ return Sigcore::Fraction();
}
}
diff --git a/sigmod/Badge.h b/sigmod/Badge.h
index e6a54ff0..509da0dd 100644
--- a/sigmod/Badge.h
+++ b/sigmod/Badge.h
@@ -22,8 +22,10 @@
#ifndef SIGMOD_BADGE
#define SIGMOD_BADGE
+// Sigcore includes
+#include "../sigcore/Fraction.h"
+
// Sigmod includes
-#include "Fraction.h"
#include "Object.h"
namespace Sigmod
@@ -122,7 +124,7 @@ class SIGMOD_EXPORT Badge : public Object
* \param stat The stat to set the multiplier for.
* \param multiplier The multiplier for the stat once the badge is obtained.
*/
- void setStat(const Stat stat, const Fraction& multiplier);
+ void setStat(const Stat stat, const Sigcore::Fraction& multiplier);
/**
* \sa setName
@@ -155,17 +157,17 @@ class SIGMOD_EXPORT Badge : public Object
*
* \return The multiplier for the \p stat.
*/
- Fraction stat(const Stat stat) const;
+ Sigcore::Fraction stat(const Stat stat) const;
Badge& operator=(const Badge& rhs);
private:
- void setStat(const Fraction& multiplier);
+ void setStat(const Sigcore::Fraction& multiplier);
QString m_name;
int m_face;
int m_badge;
int m_obey;
- QVarLengthArray<Fraction, ST_SpecialDefense - ST_Attack + 1> m_stat;
+ QVarLengthArray<Sigcore::Fraction, ST_SpecialDefense - ST_Attack + 1> m_stat;
};
}
diff --git a/sigmod/CMakeLists.txt b/sigmod/CMakeLists.txt
index 7663c0c9..1f60289d 100644
--- a/sigmod/CMakeLists.txt
+++ b/sigmod/CMakeLists.txt
@@ -11,10 +11,8 @@ SET(sigmod_HEADERS
CoinList.h
CoinListObject.h
EggGroup.h
- Fraction.h
Global.h
GlobalScript.h
- Hat.h
Item.h
ItemType.h
Macros.h
@@ -25,13 +23,11 @@ SET(sigmod_HEADERS
MapWarp.h
MapWildListEncounter.h
MapWildList.h
- Matrix.h
Move.h
Nature.h
Object.h
Rules.h
Sigmod.h
- Script.h
Skin.h
Sound.h
Species.h
@@ -54,7 +50,6 @@ SET(sigmod_SRCS
CoinList.cpp
CoinListObject.cpp
EggGroup.cpp
- Fraction.cpp
GlobalScript.cpp
Item.cpp
ItemType.cpp
@@ -69,7 +64,6 @@ SET(sigmod_SRCS
Nature.cpp
Object.cpp
Rules.cpp
- Script.cpp
Sigmod.cpp
Skin.cpp
Sound.cpp
@@ -100,6 +94,7 @@ SET_TARGET_PROPERTIES(sigmod
TARGET_LINK_LIBRARIES(sigmod
${QT_QTCORE_LIBRARY}
${QT_QTXML_LIBRARY}
+ sigcore
)
INCLUDE(../doxygen.cmake)
diff --git a/sigmod/CoinList.cpp b/sigmod/CoinList.cpp
index f37c0627..a36ebeb6 100644
--- a/sigmod/CoinList.cpp
+++ b/sigmod/CoinList.cpp
@@ -122,7 +122,7 @@ void Sigmod::CoinList::setName(const QString& name)
CHECK(name);
}
-void Sigmod::CoinList::setScript(const Script& script)
+void Sigmod::CoinList::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -132,7 +132,7 @@ QString Sigmod::CoinList::name() const
return m_name;
}
-Sigmod::Script Sigmod::CoinList::script() const
+Sigcore::Script Sigmod::CoinList::script() const
{
return m_script;
}
diff --git a/sigmod/CoinList.h b/sigmod/CoinList.h
index 0f02fc0d..cd0482b9 100644
--- a/sigmod/CoinList.h
+++ b/sigmod/CoinList.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_COINLIST
#define SIGMOD_COINLIST
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
// Qt includes
#include <QtCore/QList>
@@ -48,10 +50,10 @@ class SIGMOD_EXPORT CoinList : public Object
QDomElement save() const;
void setName(const QString& name);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
QString name() const;
- Script script() const;
+ Sigcore::Script script() const;
const CoinListObject* object(const int index) const;
CoinListObject* object(const int index);
@@ -73,7 +75,7 @@ class SIGMOD_EXPORT CoinList : public Object
void clear();
QString m_name;
- Script m_script;
+ Sigcore::Script m_script;
QList<CoinListObject*> m_objects;
};
}
diff --git a/sigmod/Fraction.cpp b/sigmod/Fraction.cpp
deleted file mode 100644
index c27c2e6e..00000000
--- a/sigmod/Fraction.cpp
+++ /dev/null
@@ -1,177 +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/>.
- */
-
-/**
- * \file sigmod/Fraction.cpp
- */
-
-// Header include
-#include "Fraction.h"
-
-Sigmod::Fraction::Fraction(const int numerator, const int denominator)
-{
- set(numerator, denominator);
-}
-
-Sigmod::Fraction::Fraction(const Fraction& fraction)
-{
- set(fraction.numerator(), fraction.denominator());
-}
-
-void Sigmod::Fraction::set(const int numerator, const int denominator)
-{
- m_numerator = numerator;
- m_denominator = denominator;
- normalize();
-}
-
-void Sigmod::Fraction::setNumerator(const int numerator)
-{
- set(numerator, m_denominator);
-}
-
-void Sigmod::Fraction::setDenominator(const int denominator)
-{
- set(m_numerator, denominator);
-}
-
-int Sigmod::Fraction::numerator() const
-{
- return m_numerator;
-}
-
-int Sigmod::Fraction::denominator() const
-{
- return m_denominator;
-}
-
-void Sigmod::Fraction::reduce()
-{
- if (!m_numerator || !m_denominator)
- return;
- int i = m_numerator;
- int j = m_denominator;
- if (i < 0)
- i = -i;
- while (i - j)
- (i > j) ? (i -= j) : (j -= i);
- m_numerator /= i;
- m_denominator /= i;
-}
-
-bool Sigmod::Fraction::poll() const
-{
- return (qrand() % m_denominator) < m_numerator;
-}
-
-bool Sigmod::Fraction::poll(const int numerator, const int denominator)
-{
- return (qrand() % denominator) < numerator;
-}
-
-Sigmod::Fraction& Sigmod::Fraction::operator=(const Fraction& rhs)
-{
- if (this == &rhs)
- return *this;
- m_numerator = rhs.m_numerator;
- m_denominator = rhs.m_denominator;
- return *this;
-}
-
-Sigmod::Fraction::operator double() const
-{
- return (double(m_numerator) / m_denominator);
-}
-
-Sigmod::Fraction Sigmod::Fraction::operator+(const Fraction& rhs) const
-{
- return Fraction((m_numerator * rhs.m_denominator) + (m_denominator * rhs.m_numerator), m_denominator * rhs.m_denominator);
-}
-
-Sigmod::Fraction Sigmod::Fraction::operator-(const Fraction& rhs) const
-{
- return Fraction((m_numerator * rhs.m_denominator) - (m_denominator * rhs.m_numerator), m_denominator * rhs.m_denominator);
-}
-
-Sigmod::Fraction Sigmod::Fraction::operator*(const Fraction& rhs) const
-{
- return Fraction(m_numerator * rhs.m_numerator, m_denominator * rhs.m_denominator);
-}
-
-Sigmod::Fraction Sigmod::Fraction::operator/(const Fraction& rhs) const
-{
- return Fraction(m_numerator * rhs.m_denominator, m_denominator * rhs.m_numerator);
-}
-
-Sigmod::Fraction& Sigmod::Fraction::operator+=(const Fraction& rhs)
-{
- return *this = *this + rhs;
-}
-
-Sigmod::Fraction& Sigmod::Fraction::operator-=(const Fraction& rhs)
-{
- return *this = *this - rhs;
-}
-
-Sigmod::Fraction& Sigmod::Fraction::operator*=(const Fraction& rhs)
-{
- return *this = *this * rhs;
-}
-
-Sigmod::Fraction& Sigmod::Fraction::operator/=(const Fraction& rhs)
-{
- return *this = *this / rhs;
-}
-
-bool Sigmod::Fraction::operator==(const Fraction& rhs) const
-{
- return ((m_numerator * rhs.m_denominator) == (m_denominator * rhs.m_numerator));
-}
-
-bool Sigmod::Fraction::operator!=(const Fraction& rhs) const
-{
- return !(*this == rhs);
-}
-
-bool Sigmod::Fraction::operator<(const Fraction& rhs) const
-{
- return ((m_numerator * rhs.m_denominator) < (m_denominator * rhs.m_numerator));
-}
-
-bool Sigmod::Fraction::operator<=(const Fraction& rhs) const
-{
- return ((m_numerator * rhs.m_denominator) <= (m_denominator * rhs.m_numerator));
-}
-
-bool Sigmod::Fraction::operator>(const Fraction& rhs) const
-{
- return !(*this <= rhs);
-}
-
-bool Sigmod::Fraction::operator>=(const Fraction& rhs) const
-{
- return !(*this < rhs);
-}
-
-void Sigmod::Fraction::normalize()
-{
- if (m_denominator < 0)
- {
- m_denominator = -m_denominator;
- m_numerator = -m_numerator;
- }
-}
diff --git a/sigmod/Fraction.h b/sigmod/Fraction.h
deleted file mode 100644
index 7dd861ea..00000000
--- a/sigmod/Fraction.h
+++ /dev/null
@@ -1,131 +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/>.
- */
-
-/**
- * \file sigmod/Fraction.h
- */
-
-#ifndef SIGMOD_FRACTION
-#define SIGMOD_FRACTION
-
-// Sigmod includes
-#include "Global.h"
-
-// Qt includes
-#include <QtCore/QMetaType>
-
-namespace Sigmod
-{
-/**
- * \class Sigmod::Fraction Fraction.h sigmod/Fraction.h
- * \brief Class that represents a fractional quantity.
- *
- * This class should be used in place of \p double because of accuracy.
- */
-class SIGMOD_EXPORT Fraction
-{
- public:
- /**
- * Constructor.
- *
- * \param numerator The numerator of the fraction.
- * \param denominator The denominator of the fraction.
- */
- explicit Fraction(const int numerator = 1, const int denominator = 1);
- /**
- * Copy constructor.
- *
- * \param fraction The value to copy.
- */
- Fraction(const Fraction& fraction);
-
- /**
- * Set the value of the fraction.
- *
- * \param numerator The numerator of the fraction.
- * \param denominator The denominator of the fraction.
- */
- void set(const int numerator, const int denominator);
- /**
- * Sets the numerator of the fraction.
- *
- * \param numerator The numerator of the fraction.
- */
- void setNumerator(const int numerator);
- /**
- * Set the denominator of the fraciton.
- *
- * \param denominator The denominator of the fraction.
- */
- void setDenominator(const int denominator);
-
- /**
- * \return The numerator of the fraction.
- */
- int numerator() const;
- /**
- * \return The denominator of the fraction.
- */
- int denominator() const;
-
- /**
- * Reduces the fraction.
- */
- void reduce();
- /**
- * Uses the value of the fraction to return a weighted boolean.
- *
- * \return \p true with a weight of the fraction, \p false otherwise.
- */
- bool poll() const;
- /**
- * Convenience function to get a weighted boolean value.
- *
- * \param numerator The numerator of the chance that the function returns \p true.
- * \param demoninator The denominator of the chance that the function returns \p true.
- * \return \p true with a weight of the (\p numerator / \p denominator), \p false otherwise.
- */
- static bool poll(const int numerator, const int demoninator);
-
- Fraction& operator=(const Fraction& rhs);
- operator double() const;
- Fraction operator+(const Fraction& rhs) const;
- Fraction operator-(const Fraction& rhs) const;
- Fraction operator*(const Fraction& rhs) const;
- Fraction operator/(const Fraction& rhs) const;
- Fraction operator%(const Fraction& rhs) const;
- Fraction& operator+=(const Fraction& rhs);
- Fraction& operator-=(const Fraction& rhs);
- Fraction& operator*=(const Fraction& rhs);
- Fraction& operator/=(const Fraction& rhs);
- Fraction& operator%=(const Fraction& rhs);
- bool operator==(const Fraction& rhs) const;
- bool operator!=(const Fraction& rhs) const;
- bool operator<(const Fraction& rhs) const;
- bool operator<=(const Fraction& rhs) const;
- bool operator>(const Fraction& rhs) const;
- bool operator>=(const Fraction& rhs) const;
- protected:
- void normalize();
- private:
- int m_numerator;
- int m_denominator;
-};
-}
-Q_DECLARE_METATYPE(Sigmod::Fraction)
-
-#endif
diff --git a/sigmod/GlobalScript.cpp b/sigmod/GlobalScript.cpp
index 2b80322b..c8cc4da9 100644
--- a/sigmod/GlobalScript.cpp
+++ b/sigmod/GlobalScript.cpp
@@ -80,7 +80,7 @@ void Sigmod::GlobalScript::setName(const QString& name)
CHECK(name);
}
-void Sigmod::GlobalScript::setScript(const Script& script)
+void Sigmod::GlobalScript::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -90,7 +90,7 @@ QString Sigmod::GlobalScript::name() const
return m_name;
}
-Sigmod::Script Sigmod::GlobalScript::script() const
+Sigcore::Script Sigmod::GlobalScript::script() const
{
return m_script;
}
diff --git a/sigmod/GlobalScript.h b/sigmod/GlobalScript.h
index 26fa995c..31ab0627 100644
--- a/sigmod/GlobalScript.h
+++ b/sigmod/GlobalScript.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_GLOBALSCRIPT
#define SIGMOD_GLOBALSCRIPT
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
namespace Sigmod
{
@@ -44,15 +46,15 @@ class SIGMOD_EXPORT GlobalScript : public Object
QDomElement save() const;
void setName(const QString& name);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
QString name() const;
- Script script() const;
+ Sigcore::Script script() const;
GlobalScript& operator=(const GlobalScript& rhs);
private:
QString m_name;
- Script m_script;
+ Sigcore::Script m_script;
};
}
diff --git a/sigmod/Hat.h b/sigmod/Hat.h
deleted file mode 100644
index 1b8facdf..00000000
--- a/sigmod/Hat.h
+++ /dev/null
@@ -1,184 +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/>.
- */
-
-/**
- * \file sigmod/Hat.h
- */
-
-#ifndef SIGMOD_HAT
-#define SIGMOD_HAT
-
-// Sigmod includes
-#include "Fraction.h"
-#include "Global.h"
-
-// Qt includes
-#include <QtCore/QtGlobal>
-#include <QtCore/QMap>
-
-namespace Sigmod
-{
-/**
- * \class Sigmod::Hat Hat.h sigmod/Hat.h
- * \brief Class to help choose items from a weighted set of items.
- *
- * Given a set of weighted items to choose from, Hat will pick out a random item from the set.
- */
-template<class T> class Hat
-{
- public:
- /**
- * Default constructor.
- */
- Hat();
-
- /**
- * Choose an item from the set without removal.
- *
- * \return The item chosen.
- */
- T pick() const;
- /**
- * Choose an item from the set with removal.
- *
- * \return The item chosen.
- */
- T take();
- /**
- * Choose an item from the set as well as all identical items.
- *
- * \return The item chosen.
- */
- T takeAndClear();
- /**
- * Set the weight of an item in the set.
- *
- * \param key The item to set.
- * \param weight The weight of the item.
- */
- void setCount(const T& key, const int weight);
- /**
- * Add a number of items to the set.
- *
- * \param key The item to add to the set.
- * \param weight How many of the item to add.
- */
- void add(const T& key, const int weight);
- /**
- * \return The number of distinct items in the set.
- */
- int distinctCount() const;
- /**
- * \return The number of total items in the set.
- */
- int count() const;
- /**
- * \param key The item to get the count of.
- *
- * \return The amount of \p key in the set.
- */
- int count(const T& key) const;
- /**
- * \param key The item to get the chance of.
- *
- * \return The chance of choosing \p key.
- */
- Fraction chance(const T& key) const;
- private:
- QMap<T, int> m_objects;
- int m_count;
-};
-
-template<class T> inline Hat<T>::Hat() :
- m_count(0)
-{
-}
-
-template<class T> inline T Hat<T>::pick() const
-{
- int choice = qrand() % m_count;
- foreach (const T& key, m_objects.keys())
- {
- choice -= m_objects[key];
- if (choice < 0)
- return key;
- }
- return T();
-}
-
-template<class T> inline T Hat<T>::take()
-{
- T chosen = pick();
- if (!(--m_objects[chosen]))
- m_objects.remove(chosen);
- --m_count;
- return chosen;
-}
-
-template<class T> inline T Hat<T>::takeAndClear()
-{
- T chosen = pick();
- m_count -= m_objects[chosen];
- m_objects.remove(chosen);
- return chosen;
-}
-
-template<class T> inline void Hat<T>::setCount(const T& key, const int weight)
-{
- if (m_objects.contains(key))
- {
- m_count -= m_objects[key];
- if (!weight)
- m_objects.remove(key);
- }
- add(key, weight);
-}
-
-template<class T> inline void Hat<T>::add(const T& key, const int weight)
-{
- if (weight)
- {
- m_objects[key] += weight;
- m_count += weight;
- }
-}
-
-template<class T> inline int Hat<T>::distinctCount() const
-{
- return m_objects.size();
-}
-
-template<class T> inline int Hat<T>::count() const
-{
- return m_count;
-}
-
-template<class T> inline int Hat<T>::count(const T& key) const
-{
- if (m_objects.contains(key))
- return m_objects[key];
- return 0;
-}
-
-template<class T> inline Fraction Hat<T>::chance(const T& key) const
-{
- return Fraction(count(key), m_count);
-}
-
-}
-
-#endif
diff --git a/sigmod/Item.cpp b/sigmod/Item.cpp
index d0eb9a91..5cb9d29e 100644
--- a/sigmod/Item.cpp
+++ b/sigmod/Item.cpp
@@ -155,7 +155,7 @@ void Sigmod::Item::setDescription(const QString& description)
CHECK(description);
}
-void Sigmod::Item::setScript(const Script& script)
+void Sigmod::Item::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -195,7 +195,7 @@ QString Sigmod::Item::description() const
return m_description;
}
-Sigmod::Script Sigmod::Item::script() const
+Sigcore::Script Sigmod::Item::script() const
{
return m_script;
}
diff --git a/sigmod/Item.h b/sigmod/Item.h
index 4b4cc74a..c505a373 100644
--- a/sigmod/Item.h
+++ b/sigmod/Item.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_ITEM
#define SIGMOD_ITEM
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
namespace Sigmod
{
@@ -50,7 +52,7 @@ class SIGMOD_EXPORT Item : public Object
void setSellPrice(const int sellPrice);
void setWeight(const int weight);
void setDescription(const QString& description);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
QString name() const;
bool sellable() const;
@@ -59,7 +61,7 @@ class SIGMOD_EXPORT Item : public Object
int sellPrice() const;
int weight() const;
QString description() const;
- Script script() const;
+ Sigcore::Script script() const;
Item& operator=(const Item& rhs);
private:
@@ -70,7 +72,7 @@ class SIGMOD_EXPORT Item : public Object
int m_sellPrice;
int m_weight;
QString m_description;
- Script m_script;
+ Sigcore::Script m_script;
};
}
diff --git a/sigmod/Map.cpp b/sigmod/Map.cpp
index 021de6ac..1aaa5e36 100644
--- a/sigmod/Map.cpp
+++ b/sigmod/Map.cpp
@@ -202,12 +202,12 @@ void Sigmod::Map::deleteRow(const int row)
m_map.deleteRow(row);
}
-const Sigmod::Matrix<int>* Sigmod::Map::map() const
+const Sigcore::Matrix<int>* Sigmod::Map::map() const
{
return &m_map;
}
-Sigmod::Matrix<int>* Sigmod::Map::map()
+Sigcore::Matrix<int>* Sigmod::Map::map()
{
return &m_map;
}
diff --git a/sigmod/Map.h b/sigmod/Map.h
index 4657e9dc..490287c6 100644
--- a/sigmod/Map.h
+++ b/sigmod/Map.h
@@ -18,8 +18,10 @@
#ifndef SIGMOD_MAP
#define SIGMOD_MAP
+// Sigcore includes
+#include "../sigcore/Matrix.h"
+
// Sigmod includes
-#include "Matrix.h"
#include "Object.h"
// Qt includes
@@ -75,8 +77,8 @@ class SIGMOD_EXPORT Map : public Object
void deleteColumn(const int column);
void deleteRow(const int row);
- const Matrix<int>* map() const;
- Matrix<int>* map();
+ const Sigcore::Matrix<int>* map() const;
+ Sigcore::Matrix<int>* map();
int tile(const int row, const int column) const;
int width() const;
int height() const;
@@ -148,7 +150,7 @@ class SIGMOD_EXPORT Map : public Object
QString m_name;
int m_flyWarp;
Type m_type;
- Matrix<int> m_map;
+ Sigcore::Matrix<int> m_map;
QList<MapEffect*> m_effects;
QList<MapTrainer*> m_trainers;
QList<MapWarp*> m_warps;
diff --git a/sigmod/MapEffect.cpp b/sigmod/MapEffect.cpp
index 3c232118..6d5c2734 100644
--- a/sigmod/MapEffect.cpp
+++ b/sigmod/MapEffect.cpp
@@ -109,7 +109,7 @@ void Sigmod::MapEffect::setIsGhost(const bool isGhost)
CHECK(isGhost);
}
-void Sigmod::MapEffect::setScript(const Script& script)
+void Sigmod::MapEffect::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -134,7 +134,7 @@ bool Sigmod::MapEffect::isGhost() const
return m_isGhost;
}
-Sigmod::Script Sigmod::MapEffect::script() const
+Sigcore::Script Sigmod::MapEffect::script() const
{
return m_script;
}
diff --git a/sigmod/MapEffect.h b/sigmod/MapEffect.h
index 39726d19..f8f064bc 100644
--- a/sigmod/MapEffect.h
+++ b/sigmod/MapEffect.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_MAPEFFECT
#define SIGMOD_MAPEFFECT
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
// Qt includes
#include <QtCore/QPoint>
@@ -49,13 +51,13 @@ class SIGMOD_EXPORT MapEffect : public Object
void setCoordinate(const QPoint& coordinate);
void setSkin(const int skin);
void setIsGhost(const bool isGhost);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
QString name() const;
QPoint coordinate() const;
int skin() const;
bool isGhost() const;
- Script script() const;
+ Sigcore::Script script() const;
MapEffect& operator=(const MapEffect& rhs);
private:
@@ -63,7 +65,7 @@ class SIGMOD_EXPORT MapEffect : public Object
QPoint m_coordinate;
int m_skin;
bool m_isGhost;
- Script m_script;
+ Sigcore::Script m_script;
};
}
diff --git a/sigmod/MapTrainer.cpp b/sigmod/MapTrainer.cpp
index 9e3f3e2d..2c9307c9 100644
--- a/sigmod/MapTrainer.cpp
+++ b/sigmod/MapTrainer.cpp
@@ -134,7 +134,7 @@ void Sigmod::MapTrainer::setNumberFight(const int numberFight)
CHECK(numberFight);
}
-void Sigmod::MapTrainer::setScript(const Script& script)
+void Sigmod::MapTrainer::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -167,7 +167,7 @@ int Sigmod::MapTrainer::numberFight() const
return m_numberFight;
}
-Sigmod::Script Sigmod::MapTrainer::script() const
+Sigcore::Script Sigmod::MapTrainer::script() const
{
return m_script;
}
diff --git a/sigmod/MapTrainer.h b/sigmod/MapTrainer.h
index 7c45b39a..f01afdbe 100644
--- a/sigmod/MapTrainer.h
+++ b/sigmod/MapTrainer.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_MAPTRAINER
#define SIGMOD_MAPTRAINER
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
// Qt includes
#include <QtCore/QList>
@@ -52,14 +54,14 @@ class SIGMOD_EXPORT MapTrainer : public Object
void setTrainerClass(const int trainerClass);
void setCoordinate(const QPoint& coordinate);
void setNumberFight(const int numberFight);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
void setLeadTeamMember(const int leadTeamMember);
QString name() const;
int trainerClass() const;
QPoint coordinate() const;
int numberFight() const;
- Script script() const;
+ Sigcore::Script script() const;
int leadTeamMember() const;
const MapTrainerTeamMember* teamMember(const int index) const;
@@ -85,7 +87,7 @@ class SIGMOD_EXPORT MapTrainer : public Object
int m_trainerClass;
QPoint m_coordinate;
int m_numberFight;
- Script m_script;
+ Sigcore::Script m_script;
int m_leadTeamMember;
QList<MapTrainerTeamMember*> m_teamMembers;
};
diff --git a/sigmod/MapWarp.cpp b/sigmod/MapWarp.cpp
index 9cd61065..bd4934b6 100644
--- a/sigmod/MapWarp.cpp
+++ b/sigmod/MapWarp.cpp
@@ -124,7 +124,7 @@ void Sigmod::MapWarp::setToWarp(const int toWarp)
CHECK(toWarp);
}
-void Sigmod::MapWarp::setScript(const Script& script)
+void Sigmod::MapWarp::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -154,7 +154,7 @@ int Sigmod::MapWarp::toWarp() const
return m_toWarp;
}
-Sigmod::Script Sigmod::MapWarp::script() const
+Sigcore::Script Sigmod::MapWarp::script() const
{
return m_script;
}
diff --git a/sigmod/MapWarp.h b/sigmod/MapWarp.h
index d0ffb778..f99afdf3 100644
--- a/sigmod/MapWarp.h
+++ b/sigmod/MapWarp.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_MAPWARP
#define SIGMOD_MAPWARP
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
// Qt includes
#include <QtCore/QPoint>
@@ -60,14 +62,14 @@ class SIGMOD_EXPORT MapWarp : public Object
void setType(const Type type);
void setToMap(const int toMap);
void setToWarp(const int toWarp);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
QString name() const;
QPoint coordinate() const;
Type type() const;
int toMap() const;
int toWarp() const;
- Script script() const;
+ Sigcore::Script script() const;
MapWarp& operator=(const MapWarp& rhs);
private:
@@ -76,7 +78,7 @@ class SIGMOD_EXPORT MapWarp : public Object
Type m_type;
int m_toMap;
int m_toWarp;
- Script m_script;
+ Sigcore::Script m_script;
};
}
Q_DECLARE_METATYPE(Sigmod::MapWarp::Type)
diff --git a/sigmod/Matrix.h b/sigmod/Matrix.h
deleted file mode 100644
index 1338001d..00000000
--- a/sigmod/Matrix.h
+++ /dev/null
@@ -1,348 +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/>.
- */
-
-/**
- * \file sigmod/Matrix.h
- */
-
-#ifndef SIGMOD_MATRIX
-#define SIGMOD_MATRIX
-
-// Sigmod includes
-#include "Global.h"
-
-// Qt includes
-#include <QtCore/QPoint>
-#include <QtCore/QVector>
-
-namespace Sigmod
-{
-/**
- * \class Sigmod::Matrix Matrix.h sigmod/Matrix.h
- * \brief Class for a two dimensional vector.
- */
-template<class T> class SIGMOD_EXPORT Matrix
-{
- public:
- /**
- * Default constructor.
- */
- Matrix();
- /**
- * Constructor.
- *
- * \param height The height of the matrix.
- * \param width The width of the matrix.
- * \param value The value to set all values to.
- */
- Matrix(const int height, const int width, const T& value = T());
- /**
- * Copy constructor.
- *
- * \param rhs The matrix to copy.
- */
- Matrix(const Matrix& rhs);
-
- /**
- * Add a row to the matrix.
- *
- * \param value The value to set the row to.
- */
- void addRow(const T& value = T());
- /**
- * Add a column to the matrix.
- *
- * \param value The value to set the column to.
- */
- void addColumn(const T& value = T());
- /**
- * Inserts a row into the matrix.
- *
- * \param row Where the new row will be placed.
- * \param value The value to set the row to.
- */
- void insertRow(const int row, const T& value = T());
- /**
- * Inserts a column into the matrix.
- *
- * \param column Where the new column will be placed.
- * \param value The value to set the column to.
- */
- void insertColumn(const int column, const T& value = T());
- /**
- * Removes a row from the matrix.
- *
- * \param row The row to remove from the matrix.
- */
- void deleteRow(const int row);
- /**
- * Removes a column from the matrix.
- *
- * \param column The column to remove from the matrix.
- */
- void deleteColumn(const int column);
-
- /**
- * Clears the matrix.
- */
- void clear();
-
- /**
- * Resizes the matrix to a new size. Rows and columns are removed from the end to shrink and added to the
- * end to grow.
- *
- * \param newHeight The target height.
- * \param newWidth The target width.
- * \param value Value to set any additional rows and columns to.
- */
- void resize(const int newHeight, const int newWidth, const T& value = T());
-
- /**
- * Get a row from the matrix.
- *
- * \param row The row to retrieve.
- * \return A row of the matrix.
- */
- QVector<T> row(const int row) const;
- /**
- * Get a column from the matrix.
- *
- * \param column The column to retrieve.
- * \return A column of the matrix.
- */
- QVector<T> column(const int column) const;
-
- /**
- * Add a masked matrix to the matrix.
- *
- * \param top The top-most part of the matrix.
- * \param left The left-most part of the matrix.
- * \param mask The mask to add.
- */
- void addMask(const int top, const int left, const Matrix& mask);
-
- /**
- * \return The height of the matrix.
- */
- int height() const;
- /**
- * \return The width of the matrix.
- */
- int width() const;
-
- /**
- * Method for accessing values in the matrix.
- *
- * \param row The row of the cell.
- * \param column The column of te cell.
- * \return The value of the cell in the matrix.
- */
- T& operator()(const int row, const int column);
- /**
- * Convenience method.
- *
- * \param row The row of the cell.
- * \param column The column of te cell.
- * \return The value of the cell in the matrix.
- */
- T operator()(const int row, const int column) const;
- Matrix<T>& operator=(const Matrix& rhs);
- bool operator==(const Matrix& rhs) const;
- bool operator!=(const Matrix& rhs) const;
- private:
- QVector< QVector<T> > m_matrix;
-};
-
-template<class T> Matrix<T>::Matrix()
-{
-}
-
-template<class T> Matrix<T>::Matrix(const int height, const int width, const T& value)
-{
- resize(height, width, value);
-}
-
-template<class T> Matrix<T>::Matrix(const Matrix& rhs)
-{
- *this = rhs;
-}
-
-template<class T> void Matrix<T>::addRow(const T& value)
-{
- insertRow(height(), value);
-}
-
-template<class T> void Matrix<T>::addColumn(const T& value)
-{
- insertColumn(width(), value);
-}
-
-template<class T> void Matrix<T>::insertRow(const int row, const T& value)
-{
- Q_ASSERT(0 <= row);
- Q_ASSERT(row <= height());
- if (!height() || !width())
- m_matrix.append(QVector<T>(1, value));
- else
- m_matrix.insert(row, QVector<T>(width(), value));
-}
-
-template<class T> void Matrix<T>::insertColumn(const int column, const T& value)
-{
- Q_ASSERT(0 <= column);
- Q_ASSERT(column <= width());
- if (!height() || !width())
- m_matrix.append(QVector<T>(1, value));
- else
- {
- for (int i = 0; i < height(); ++i)
- m_matrix[i].insert(column, value);
- }
-}
-
-template<class T> void Matrix<T>::deleteRow(const int row)
-{
- Q_ASSERT(0 <= row);
- Q_ASSERT(row < height());
- if (height() == 1)
- m_matrix.clear();
- else
- m_matrix.remove(row);
-}
-
-template<class T> void Matrix<T>::deleteColumn(const int column)
-{
- Q_ASSERT(0 <= column);
- Q_ASSERT(column < width());
- if (width() == 1)
- m_matrix.clear();
- else
- {
- for (int i = 0; i < height(); ++i)
- m_matrix[i].remove(column);
- }
-}
-
-template<class T> void Matrix<T>::clear()
-{
- m_matrix.clear();
-}
-
-template<class T> void Matrix<T>::resize(const int newHeight, const int newWidth, const T& value)
-{
- while (height() < newHeight)
- addRow(value);
- while (newHeight < height())
- deleteRow(newHeight);
- while (width() < newWidth)
- addColumn(value);
- while (newWidth < width())
- deleteColumn(newWidth);
-}
-
-template<class T> QVector<T> Matrix<T>::row(const int row) const
-{
- Q_ASSERT(0 <= row);
- Q_ASSERT(row < height());
- return m_matrix.at(row);
-}
-
-template<class T> QVector<T> Matrix<T>::column(const int column) const
-{
- Q_ASSERT(0 <= column);
- Q_ASSERT(column < width());
- QVector<T> col;
- foreach (QVector<T> row, m_matrix)
- col.append(row.at(column));
- return col;
-}
-
-template<class T> void Matrix<T>::addMask(const int top, const int left, const Matrix& mask)
-{
- Q_ASSERT(0 <= top);
- Q_ASSERT(top < height());
- Q_ASSERT(0 <= left);
- Q_ASSERT(left < width());
- Q_ASSERT(0 <= mask.height());
- Q_ASSERT(top + mask.height() <= height());
- Q_ASSERT(0 <= mask.width());
- Q_ASSERT(left + mask.width() <= width());
- for (int i = 0; i < mask.height(); ++i)
- {
- for (int j = 0; j < mask.width(); ++j)
- {
- if (operator()(top + i, left + j) || mask(i, j))
- operator()(top + i, left + j) = 1;
- }
- }
-}
-
-template<class T> int Matrix<T>::height() const
-{
- return m_matrix.size();
-}
-
-template<class T> int Matrix<T>::width() const
-{
- if (m_matrix.size())
- return m_matrix[0].size();
- return 0;
-}
-
-template<class T> T& Matrix<T>::operator()(const int row, const int column)
-{
- Q_ASSERT(row < height());
- Q_ASSERT(column < width());
- return m_matrix[row][column];
-}
-
-template<class T> T Matrix<T>::operator()(const int row, const int column) const
-{
- Q_ASSERT(row < height());
- Q_ASSERT(column < width());
- return m_matrix.at(row).at(column);
-}
-
-template<class T> Matrix<T>& Matrix<T>::operator=(const Matrix& rhs)
-{
- if (this == &rhs)
- return *this;
- resize(rhs.height(), rhs.width());
- for (int i = 0; i < height(); ++i)
- {
- for (int j = 0; j < width(); ++j)
- m_matrix[i][j] = rhs.m_matrix[i][j];
- }
- return *this;
-}
-
-template<class T> bool Matrix<T>::operator==(const Matrix& rhs) const
-{
- if (this == &rhs)
- return true;
- return m_matrix == rhs.m_matrix;
- return true;
-}
-
-template<class T> bool Matrix<T>::operator!=(const Matrix& rhs) const
-{
- return !(*this == rhs);
-}
-
-}
-
-#endif
diff --git a/sigmod/Move.cpp b/sigmod/Move.cpp
index 75e8efbd..6f309eb4 100644
--- a/sigmod/Move.cpp
+++ b/sigmod/Move.cpp
@@ -114,7 +114,7 @@ void Sigmod::Move::setName(const QString& name)
CHECK(name);
}
-void Sigmod::Move::setAccuracy(const Fraction& accuracy)
+void Sigmod::Move::setAccuracy(const Sigcore::Fraction& accuracy)
{
if (!accuracy || (1 < accuracy))
emit(error(bounds("accuracy")));
@@ -158,17 +158,17 @@ void Sigmod::Move::setDescription(const QString& description)
CHECK(description);
}
-void Sigmod::Move::setBattleScript(const Script& battleScript)
+void Sigmod::Move::setBattleScript(const Sigcore::Script& battleScript)
{
CHECK(battleScript);
}
-void Sigmod::Move::setWorldScript(const Script& worldScript)
+void Sigmod::Move::setWorldScript(const Sigcore::Script& worldScript)
{
CHECK(worldScript);
}
-void Sigmod::Move::setPriorityScript(const Script& priorityScript)
+void Sigmod::Move::setPriorityScript(const Sigcore::Script& priorityScript)
{
CHECK(priorityScript);
}
@@ -178,7 +178,7 @@ QString Sigmod::Move::name() const
return m_name;
}
-Sigmod::Fraction Sigmod::Move::accuracy() const
+Sigcore::Fraction Sigmod::Move::accuracy() const
{
return m_accuracy;
}
@@ -213,17 +213,17 @@ QString Sigmod::Move::description() const
return m_description;
}
-Sigmod::Script Sigmod::Move::battleScript() const
+Sigcore::Script Sigmod::Move::battleScript() const
{
return m_battleScript;
}
-Sigmod::Script Sigmod::Move::worldScript() const
+Sigcore::Script Sigmod::Move::worldScript() const
{
return m_worldScript;
}
-Sigmod::Script Sigmod::Move::priorityScript() const
+Sigcore::Script Sigmod::Move::priorityScript() const
{
return m_priorityScript;
}
diff --git a/sigmod/Move.h b/sigmod/Move.h
index 2c8082b0..f4a6d2da 100644
--- a/sigmod/Move.h
+++ b/sigmod/Move.h
@@ -18,10 +18,12 @@
#ifndef SIGMOD_MOVE
#define SIGMOD_MOVE
+// Sigcore includes
+#include "../sigcore/Fraction.h"
+#include "../sigcore/Script.h"
+
// Sigmod includes
-#include "Fraction.h"
#include "Object.h"
-#include "Script.h"
namespace Sigmod
{
@@ -45,42 +47,42 @@ class SIGMOD_EXPORT Move : public Object
QDomElement save() const;
void setName(const QString& name);
- void setAccuracy(const Fraction& accuracy);
+ void setAccuracy(const Sigcore::Fraction& accuracy);
void setPower(const int power);
void setType(const int type);
void setSpecial(const bool special);
void setPowerPoints(const int powerPoints);
void setPriority(const int priority);
void setDescription(const QString& description);
- void setBattleScript(const Script& battleScript);
- void setWorldScript(const Script& worldScript);
- void setPriorityScript(const Script& priorityScript);
+ void setBattleScript(const Sigcore::Script& battleScript);
+ void setWorldScript(const Sigcore::Script& worldScript);
+ void setPriorityScript(const Sigcore::Script& priorityScript);
QString name() const;
- Fraction accuracy() const;
+ Sigcore::Fraction accuracy() const;
int power() const;
int type() const;
bool special() const;
int powerPoints() const;
int priority() const;
QString description() const;
- Script battleScript() const;
- Script worldScript() const;
- Script priorityScript() const;
+ Sigcore::Script battleScript() const;
+ Sigcore::Script worldScript() const;
+ Sigcore::Script priorityScript() const;
Move& operator=(const Move& rhs);
private:
QString m_name;
- Fraction m_accuracy;
+ Sigcore::Fraction m_accuracy;
int m_power;
int m_type;
bool m_special;
int m_powerPoints;
int m_priority;
QString m_description;
- Script m_battleScript;
- Script m_worldScript;
- Script m_priorityScript;
+ Sigcore::Script m_battleScript;
+ Sigcore::Script m_worldScript;
+ Sigcore::Script m_priorityScript;
};
}
diff --git a/sigmod/Nature.cpp b/sigmod/Nature.cpp
index add4a764..5df36bc3 100644
--- a/sigmod/Nature.cpp
+++ b/sigmod/Nature.cpp
@@ -86,7 +86,7 @@ void Sigmod::Nature::setName(const QString& name)
CHECK(name);
}
-void Sigmod::Nature::setStat(const Stat stat, const Fraction& multiplier)
+void Sigmod::Nature::setStat(const Stat stat, const Sigcore::Fraction& multiplier)
{
switch (stat)
{
@@ -114,7 +114,7 @@ QString Sigmod::Nature::name() const
return m_name;
}
-Sigmod::Fraction Sigmod::Nature::stat(const Stat stat) const
+Sigcore::Fraction Sigmod::Nature::stat(const Stat stat) const
{
switch (stat)
{
@@ -124,7 +124,7 @@ Sigmod::Fraction Sigmod::Nature::stat(const Stat stat) const
return m_stat[stat - ST_Attack];
default:
emit(warning(bounds("stat")));
- return Fraction();
+ return Sigcore::Fraction();
}
}
diff --git a/sigmod/Nature.h b/sigmod/Nature.h
index 68f15a91..7c658832 100644
--- a/sigmod/Nature.h
+++ b/sigmod/Nature.h
@@ -18,8 +18,10 @@
#ifndef SIGMOD_NATURE
#define SIGMOD_NATURE
+// Sigcore includes
+#include "../sigcore/Fraction.h"
+
// Sigmod includes
-#include "Fraction.h"
#include "Object.h"
namespace Sigmod
@@ -43,19 +45,19 @@ class SIGMOD_EXPORT Nature : public Object
QDomElement save() const;
void setName(const QString& name);
- void setStat(const Stat stat, const Fraction& multiplier);
+ void setStat(const Stat stat, const Sigcore::Fraction& multiplier);
void setWeight(const int weight);
QString name() const;
- Fraction stat(const Stat stat) const;
+ Sigcore::Fraction stat(const Stat stat) const;
int weight() const;
Nature& operator=(const Nature& rhs);
private:
- void setStat(const Fraction& multiplier);
+ void setStat(const Sigcore::Fraction& multiplier);
QString m_name;
- QVarLengthArray<Fraction, ST_SpecialDefense - ST_Attack + 1> m_stat;
+ QVarLengthArray<Sigcore::Fraction, ST_SpecialDefense - ST_Attack + 1> m_stat;
int m_weight;
};
}
diff --git a/sigmod/Object.h b/sigmod/Object.h
index 63409e58..0f8825e0 100644
--- a/sigmod/Object.h
+++ b/sigmod/Object.h
@@ -22,11 +22,13 @@
#ifndef SIGMOD_OBJECT
#define SIGMOD_OBJECT
+// Sigcore includes
+#include "../sigcore/Fraction.h"
+#include "../sigcore/Matrix.h"
+#include "../sigcore/Script.h"
+
// Sigmod includes
-#include "Fraction.h"
#include "Global.h"
-#include "Matrix.h"
-#include "Script.h"
// Qt includes
#include <QtCore/QBuffer>
@@ -159,12 +161,12 @@ class SIGMOD_EXPORT Object : public QObject
template<typename T> static void loadValue(const QDomElement& xml, T* value);
template<typename T, int S> static void loadArray(const QDomElement& xml, QVarLengthArray<T, S>* value);
template<typename T> static void loadList(const QDomElement& xml, QList<T>* value);
- template<typename T> static void loadMatrix(const QDomElement& xml, Matrix<T>* value);
+ template<typename T> static void loadMatrix(const QDomElement& xml, Sigcore::Matrix<T>* value);
template<typename T> static QDomElement saveValue(const QString& name, const T& value);
template<typename T, int S> static QDomElement saveArray(const QString& name, const QVarLengthArray<T, S>& value);
template<typename T> static QDomElement saveList(const QString& name, const QList<T>& value);
- template<typename T> static QDomElement saveMatrix(const QString& name, const Matrix<T>& value);
+ template<typename T> static QDomElement saveMatrix(const QString& name, const Sigcore::Matrix<T>& value);
virtual void clear();
private:
@@ -191,7 +193,7 @@ template<> inline void Object::loadValue<int>(const QDomElement& xml, int* value
*value = xml.firstChild().toText().data().toInt();
}
-template<> inline void Object::loadValue<Fraction>(const QDomElement& xml, Fraction* value)
+template<> inline void Object::loadValue<Sigcore::Fraction>(const QDomElement& xml, Sigcore::Fraction* value)
{
value->set(xml.attribute("numerator", "1").toInt(), xml.attribute("denominator", "1").toInt());
value->reduce();
@@ -208,7 +210,7 @@ template<> inline void Object::loadValue<QByteArray>(const QDomElement& xml, QBy
*value = QByteArray::fromBase64(xml.firstChild().toText().data().toUtf8());
}
-template<> inline void Object::loadValue<Script>(const QDomElement& xml, Script* value)
+template<> inline void Object::loadValue<Sigcore::Script>(const QDomElement& xml, Sigcore::Script* value)
{
value->setInterpreter(xml.attribute("interpreter", ""));
value->setScript(xml.firstChild().toText().data());
@@ -239,7 +241,7 @@ template<typename T> inline void Object::loadList(const QDomElement& xml, QList<
}
}
-template<typename T> inline void Object::loadMatrix(const QDomElement& xml, Matrix<T>* value)
+template<typename T> inline void Object::loadMatrix(const QDomElement& xml, Sigcore::Matrix<T>* value)
{
int height = xml.attribute("height", "1").toInt();
int width = xml.attribute("width", "1").toInt();
@@ -283,7 +285,7 @@ template<> inline QDomElement Object::saveValue<QString>(const QString& name, co
return element;
}
-template<> inline QDomElement Object::saveValue<Fraction>(const QString& name, const Fraction& value)
+template<> inline QDomElement Object::saveValue<Sigcore::Fraction>(const QString& name, const Sigcore::Fraction& value)
{
QDomElement element = QDomDocument().createElement(name);
element.setAttribute("numerator", value.numerator());
@@ -306,7 +308,7 @@ template<> inline QDomElement Object::saveValue<QByteArray>(const QString& name,
return element;
}
-template<> inline QDomElement Object::saveValue<Script>(const QString& name, const Script& value)
+template<> inline QDomElement Object::saveValue<Sigcore::Script>(const QString& name, const Sigcore::Script& value)
{
QDomElement element = QDomDocument().createElement(name);
element.setAttribute("interpreter", value.interpreter());
@@ -334,7 +336,7 @@ template<typename T> inline QDomElement Object::saveList(const QString& name, co
return element;
}
-template<typename T> inline QDomElement Object::saveMatrix(const QString& name, const Matrix<T>& value)
+template<typename T> inline QDomElement Object::saveMatrix(const QString& name, const Sigcore::Matrix<T>& value)
{
QDomElement element = QDomDocument().createElement(name);
element.setAttribute("height", value.height());
diff --git a/sigmod/Script.cpp b/sigmod/Script.cpp
deleted file mode 100644
index 55dc02b0..00000000
--- a/sigmod/Script.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 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/>.
- */
-
-/**
- * \file sigmod/Script.cpp
- */
-
-// Header include
-#include "Script.h"
-
-Sigmod::Script::Script(const QString& interpreter, const QString& script) :
- m_interpreter(interpreter),
- m_script(script)
-{
-}
-
-void Sigmod::Script::setInterpreter(const QString& interpreter)
-{
- m_interpreter = interpreter;
-}
-
-void Sigmod::Script::setScript(const QString& script)
-{
- m_script = script;
-}
-
-QString Sigmod::Script::interpreter() const
-{
- return m_interpreter;
-}
-
-QString Sigmod::Script::script() const
-{
- return m_script;
-}
-
-Sigmod::Script& Sigmod::Script::operator=(const Script& rhs)
-{
- if (this == &rhs)
- return *this;
- m_interpreter = rhs.m_interpreter;
- m_script = rhs.m_script;
- return *this;
-}
-
-bool Sigmod::Script::operator==(const Script& rhs) const
-{
- return ((m_interpreter == rhs.m_interpreter) && (m_script == rhs.m_script));
-}
-
-bool Sigmod::Script::operator!=(const Script& rhs) const
-{
- return !(*this == rhs);
-}
diff --git a/sigmod/Script.h b/sigmod/Script.h
deleted file mode 100644
index 13c09aac..00000000
--- a/sigmod/Script.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 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/>.
- */
-
-/**
- * \file sigmod/Script.h
- */
-
-#ifndef SIGMOD_SCRIPT
-#define SIGMOD_SCRIPT
-
-// Sigmod includes
-#include "Global.h"
-
-// Qt includes
-#include <QtCore/QString>
-
-namespace Sigmod
-{
-/**
- * \class Sigmod::Script Script.h sigmod/Script.h
- * \brief Class that describes a script for the game engine.
- */
-class SIGMOD_EXPORT Script
-{
- public:
- /**
- * Constructor.
- *
- * \param interpreter The language of the script.
- * \param script The code for the script.
- */
- explicit Script(const QString& interpreter = "", const QString& script = "");
-
- /**
- * Set the language of the script. The default game engine uses Kross <http://kross.dipe.org/> to
- * run the scripts. The following values are valid for Kross:
- *
- * - \b mono -- C# <http://www.mono-project.com/Main_Page>
- * - \b falcon -- Falcon <http://www.falconpl.org/>
- * - \b java -- Java <http://www.java.com/en/>
- * - \b lua -- Lua <http://www.lua.org/>
- * - \b php -- PHP <http://www.php.net/>
- * - \b python -- Python <http://www.python.org/>
- * - \b ruby -- Ruby <http://www.ruby-lang.org/en/>
- *
- * Other languages may be added in the future.
- *
- * \param interpreter The language of the script.
- */
- void setInterpreter(const QString& interpreter);
- /**
- *
- * \param script The code for the script.
- */
- void setScript(const QString& script);
-
- /**
- * \sa setInterpreter
- *
- * \return The language of the script.
- */
- QString interpreter() const;
- /**
- * \sa setScript
- *
- * \return The code for the script.
- */
- QString script() const;
-
- Script& operator=(const Script& rhs);
- bool operator==(const Script& rhs) const;
- bool operator!=(const Script& rhs) const;
- private:
- QString m_interpreter;
- QString m_script;
-};
-}
-Q_DECLARE_METATYPE(Sigmod::Script)
-
-#endif
diff --git a/sigmod/Sigmod.cpp b/sigmod/Sigmod.cpp
index 5d143173..11915177 100644
--- a/sigmod/Sigmod.cpp
+++ b/sigmod/Sigmod.cpp
@@ -389,7 +389,7 @@ void Sigmod::Sigmod::setStartWarp(const int startWarp)
CHECK(startWarp);
}
-void Sigmod::Sigmod::setTypechart(const int attack, const int defense, const Fraction& multiplier)
+void Sigmod::Sigmod::setTypechart(const int attack, const int defense, const Sigcore::Fraction& multiplier)
{
CHECK_ARRAY(typechart(attack, defense), multiplier);
}
@@ -434,17 +434,17 @@ int Sigmod::Sigmod::startWarp() const
return m_startWarp;
}
-const Sigmod::Matrix<Sigmod::Fraction>* Sigmod::Sigmod::typechart() const
+const Sigcore::Matrix<Sigcore::Fraction>* Sigmod::Sigmod::typechart() const
{
return &m_typechart;
}
-Sigmod::Matrix<Sigmod::Fraction>* Sigmod::Sigmod::typechart()
+Sigcore::Matrix<Sigcore::Fraction>* Sigmod::Sigmod::typechart()
{
return &m_typechart;
}
-Sigmod::Fraction Sigmod::Sigmod::typechart(const int attack, const int defense) const
+Sigcore::Fraction Sigmod::Sigmod::typechart(const int attack, const int defense) const
{
return m_typechart(attack, defense);
}
@@ -2074,7 +2074,7 @@ Sigmod::Type* Sigmod::Sigmod::newType(const Type& type)
Sigmod::Type* Sigmod::Sigmod::newType(Type* type)
{
m_types.append(type);
- m_typechart.resize(typeCount(), typeCount(), Fraction(1, 1));
+ m_typechart.resize(typeCount(), typeCount(), Sigcore::Fraction(1, 1));
return type;
}
@@ -2083,7 +2083,7 @@ void Sigmod::Sigmod::deleteType(const int index)
Q_ASSERT(index < typeCount());
delete m_types[index];
m_types.removeAt(index);
- m_typechart.resize(typeCount(), typeCount(), Fraction(1, 1));
+ m_typechart.resize(typeCount(), typeCount(), Sigcore::Fraction(1, 1));
}
void Sigmod::Sigmod::deleteTypeById(const int id)
diff --git a/sigmod/Sigmod.h b/sigmod/Sigmod.h
index 544d1957..dee71c73 100644
--- a/sigmod/Sigmod.h
+++ b/sigmod/Sigmod.h
@@ -22,9 +22,11 @@
#ifndef SIGMOD_SIGMOD
#define SIGMOD_SIGMOD
+// Sigcore includes
+#include "../sigcore/Fraction.h"
+#include "../sigcore/Matrix.h"
+
// Sigmod includes
-#include "Fraction.h"
-#include "Matrix.h"
#include "Object.h"
// Qt includes
@@ -116,7 +118,7 @@ class SIGMOD_EXPORT Sigmod : public Object
void setSinglePlayer(const bool singlePlayer);
void setStartMap(const int startMap);
void setStartWarp(const int startWarp);
- void setTypechart(const int attack, const int defense, const Fraction& multiplier);
+ void setTypechart(const int attack, const int defense, const Sigcore::Fraction& multiplier);
void setRules(const Rules& rules);
void setRules(const QDomElement& xml);
@@ -126,9 +128,9 @@ class SIGMOD_EXPORT Sigmod : public Object
bool singlePlayer() const;
int startMap() const;
int startWarp() const;
- const Matrix<Fraction>* typechart() const;
- Matrix<Fraction>* typechart();
- Fraction typechart(const int attack, const int defense) const;
+ const Sigcore::Matrix<Sigcore::Fraction>* typechart() const;
+ Sigcore::Matrix<Sigcore::Fraction>* typechart();
+ Sigcore::Fraction typechart(const int attack, const int defense) const;
const Rules* rules() const;
Rules* rules();
@@ -472,7 +474,7 @@ class SIGMOD_EXPORT Sigmod : public Object
bool m_singlePlayer;
int m_startMap;
int m_startWarp;
- Matrix<Fraction> m_typechart;
+ Sigcore::Matrix<Sigcore::Fraction> m_typechart;
Rules* m_rules;
QList<Ability*> m_abilities;
QList<Author*> m_authors;
diff --git a/sigmod/Skin.cpp b/sigmod/Skin.cpp
index a2b46263..2721a59a 100644
--- a/sigmod/Skin.cpp
+++ b/sigmod/Skin.cpp
@@ -18,10 +18,12 @@
// Header include
#include "Skin.h"
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Macros.h"
#include "Sigmod.h"
-#include "Script.h"
Sigmod::Skin::Skin(const Skin& skin) :
Object(skin.parent(), skin.id())
@@ -77,7 +79,7 @@ void Sigmod::Skin::setName(const QString& name)
CHECK(name);
}
-void Sigmod::Skin::setScript(const Script& script)
+void Sigmod::Skin::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -87,7 +89,7 @@ QString Sigmod::Skin::name() const
return m_name;
}
-Sigmod::Script Sigmod::Skin::script() const
+Sigcore::Script Sigmod::Skin::script() const
{
return m_script;
}
diff --git a/sigmod/Skin.h b/sigmod/Skin.h
index a27a9b83..e7d96a1a 100644
--- a/sigmod/Skin.h
+++ b/sigmod/Skin.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_SKIN
#define SIGMOD_SKIN
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
namespace Sigmod
{
@@ -43,15 +45,15 @@ class SIGMOD_EXPORT Skin : public Object
QDomElement save() const;
void setName(const QString& name);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
QString name() const;
- Script script() const;
+ Sigcore::Script script() const;
Skin& operator=(const Skin& rhs);
private:
QString m_name;
- Script m_script;
+ Sigcore::Script m_script;
};
}
diff --git a/sigmod/Species.cpp b/sigmod/Species.cpp
index 4e217317..0340abd0 100644
--- a/sigmod/Species.cpp
+++ b/sigmod/Species.cpp
@@ -286,7 +286,7 @@ void Sigmod::Species::setMaxHoldWeight(const int maxHoldWeight)
CHECK(maxHoldWeight);
}
-void Sigmod::Species::setRunChance(const Fraction& runChance)
+void Sigmod::Species::setRunChance(const Sigcore::Fraction& runChance)
{
if (1 < runChance)
emit(error(bounds("runChance")));
@@ -294,7 +294,7 @@ void Sigmod::Species::setRunChance(const Fraction& runChance)
CHECK(runChance);
}
-void Sigmod::Species::setFleeChance(const Fraction& fleeChance)
+void Sigmod::Species::setFleeChance(const Sigcore::Fraction& fleeChance)
{
if (1 < fleeChance)
emit(error(bounds("fleeChance")));
@@ -302,7 +302,7 @@ void Sigmod::Species::setFleeChance(const Fraction& fleeChance)
CHECK(fleeChance);
}
-void Sigmod::Species::setItemChance(const Fraction& itemChance)
+void Sigmod::Species::setItemChance(const Sigcore::Fraction& itemChance)
{
if (1 < itemChance)
emit(error(bounds("itemChance")));
@@ -386,7 +386,7 @@ void Sigmod::Species::setSkin(const int skin)
CHECK(skin);
}
-void Sigmod::Species::setGenderFactor(const Fraction& genderFactor)
+void Sigmod::Species::setGenderFactor(const Sigcore::Fraction& genderFactor)
{
CHECK(genderFactor);
}
@@ -436,7 +436,7 @@ void Sigmod::Species::setEggGroup(const int eggGroup, const bool state)
}
}
-void Sigmod::Species::setEvolution(const Script& evolution)
+void Sigmod::Species::setEvolution(const Sigcore::Script& evolution)
{
CHECK(evolution);
}
@@ -494,17 +494,17 @@ int Sigmod::Species::maxHoldWeight() const
return m_maxHoldWeight;
}
-Sigmod::Fraction Sigmod::Species::runChance() const
+Sigcore::Fraction Sigmod::Species::runChance() const
{
return m_runChance;
}
-Sigmod::Fraction Sigmod::Species::fleeChance() const
+Sigcore::Fraction Sigmod::Species::fleeChance() const
{
return m_fleeChance;
}
-Sigmod::Fraction Sigmod::Species::itemChance() const
+Sigcore::Fraction Sigmod::Species::itemChance() const
{
return m_itemChance;
}
@@ -554,7 +554,7 @@ int Sigmod::Species::skin() const
return m_skin;
}
-Sigmod::Fraction Sigmod::Species::genderFactor() const
+Sigcore::Fraction Sigmod::Species::genderFactor() const
{
return m_genderFactor;
}
@@ -589,7 +589,7 @@ QList<int> Sigmod::Species::eggGroups() const
return m_eggGroup;
}
-Sigmod::Script Sigmod::Species::evolution() const
+Sigcore::Script Sigmod::Species::evolution() const
{
return m_evolution;
}
diff --git a/sigmod/Species.h b/sigmod/Species.h
index 5435ba0a..6ed8cdc4 100644
--- a/sigmod/Species.h
+++ b/sigmod/Species.h
@@ -18,10 +18,12 @@
#ifndef SIGMOD_SPECIES
#define SIGMOD_SPECIES
+// Sigcore includes
+#include "../sigcore/Fraction.h"
+#include "../sigcore/Script.h"
+
// Sigmod includes
-#include "Fraction.h"
#include "Object.h"
-#include "Script.h"
// Qt includes
#include <QtCore/QList>
@@ -69,9 +71,9 @@ class SIGMOD_EXPORT Species : public Object
void setExperienceValue(const int experienceValue);
void setCatchValue(const int catchValue);
void setMaxHoldWeight(const int maxHoldWeight);
- void setRunChance(const Fraction& runChance);
- void setFleeChance(const Fraction& fleeChance);
- void setItemChance(const Fraction& itemChance);
+ void setRunChance(const Sigcore::Fraction& runChance);
+ void setFleeChance(const Sigcore::Fraction& fleeChance);
+ void setItemChance(const Sigcore::Fraction& itemChance);
void setEncyclopediaNumber(const int encyclopediaNumber);
void setWeight(const int weight);
void setHeight(const int height);
@@ -80,13 +82,13 @@ class SIGMOD_EXPORT Species : public Object
void setBackMaleSprite(const int backMaleSprite);
void setFrontFemaleSprite(const int frontFemaleSprite);
void setBackFemaleSprite(const int backFemaleSprite);
- void setGenderFactor(const Fraction& genderFactor);
+ void setGenderFactor(const Sigcore::Fraction& genderFactor);
void setSkin(const int skin);
void setEggSpecies(const int eggSpecies);
void setEggSteps(const int eggSteps);
void setType(const int type, const bool state);
void setEggGroup(const int eggGroup, const bool state);
- void setEvolution(const Script& evolution);
+ void setEvolution(const Sigcore::Script& evolution);
QString name() const;
int baseStat(const Stat stat) const;
@@ -95,9 +97,9 @@ class SIGMOD_EXPORT Species : public Object
int experienceValue() const;
int catchValue() const;
int maxHoldWeight() const;
- Fraction runChance() const;
- Fraction fleeChance() const;
- Fraction itemChance() const;
+ Sigcore::Fraction runChance() const;
+ Sigcore::Fraction fleeChance() const;
+ Sigcore::Fraction itemChance() const;
int encyclopediaNumber() const;
int weight() const;
int height() const;
@@ -107,14 +109,14 @@ class SIGMOD_EXPORT Species : public Object
int frontFemaleSprite() const;
int backFemaleSprite() const;
int skin() const;
- Fraction genderFactor() const;
+ Sigcore::Fraction genderFactor() const;
int eggSpecies() const;
int eggSteps() const;
bool type(const int type) const;
QList<int> types() const;
bool eggGroup(const int eggGroup) const;
QList<int> eggGroups() const;
- Script evolution() const;
+ Sigcore::Script evolution() const;
const SpeciesAbility* ability(const int index) const;
SpeciesAbility* ability(const int index);
@@ -174,9 +176,9 @@ class SIGMOD_EXPORT Species : public Object
int m_experienceValue;
int m_catchValue;
int m_maxHoldWeight;
- Fraction m_runChance;
- Fraction m_fleeChance;
- Fraction m_itemChance;
+ Sigcore::Fraction m_runChance;
+ Sigcore::Fraction m_fleeChance;
+ Sigcore::Fraction m_itemChance;
int m_encyclopediaNumber;
int m_weight;
int m_height;
@@ -186,12 +188,12 @@ class SIGMOD_EXPORT Species : public Object
int m_backFemaleSprite;
int m_skin;
QString m_encyclopediaEntry;
- Fraction m_genderFactor;
+ Sigcore::Fraction m_genderFactor;
int m_eggSpecies;
int m_eggSteps;
QList<int> m_type;
QList<int> m_eggGroup;
- Script m_evolution;
+ Sigcore::Script m_evolution;
QList<SpeciesAbility*> m_abilities;
QList<SpeciesItem*> m_items;
QList<SpeciesMove*> m_moves;
diff --git a/sigmod/Status.cpp b/sigmod/Status.cpp
index fccb85d0..cbe98ba0 100644
--- a/sigmod/Status.cpp
+++ b/sigmod/Status.cpp
@@ -21,7 +21,6 @@
// Sigmod includes
#include "Macros.h"
#include "Sigmod.h"
-#include "Script.h"
Sigmod::Status::Status(const Status& status) :
Object(status.parent(), status.id())
@@ -84,12 +83,12 @@ void Sigmod::Status::setName(const QString& name)
CHECK(name);
}
-void Sigmod::Status::setBattleScript(const Script& battleScript)
+void Sigmod::Status::setBattleScript(const Sigcore::Script& battleScript)
{
CHECK(battleScript);
}
-void Sigmod::Status::setWorldScript(const Script& worldScript)
+void Sigmod::Status::setWorldScript(const Sigcore::Script& worldScript)
{
CHECK(worldScript);
}
@@ -99,12 +98,12 @@ QString Sigmod::Status::name() const
return m_name;
}
-Sigmod::Script Sigmod::Status::battleScript() const
+Sigcore::Script Sigmod::Status::battleScript() const
{
return m_battleScript;
}
-Sigmod::Script Sigmod::Status::worldScript() const
+Sigcore::Script Sigmod::Status::worldScript() const
{
return m_worldScript;
}
diff --git a/sigmod/Status.h b/sigmod/Status.h
index 47a611fa..fcfaf8f4 100644
--- a/sigmod/Status.h
+++ b/sigmod/Status.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_STATUS
#define SIGMOD_STATUS
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
namespace Sigmod
{
@@ -44,18 +46,18 @@ class SIGMOD_EXPORT Status : public Object
QDomElement save() const;
void setName(const QString& name);
- void setBattleScript(const Script& battleScript);
- void setWorldScript(const Script& worldScript);
+ void setBattleScript(const Sigcore::Script& battleScript);
+ void setWorldScript(const Sigcore::Script& worldScript);
QString name() const;
- Script battleScript() const;
- Script worldScript() const;
+ Sigcore::Script battleScript() const;
+ Sigcore::Script worldScript() const;
Status& operator=(const Status& rhs);
private:
QString m_name;
- Script m_battleScript;
- Script m_worldScript;
+ Sigcore::Script m_battleScript;
+ Sigcore::Script m_worldScript;
};
}
diff --git a/sigmod/Tile.cpp b/sigmod/Tile.cpp
index b5c9d6e0..56215332 100644
--- a/sigmod/Tile.cpp
+++ b/sigmod/Tile.cpp
@@ -101,7 +101,7 @@ void Sigmod::Tile::setFrom(const Direction direction, const bool state)
CHECK_ARRAY(from[direction], state);
}
-void Sigmod::Tile::setScript(const Script& script)
+void Sigmod::Tile::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -121,7 +121,7 @@ bool Sigmod::Tile::from(const Direction direction) const
return m_from[direction];
}
-Sigmod::Script Sigmod::Tile::script() const
+Sigcore::Script Sigmod::Tile::script() const
{
return m_script;
}
diff --git a/sigmod/Tile.h b/sigmod/Tile.h
index e64b037a..47ccb161 100644
--- a/sigmod/Tile.h
+++ b/sigmod/Tile.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_TILE
#define SIGMOD_TILE
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
namespace Sigmod
{
@@ -45,19 +47,19 @@ class SIGMOD_EXPORT Tile : public Object
void setName(const QString& name);
void setSprite(const int sprite);
void setFrom(const Direction direction, const bool state);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
QString name() const;
int sprite() const;
bool from(const Direction direction) const;
- Script script() const;
+ Sigcore::Script script() const;
Tile& operator=(const Tile& rhs);
private:
QString m_name;
int m_sprite;
QVarLengthArray<bool, D_Right - D_Up + 1> m_from;
- Script m_script;
+ Sigcore::Script m_script;
};
}
diff --git a/sigmod/Type.cpp b/sigmod/Type.cpp
index 9be9c0ac..1219d801 100644
--- a/sigmod/Type.cpp
+++ b/sigmod/Type.cpp
@@ -76,7 +76,7 @@ void Sigmod::Type::setName(const QString& name)
CHECK(name);
}
-void Sigmod::Type::setStab(const Fraction& stab)
+void Sigmod::Type::setStab(const Sigcore::Fraction& stab)
{
if (stab < 1)
emit(error(bounds("stab")));
@@ -89,7 +89,7 @@ QString Sigmod::Type::name() const
return m_name;
}
-Sigmod::Fraction Sigmod::Type::stab() const
+Sigcore::Fraction Sigmod::Type::stab() const
{
return m_stab;
}
diff --git a/sigmod/Type.h b/sigmod/Type.h
index 7cd2e813..b0b1f13f 100644
--- a/sigmod/Type.h
+++ b/sigmod/Type.h
@@ -18,8 +18,10 @@
#ifndef SIGMOD_TYPE
#define SIGMOD_TYPE
+// Sigcore includes
+#include "../sigcore/Fraction.h"
+
// Sigmod includes
-#include "Fraction.h"
#include "Object.h"
namespace Sigmod
@@ -43,15 +45,15 @@ class SIGMOD_EXPORT Type : public Object
QDomElement save() const;
void setName(const QString& name);
- void setStab(const Fraction& stab);
+ void setStab(const Sigcore::Fraction& stab);
QString name() const;
- Fraction stab() const;
+ Sigcore::Fraction stab() const;
Type& operator=(const Type& rhs);
private:
QString m_name;
- Fraction m_stab;
+ Sigcore::Fraction m_stab;
};
}
diff --git a/sigmod/Weather.cpp b/sigmod/Weather.cpp
index 5f8ac537..532643a4 100644
--- a/sigmod/Weather.cpp
+++ b/sigmod/Weather.cpp
@@ -18,10 +18,12 @@
// Header include
#include "Weather.h"
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Macros.h"
#include "Sigmod.h"
-#include "Script.h"
Sigmod::Weather::Weather(const Weather& weather) :
Object(weather.parent(), weather.id())
@@ -81,7 +83,7 @@ void Sigmod::Weather::setName(const QString& name)
CHECK(name);
}
-void Sigmod::Weather::setScript(const Script& script)
+void Sigmod::Weather::setScript(const Sigcore::Script& script)
{
CHECK(script);
}
@@ -91,7 +93,7 @@ QString Sigmod::Weather::name() const
return m_name;
}
-Sigmod::Script Sigmod::Weather::script() const
+Sigcore::Script Sigmod::Weather::script() const
{
return m_script;
}
diff --git a/sigmod/Weather.h b/sigmod/Weather.h
index 3ae60f69..897d772b 100644
--- a/sigmod/Weather.h
+++ b/sigmod/Weather.h
@@ -18,9 +18,11 @@
#ifndef SIGMOD_WEATHER
#define SIGMOD_WEATHER
+// Sigcore includes
+#include "../sigcore/Script.h"
+
// Sigmod includes
#include "Object.h"
-#include "Script.h"
namespace Sigmod
{
@@ -44,15 +46,15 @@ class SIGMOD_EXPORT Weather : public Object
QDomElement save() const;
void setName(const QString& name);
- void setScript(const Script& script);
+ void setScript(const Sigcore::Script& script);
QString name() const;
- Script script() const;
+ Sigcore::Script script() const;
Weather& operator=(const Weather& rhs);
private:
QString m_name;
- Script m_script;
+ Sigcore::Script m_script;
};
}