diff options
Diffstat (limited to 'pokemod/Nature.cpp')
| -rw-r--r-- | pokemod/Nature.cpp | 160 |
1 files changed, 79 insertions, 81 deletions
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp index fdc724a5..86a874ca 100644 --- a/pokemod/Nature.cpp +++ b/pokemod/Nature.cpp @@ -6,28 +6,27 @@ // Created: Sun Mar 18 22:58:48 2007
// Copyright: ©2007 Nerdy Productions
// Licence:
-// This program is free software; you can redistribute it and/or modify
+// 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 2 of the License, or
+// 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, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
#include "Nature.h"
PokeGen::PokeMod::Nature::Nature(const Pokemod *par, const unsigned _id) :
- name("") + name("")
{
- LogCtor("Nature", _id); - for (unsigned i = 0; i < STH_END_GSC; ++i) + LogCtor("Nature", _id);
+ for (unsigned i = 0; i < STH_END_GSC; ++i)
stats[i].Set(1, 1, true);
id = _id;
pokemod = par;
@@ -54,14 +53,13 @@ void PokeGen::PokeMod::Nature::Validate() {
LogVarNotSet("Nature", id, "name");
isValid = false;
- } + }
LogValidateOver("Nature", id, isValid, name);
}
void PokeGen::PokeMod::Nature::ImportIni(Ini &ini, const unsigned _id)
{
LogImportStart("Nature");
- String curName;
if (_id == UINT_MAX)
{
ini.GetValue("id", id);
@@ -69,93 +67,93 @@ void PokeGen::PokeMod::Nature::ImportIni(Ini &ini, const unsigned _id) LogIdNotFound("Nature");
}
else
- id = _id; - unsigned i; + id = _id;
+ unsigned i;
unsigned j;
ini.GetValue("name", name);
- for (unsigned k = 0; k < STH_END_GSC; ++k) - { - ini.GetValue(String("stat-%u-n", k), i, 1); - ini.GetValue(String("stat-%u-n", k), j, 1); - stats[k].Set(1, 1, true); - } + for (unsigned k = 0; k < STH_END_GSC; ++k)
+ {
+ ini.GetValue(QString("stat-%u-n", k), i, 1);
+ ini.GetValue(QString("stat-%u-n", k), j, 1);
+ stats[k].Set(1, 1, true);
+ }
LogImportOver("Nature");
}
-void PokeGen::PokeMod::Nature::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::Nature::ExportIni(QFile &fout) const
{
LogExportStart("Nature", id, name);
Ini exNature("nature");
- exNature.AddField("name", name); - for (unsigned i = 0; i < STH_END_GSC; ++i) - { - exNature.AddField(String("stat-%u-n", i), stats[i].GetNum()); - exNature.AddField(String("stat-%u-d", i), stats[i].GetNum()); + exNature.AddField("name", name);
+ for (unsigned i = 0; i < STH_END_GSC; ++i)
+ {
+ exNature.AddField(QString("stat-%u-n", i), stats[i].GetNum());
+ exNature.AddField(QString("stat-%u-d", i), stats[i].GetNum());
}
- exNature.Export(fout); + exNature.Export(fout);
LogExportOver("Nature", id, name);
}
-void PokeGen::PokeMod::Nature::SetName(const String &n)
+void PokeGen::PokeMod::Nature::SetName(const QString &n)
{
LogSetVar("Nature", id, "name", n);
name = n;
-} - -void PokeGen::PokeMod::Nature::SetStat(const unsigned s, const Frac &m) -{ - LogSetVar("Nature", id, String("stat[%u]", s), m.GetNum(), m.GetDenom(), name); - if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY)) - stats[s] = m; -} - -void PokeGen::PokeMod::Nature::SetStat(const unsigned s, const unsigned n, const unsigned d) -{ - LogSetVar("Nature", id, String("stat[%u]", s), n, d, name); - if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY)) - stats[s].Set(n, d); -} - -void PokeGen::PokeMod::Nature::SetStatNum(const unsigned s, const unsigned n) -{ - LogSetVar("Nature", id, String("stat[%u] numerator", s), n, name); - if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY)) - stats[s].SetNum(n); -} - -void PokeGen::PokeMod::Nature::SetStatDenom(const unsigned s, const unsigned d) -{ - LogSetVar("Nature", id, String("stat[%u] denominator", s), d, name); - if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY)) - stats[s].SetDenom(d); -} - -PokeGen::PokeMod::String PokeGen::PokeMod::Nature::GetName() const
+}
+
+void PokeGen::PokeMod::Nature::SetStat(const unsigned s, const Frac &m)
+{
+ LogSetVar("Nature", id, QString("stat[%u]", s), m.GetNum(), m.GetDenom(), name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s] = m;
+}
+
+void PokeGen::PokeMod::Nature::SetStat(const unsigned s, const unsigned n, const unsigned d)
+{
+ LogSetVar("Nature", id, QString("stat[%u]", s), n, d, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].Set(n, d);
+}
+
+void PokeGen::PokeMod::Nature::SetStatNum(const unsigned s, const unsigned n)
+{
+ LogSetVar("Nature", id, QString("stat[%u] numerator", s), n, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].SetNum(n);
+}
+
+void PokeGen::PokeMod::Nature::SetStatDenom(const unsigned s, const unsigned d)
+{
+ LogSetVar("Nature", id, QString("stat[%u] denominator", s), d, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ stats[s].SetDenom(d);
+}
+
+QString PokeGen::PokeMod::Nature::GetName() const
{
LogFetchVar("Nature", id, "name", name);
return name;
}
-PokeGen::PokeMod::Frac PokeGen::PokeMod::Nature::GetStat(const unsigned s) const -{ - LogFetchVar("Nature", id, String("stat[%u]", s), 0, name); - if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY)) - return stats[s]; - return Frac(1, 1, true); -} - -unsigned PokeGen::PokeMod::Nature::GetStatNum(const unsigned s) const -{ - LogFetchVar("Nature", id, String("stat[%u] numerator", s), 0, name); - if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY)) - return stats[s].GetNum(); - return 1; -} - -unsigned PokeGen::PokeMod::Nature::GetStatDenom(const unsigned s) const -{ - LogFetchVar("Nature", id, String("stat[%u] denominator", s), 0, name); - if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY)) - return stats[s].GetDenom(); - return 1; -} +PokeGen::PokeMod::Frac PokeGen::PokeMod::Nature::GetStat(const unsigned s) const
+{
+ LogFetchVar("Nature", id, QString("stat[%u]", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ return stats[s];
+ return Frac(1, 1, true);
+}
+
+unsigned PokeGen::PokeMod::Nature::GetStatNum(const unsigned s) const
+{
+ LogFetchVar("Nature", id, QString("stat[%u] numerator", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ return stats[s].GetNum();
+ return 1;
+}
+
+unsigned PokeGen::PokeMod::Nature::GetStatDenom(const unsigned s) const
+{
+ LogFetchVar("Nature", id, QString("stat[%u] denominator", s), 0, name);
+ if (s < (pokemod->IsSpecialSplit() ? STH_END_GSC : STH_END_RBY))
+ return stats[s].GetDenom();
+ return 1;
+}
|
