summaryrefslogtreecommitdiffstats
path: root/pokemod/SpeciesMove.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-03-31 01:17:59 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-03-31 01:17:59 +0000
commit9a65bc6bb7c8da1dfa5b101579e52845c75848ef (patch)
tree258900f882a6998ac6fa525bd247e302028a8911 /pokemod/SpeciesMove.cpp
parent8e1ec2aec50999bae30625303f2c96e5b3b7f318 (diff)
downloadsigen-9a65bc6bb7c8da1dfa5b101579e52845c75848ef.tar.gz
sigen-9a65bc6bb7c8da1dfa5b101579e52845c75848ef.tar.xz
sigen-9a65bc6bb7c8da1dfa5b101579e52845c75848ef.zip
[FIX] Member variables now use m_ prefix
[FIX] Lots of minor fixes git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@95 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/SpeciesMove.cpp')
-rw-r--r--pokemod/SpeciesMove.cpp143
1 files changed, 70 insertions, 73 deletions
diff --git a/pokemod/SpeciesMove.cpp b/pokemod/SpeciesMove.cpp
index 9ee4e189..9f3cd9d2 100644
--- a/pokemod/SpeciesMove.cpp
+++ b/pokemod/SpeciesMove.cpp
@@ -1,134 +1,131 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokemod/SpeciesMove.cpp
-// Purpose: Define a move that a species can learn
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Mar 20 18:45:29 2007
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program. If not, see <http://www.gnu.org/licenses/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
+// Pokemod includes
#include "Pokemod.h"
+
+// Header include
#include "SpeciesMove.h"
-SpeciesMove::SpeciesMove(const Pokemod* par, const int _id) :
- Object("SpeciesMove", par, _id),
- move(-1),
- level(0),
- wild(0)
+SpeciesMove::SpeciesMove(const Pokemod* pokemod, const int id) :
+ Object("SpeciesMove", pokemod, id),
+ m_move(INT_MAX),
+ m_level(0),
+ m_wild(0)
{
}
-SpeciesMove::SpeciesMove(const Pokemod* par, const SpeciesMove& m, const int _id) :
- Object("SpeciesMove", par, _id)
+SpeciesMove::SpeciesMove(const Pokemod* pokemod, const SpeciesMove& move, const int id) :
+ Object("SpeciesMove", pokemod, id)
{
- *this = m;
+ *this = move;
}
-SpeciesMove::SpeciesMove(const Pokemod* par, const QString& fname, const int _id) :
- Object("SpeciesMove", par, _id)
+SpeciesMove::SpeciesMove(const Pokemod* pokemod, const QString& fileName, const int id) :
+ Object("SpeciesMove", pokemod, id)
{
- load(fname, _id);
+ load(fileName, id);
}
bool SpeciesMove::validate() const
{
bool valid = true;
- pokemod->validationMsg(QString("------Move with id %1---").arg(id), Pokemod::V_Msg);
- if (pokemod->getMoveIndex(move) == -1)
+ pokemod()->validationMsg(QString("------Move with id %1---").arg(id()), Pokemod::V_Msg);
+ if (pokemod()->moveIndex(m_move) == INT_MAX)
{
- pokemod->validationMsg("Invalid move");
+ pokemod()->validationMsg("Invalid move");
valid = false;
}
- if (level < pokemod->getRules()->getMaxLevel())
+ if (m_level < pokemod()->rules()->maxLevel())
{
- pokemod->validationMsg("Invalid level");
+ pokemod()->validationMsg("Invalid level");
valid = false;
}
- if (wild < pokemod->getRules()->getMaxLevel())
+ if (m_wild < pokemod()->rules()->maxLevel())
{
- pokemod->validationMsg("Invalid wild level");
+ pokemod()->validationMsg("Invalid wild level");
valid = false;
}
return valid;
}
-void SpeciesMove::load(const QString& fname, const int _id) throw(Exception)
+void SpeciesMove::load(const QString& fileName, int id) throw(Exception)
{
- Ini ini(fname);
- if (_id == -1)
+ Ini ini(fileName);
+ if (id == INT_MAX)
ini.getValue("id", id);
- else
- id = _id;
- ini.getValue("move", move);
- ini.getValue("level", level, 0);
- ini.getValue("wild", wild, 0);
+ setId(id);
+ ini.getValue("move", m_move);
+ ini.getValue("level", m_level, 0);
+ ini.getValue("wild", m_wild, 0);
}
void SpeciesMove::save(const QString& species) const throw(Exception)
{
Ini ini;
- ini.addField("id", id);
- ini.addField("move", move);
- ini.addField("level", level);
- ini.addField("wild", wild);
- ini.save(QString("%1/species/%2/move/%3.pini").arg(pokemod->getPath()).arg(species).arg(id));
+ ini.addField("id", id());
+ ini.addField("move", m_move);
+ ini.addField("level", m_level);
+ ini.addField("wild", m_wild);
+ ini.save(QString("%1/species/%2/move/%3.pini").arg(pokemod()->path()).arg(species).arg(id()));
}
-void SpeciesMove::setMove(const int m) throw(BoundsException)
+void SpeciesMove::setMove(const int move) throw(BoundsException)
{
- if (pokemod->getMoveIndex(m) == -1)
- throw(BoundsException(className, "move"));
- move = m;
+ if (pokemod()->moveIndex(move) == INT_MAX)
+ throw(BoundsException(className(), "move"));
+ m_move = move;
}
-void SpeciesMove::setLevel(const int l) throw(BoundsException)
+void SpeciesMove::setLevel(const int level) throw(BoundsException)
{
- if (pokemod->getRules()->getMaxLevel() <= l)
- throw(BoundsException(className, "level"));
- level = l;
+ if (pokemod()->rules()->maxLevel() <= level)
+ throw(BoundsException(className(), "level"));
+ m_level = level;
}
-void SpeciesMove::setWild(const int w) throw(BoundsException)
+void SpeciesMove::setWild(const int wild) throw(BoundsException)
{
- if (pokemod->getRules()->getMaxLevel() <= w)
- throw(BoundsException(className, "wild"));
- wild = w;
+ if (pokemod()->rules()->maxLevel() <= wild)
+ throw(BoundsException(className(), "wild"));
+ m_wild = wild;
}
-int SpeciesMove::getMove() const
+int SpeciesMove::move() const
{
- return move;
+ return m_move;
}
-int SpeciesMove::getLevel() const
+int SpeciesMove::level() const
{
- return level;
+ return m_level;
}
-int SpeciesMove::getWild() const
+int SpeciesMove::wild() const
{
- return wild;
+ return m_wild;
}
SpeciesMove& SpeciesMove::operator=(const SpeciesMove& rhs)
{
if (this == &rhs)
return *this;
- move = rhs.move;
- level = rhs.level;
- wild = rhs.wild;
+ m_move = rhs.m_move;
+ m_level = rhs.m_level;
+ m_wild = rhs.m_wild;
return *this;
}