summaryrefslogtreecommitdiffstats
path: root/sigmod
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-02-24 13:35:23 -0500
committerBen Boeckel <MathStuf@gmail.com>2009-02-24 13:35:23 -0500
commitfcaaf9994b50bbd2436230c8ee2fff6f3bf28266 (patch)
tree32b69b09c7abb841bdd8bd1c1be0818b3dfbc30f /sigmod
parentecfd6c40473a9eabaa1fd7d8c343fe5e5bb195c3 (diff)
downloadsigen-fcaaf9994b50bbd2436230c8ee2fff6f3bf28266.tar.gz
sigen-fcaaf9994b50bbd2436230c8ee2fff6f3bf28266.tar.xz
sigen-fcaaf9994b50bbd2436230c8ee2fff6f3bf28266.zip
Fix up Game internally
Diffstat (limited to 'sigmod')
-rw-r--r--sigmod/Game.cpp142
-rw-r--r--sigmod/Game.h34
2 files changed, 88 insertions, 88 deletions
diff --git a/sigmod/Game.cpp b/sigmod/Game.cpp
index 8a829be9..3c7e7442 100644
--- a/sigmod/Game.cpp
+++ b/sigmod/Game.cpp
@@ -16,7 +16,7 @@
*/
// Header include
-#include "Sigmod.h"
+#include "Game.h"
// Sigmod includes
#include "Ability.h"
@@ -50,7 +50,7 @@
using namespace Sigcore;
using namespace Sigmod;
-Sigmod::Sigmod() :
+Game::Game() :
Object(NULL, 0),
m_title(""),
m_version(""),
@@ -62,27 +62,27 @@ Sigmod::Sigmod() :
{
}
-Sigmod::Sigmod(const Sigmod& sigmod) :
+Game::Game(const Game& game) :
Object(NULL, 0),
m_rules(new Rules(this))
{
- *this = sigmod;
+ *this = game;
}
-Sigmod::Sigmod(const QDomElement& xml) :
+Game::Game(const QDomElement& xml) :
Object(NULL, 0),
m_rules(new Rules(this))
{
load(xml);
}
-Sigmod::~Sigmod()
+Game::~Game()
{
delete m_rules;
clear();
}
-void Sigmod::validate()
+void Game::validate()
{
TEST_BEGIN();
if (m_title.isEmpty())
@@ -270,7 +270,7 @@ void Sigmod::validate()
TEST_END();
}
-void Sigmod::load(const QDomElement& xml)
+void Game::load(const QDomElement& xml)
{
LOAD_BEGIN();
LOAD(title);
@@ -305,7 +305,7 @@ void Sigmod::load(const QDomElement& xml)
m_typechart.resize(typeCount(), typeCount());
}
-QDomElement Sigmod::save() const
+QDomElement Game::save() const
{
QDomElement xml = QDomDocument().createElement(className());
SAVE(title);
@@ -340,107 +340,107 @@ QDomElement Sigmod::save() const
return xml;
}
-SETTER(Sigmod, QString&, Title, title)
-SETTER(Sigmod, QString&, Version, version)
-SETTER(Sigmod, QString&, Description, description)
-SETTER(Sigmod, bool, SinglePlayer, singlePlayer)
-SETTER(Sigmod, Script&, StartScript, startScript)
-SETTER_MATRIX(Sigmod, Fraction&, Typechart, typechart, multiplier)
+SETTER(Game, QString&, Title, title)
+SETTER(Game, QString&, Version, version)
+SETTER(Game, QString&, Description, description)
+SETTER(Game, bool, SinglePlayer, singlePlayer)
+SETTER(Game, Script&, StartScript, startScript)
+SETTER_MATRIX(Game, Fraction&, Typechart, typechart, multiplier)
-void Sigmod::setRules(const Rules& rules)
+void Game::setRules(const Rules& rules)
{
*m_rules = rules;
}
-void Sigmod::setRules(const QDomElement& xml)
+void Game::setRules(const QDomElement& xml)
{
m_rules->load(xml);
}
-GETTER(Sigmod, QString, title)
-GETTER(Sigmod, QString, version)
-GETTER(Sigmod, QString, description)
-GETTER(Sigmod, bool, singlePlayer)
-GETTER(Sigmod, Script, startScript)
+GETTER(Game, QString, title)
+GETTER(Game, QString, version)
+GETTER(Game, QString, description)
+GETTER(Game, bool, singlePlayer)
+GETTER(Game, Script, startScript)
-const Matrix<Fraction>* Sigmod::typechart() const
+const Matrix<Fraction>* Game::typechart() const
{
return &m_typechart;
}
-Matrix<Fraction>* Sigmod::typechart()
+Matrix<Fraction>* Game::typechart()
{
return &m_typechart;
}
-Fraction Sigmod::typechart(const int attack, const int defense) const
+Fraction Game::typechart(const int attack, const int defense) const
{
return m_typechart(attack, defense);
}
-const Rules* Sigmod::rules() const
+const Rules* Game::rules() const
{
return m_rules;
}
-Rules* Sigmod::rules()
+Rules* Game::rules()
{
return m_rules;
}
-CHECK(Sigmod, QString&, title)
-CHECK(Sigmod, QString&, version)
-CHECK(Sigmod, QString&, description)
-CHECK(Sigmod, bool, singlePlayer)
-CHECK(Sigmod, Script&, startScript)
-CHECK_BOUNDS(Sigmod, Fraction&, typechart, 0, INT_MAX)
-
-SSUBCLASS(Sigmod, Ability, ability, abilities)
-SSUBCLASS(Sigmod, Author, author, authors)
-SSUBCLASS(Sigmod, Badge, badge, badges)
-SSUBCLASS(Sigmod, CoinList, coinList, coinLists)
-SSUBCLASS(Sigmod, EggGroup, eggGroup, eggGroups)
-SSUBCLASS(Sigmod, GlobalScript, globalScript, globalScripts)
-SSUBCLASS(Sigmod, Item, item, items)
-SSUBCLASS(Sigmod, ItemType, itemType, itemTypes)
-SSUBCLASS(Sigmod, Map, map, maps)
-SSUBCLASS(Sigmod, Move, move, moves)
-SSUBCLASS(Sigmod, Nature, nature, natures)
-SSUBCLASS(Sigmod, Skin, skin, skins)
-SSUBCLASS(Sigmod, Sound, sound, sounds)
-SSUBCLASS(Sigmod, Species, species, species)
-SSUBCLASS(Sigmod, Sprite, sprite, sprites)
-SSUBCLASS(Sigmod, Status, status, status)
-SSUBCLASS(Sigmod, Store, store, stores)
-SSUBCLASS(Sigmod, Tile, tile, tiles)
-SSUBCLASS(Sigmod, Time, time, times)
-SSUBCLASS(Sigmod, Trainer, trainer, trainers)
-
-const Sigmod::Type* Sigmod::type(const int index) const
+CHECK(Game, QString&, title)
+CHECK(Game, QString&, version)
+CHECK(Game, QString&, description)
+CHECK(Game, bool, singlePlayer)
+CHECK(Game, Script&, startScript)
+CHECK_BOUNDS(Game, Fraction&, typechart, 0, INT_MAX)
+
+SSUBCLASS(Game, Ability, ability, abilities)
+SSUBCLASS(Game, Author, author, authors)
+SSUBCLASS(Game, Badge, badge, badges)
+SSUBCLASS(Game, CoinList, coinList, coinLists)
+SSUBCLASS(Game, EggGroup, eggGroup, eggGroups)
+SSUBCLASS(Game, GlobalScript, globalScript, globalScripts)
+SSUBCLASS(Game, Item, item, items)
+SSUBCLASS(Game, ItemType, itemType, itemTypes)
+SSUBCLASS(Game, Map, map, maps)
+SSUBCLASS(Game, Move, move, moves)
+SSUBCLASS(Game, Nature, nature, natures)
+SSUBCLASS(Game, Skin, skin, skins)
+SSUBCLASS(Game, Sound, sound, sounds)
+SSUBCLASS(Game, Species, species, species)
+SSUBCLASS(Game, Sprite, sprite, sprites)
+SSUBCLASS(Game, Status, status, status)
+SSUBCLASS(Game, Store, store, stores)
+SSUBCLASS(Game, Tile, tile, tiles)
+SSUBCLASS(Game, Time, time, times)
+SSUBCLASS(Game, Trainer, trainer, trainers)
+
+const Type* Game::type(const int index) const
{
if (index < typeCount())
return m_types.at(index);
return NULL;
}
-Sigmod::Type* Sigmod::type(const int index)
+Type* Game::type(const int index)
{
if (index < typeCount())
return m_types[index];
return NULL;
}
-const Sigmod::Type* Sigmod::typeById(const int id) const
+const Type* Game::typeById(const int id) const
{
return type(typeIndex(id));
}
-Sigmod::Type* Sigmod::typeById(const int id)
+Type* Game::typeById(const int id)
{
return type(typeIndex(id));
}
-int Sigmod::typeIndex(const int id) const
+int Game::typeIndex(const int id) const
{
for (int i = 0; i < typeCount(); ++i)
{
@@ -450,34 +450,34 @@ int Sigmod::typeIndex(const int id) const
return INT_MAX;
}
-int Sigmod::typeCount() const
+int Game::typeCount() const
{
return m_types.size();
}
-Sigmod::Type* Sigmod::newType()
+Type* Game::newType()
{
return newType(new Type(this, newTypeId()));
}
-Sigmod::Type* Sigmod::newType(const QDomElement& xml)
+Type* Game::newType(const QDomElement& xml)
{
return newType(new Type(xml, this, newTypeId()));
}
-Sigmod::Type* Sigmod::newType(const Type& type)
+Type* Game::newType(const Type& type)
{
return newType(new Type(type, this, newTypeId()));
}
-Sigmod::Type* Sigmod::newType(Type* type)
+Type* Game::newType(Type* type)
{
m_types.append(type);
m_typechart.resize(typeCount(), typeCount(), Sigcore::Fraction(1, 1));
return type;
}
-void Sigmod::deleteType(const int index)
+void Game::deleteType(const int index)
{
if (index < typeCount())
{
@@ -487,12 +487,12 @@ void Sigmod::deleteType(const int index)
}
}
-void Sigmod::deleteTypeById(const int id)
+void Game::deleteTypeById(const int id)
{
deleteType(typeIndex(id));
}
-int Sigmod::newTypeId() const
+int Game::newTypeId() const
{
int i = 0;
while ((i < typeCount()) && (typeIndex(i) != INT_MAX))
@@ -500,9 +500,9 @@ int Sigmod::newTypeId() const
return i;
}
-SSUBCLASS(Sigmod, Weather, weather, weathers)
+SSUBCLASS(Game, Weather, weather, weathers)
-Sigmod::Sigmod& Sigmod::operator=(const Sigmod& rhs)
+Game& Game::operator=(const Game& rhs)
{
if (this == &rhs)
return *this;
@@ -540,7 +540,7 @@ Sigmod::Sigmod& Sigmod::operator=(const Sigmod& rhs)
return *this;
}
-void Sigmod::clear()
+void Game::clear()
{
SUBCLASS_CLEAR(abilities);
SUBCLASS_CLEAR(badges);
diff --git a/sigmod/Game.h b/sigmod/Game.h
index 8140a956..1d39a02e 100644
--- a/sigmod/Game.h
+++ b/sigmod/Game.h
@@ -16,11 +16,11 @@
*/
/**
- * \file sigmod/Sigmod.h
+ * \file sigmod/Game.h
*/
-#ifndef SIGMOD_SIGMOD
-#define SIGMOD_SIGMOD
+#ifndef SIGMOD_GAME
+#define SIGMOD_GAME
// Sigcore includes
#include <sigcore/Fraction.h>
@@ -61,15 +61,15 @@ class Type;
class Weather;
/**
- * \class Sigmod::Sigmod Sigmod.h sigmod/Sigmod.h
- * \brief Main class used to create and manage Sigmods.
+ * \class Sigmod::Game Game.h sigmod/Game.h
+ * \brief Main class that describes a Sigmod.
*
- * The Sigmod class describes an entire set of objects for use with the game engine.
- * Games will refuse to run if the \link Sigmod::validate validate \endlink returns
- * any errors. Warnings will not stop the engine from running the Sigmod, but they
- * should be minimized.
+ * The Game class describes an entire set of objects for use with the game engine.
+ * Games will refuse to run if the \link Game::validate validate \endlink method
+ * returns any errors. Warnings will not stop the engine from running the Sigmod,
+ * but they should be minimized.
*/
-class SIGMOD_EXPORT Sigmod : public Object
+class SIGMOD_EXPORT Game : public Object
{
Q_OBJECT
@@ -77,26 +77,26 @@ class SIGMOD_EXPORT Sigmod : public Object
/**
* Default constructor.
*/
- Sigmod();
+ Game();
/**
* Copy constructor.
*
- * \param sigmod The Sigmod to copy.
+ * \param sigmod The game to copy.
*/
- Sigmod(const Sigmod& sigmod);
+ Game(const Game& game);
/**
* XML data constructor.
*
* \param xml The XML structure to extract the data from.
*/
- Sigmod(const QDomElement& xml);
+ Game(const QDomElement& xml);
/**
* Destructor.
*/
- ~Sigmod();
+ ~Game();
/**
- * Check to make sure the Sigmod is valid.
+ * Check to make sure the game is valid.
*/
void validate();
@@ -404,7 +404,7 @@ class SIGMOD_EXPORT Sigmod : public Object
void deleteWeather(const int index);
void deleteWeatherById(const int id);
- Sigmod& operator=(const Sigmod& rhs);
+ Game& operator=(const Game& rhs);
private:
int newAbilityId() const;
Ability* newAbility(Ability* ability);