summaryrefslogtreecommitdiffstats
path: root/pokemod/Status.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-07-21 01:39:22 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-07-21 01:39:22 +0000
commite94d9893b8753e72adb92b2c5eb203830ddf641c (patch)
treefe283d6ede1cfe1a1613742811fb5b34fb8db68c /pokemod/Status.cpp
parent65cc463f1d91fe99acf1c4dd9bce7e0038593022 (diff)
downloadsigen-e94d9893b8753e72adb92b2c5eb203830ddf641c.tar.gz
sigen-e94d9893b8753e72adb92b2c5eb203830ddf641c.tar.xz
sigen-e94d9893b8753e72adb92b2c5eb203830ddf641c.zip
Moved to GPLv3 and Qt4, Changed String -> QString, other minor fixes
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@23 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Status.cpp')
-rw-r--r--pokemod/Status.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/pokemod/Status.cpp b/pokemod/Status.cpp
index 0a90d1a0..75059ca7 100644
--- a/pokemod/Status.cpp
+++ b/pokemod/Status.cpp
@@ -7,19 +7,18 @@
// Created: Sat June 2 2007 12:00:45
// 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
// MERCHANTStatus 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 "Status.h"
@@ -90,9 +89,9 @@ void PokeGen::PokeMod::Status::Validate()
}
if (GetStatusEffectCount())
{
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> effectChecker;
- for (std::vector<StatusEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
+ QMap<unsigned, unsigned> idChecker;
+ QMap<QString, unsigned> effectChecker;
+ for (QList<StatusEffect>::Iterator i = effects.begin(); i != effects.end(); ++i)
{
LogSubmoduleIterate("Status", id, "effect", i->GetId(), name);
if (!i->IsValid())
@@ -100,19 +99,19 @@ void PokeGen::PokeMod::Status::Validate()
++idChecker[i->GetId()];
++effectChecker[i->GetEffectString()];
}
- for (std::map<unsigned, unsigned>::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i)
+ for (QMap<unsigned, unsigned>::ConstIterator i = idChecker.begin(); i != idChecker.end(); ++i)
{
- if (1 < i->second)
+ if (1 < i.value())
{
- LogDuplicateId("Status", id, "effect", i->first, name);
+ LogDuplicateId("Status", id, "effect", i.key(), name);
isValid = false;
}
}
- for (std::map<String, unsigned>::const_iterator i = effectChecker.begin(); i != effectChecker.end(); ++i)
+ for (QMap<QString, unsigned>::ConstIterator i = effectChecker.begin(); i != effectChecker.end(); ++i)
{
- if (1 < i->second)
+ if (1 < i.value())
{
- LogDuplicateSubmodule("Status", id, "effect", i->first, name);
+ LogDuplicateSubmodule("Status", id, "effect", i.key(), name);
isValid = false;
}
}
@@ -147,7 +146,7 @@ void PokeGen::PokeMod::Status::ImportIni(Ini &ini, const unsigned _id)
LogImportOver("Status", id, name);
}
-void PokeGen::PokeMod::Status::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::Status::ExportIni(QFile &fout) const
{
LogExportStart("Status", id, name);
Ini exStatus("Status");
@@ -160,25 +159,25 @@ void PokeGen::PokeMod::Status::ExportIni(std::ofstream &fout) const
exStatus.AddField("maxTurns", maxTurns);
exStatus.AddField("catchBonus", catchBonus);
exStatus.Export(fout);
- for (std::vector<StatusEffect>::const_iterator i = effects.begin(); i != effects.end(); ++i)
+ for (QList<StatusEffect>::ConstIterator i = effects.begin(); i != effects.end(); ++i)
i->ExportIni(fout, name);
LogExportOver("Status", id, name);
}
-void PokeGen::PokeMod::Status::SetName(const String &n)
+void PokeGen::PokeMod::Status::SetName(const QString &n)
{
LogSetVar("Status", id, "name", n);
name = n;
}
-void PokeGen::PokeMod::Status::SetAbbreviation(const String &a)
+void PokeGen::PokeMod::Status::SetAbbreviation(const QString &a)
{
LogSetVar("Status", id, "abbreviation", a, name);
if (a.length() < 4)
abbreviation = a;
}
-void PokeGen::PokeMod::Status::SetVerb(const String &v)
+void PokeGen::PokeMod::Status::SetVerb(const QString &v)
{
LogSetVar("Status", id, "verb", v, name);
verb = v;
@@ -191,7 +190,7 @@ void PokeGen::PokeMod::Status::SetAfterSwitch(const unsigned a)
afterSwitch = a;
}
-void PokeGen::PokeMod::Status::SetAfterSwitch(const String &a)
+void PokeGen::PokeMod::Status::SetAfterSwitch(const QString &a)
{
LogSetVar("Status", id, "afterSwitch string", a, name);
if (a == "Clear")
@@ -207,7 +206,7 @@ void PokeGen::PokeMod::Status::SetAfterBattle(const unsigned a)
afterBattle = a;
}
-void PokeGen::PokeMod::Status::SetAfterBattle(const String &a)
+void PokeGen::PokeMod::Status::SetAfterBattle(const QString &a)
{
LogSetVar("Status", id, "afterBattle string", a, name);
if (a == "Clear")
@@ -228,19 +227,19 @@ void PokeGen::PokeMod::Status::SetCatchBonus(const unsigned c)
catchBonus = c;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::Status::GetName() const
+QString PokeGen::PokeMod::Status::GetName() const
{
LogFetchVar("Status", id, "name", name);
return name;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::Status::GetAbbreviation() const
+QString PokeGen::PokeMod::Status::GetAbbreviation() const
{
LogFetchVar("Status", id, "abbreviation", abbreviation, name);
return abbreviation;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::Status::GetVerb() const
+QString PokeGen::PokeMod::Status::GetVerb() const
{
LogFetchVar("Status", id, "verb", verb, name);
return verb;
@@ -252,7 +251,7 @@ unsigned PokeGen::PokeMod::Status::GetAfterSwitch() const
return afterSwitch;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::Status::GetAfterSwitchString() const
+QString PokeGen::PokeMod::Status::GetAfterSwitchString() const
{
LogFetchVar("Status", id, "afterSwitch string", afterSwitch, name);
if (const Status *s = pokemod->GetStatus(afterSwitch))
@@ -266,7 +265,7 @@ unsigned PokeGen::PokeMod::Status::GetAfterBattle() const
return afterBattle;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::Status::GetAfterBattleString() const
+QString PokeGen::PokeMod::Status::GetAfterBattleString() const
{
LogFetchVar("Status", id, "afterBattle string", afterBattle, name);
if (const Status *s = pokemod->GetStatus(afterBattle))
@@ -316,13 +315,13 @@ void PokeGen::PokeMod::Status::NewStatusEffect(Ini *const ini)
if (ini)
newStatusEffect.ImportIni(*ini);
LogSubmoduleNew("Status", id, "effect", i, name);
- effects.push_back(newStatusEffect);
+ effects.append(newStatusEffect);
}
void PokeGen::PokeMod::Status::DeleteStatusEffect(const unsigned _id)
{
LogSubmoduleRemoveStart("Status", id, "effect", _id, name);
- for (std::vector<StatusEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
+ for (QList<StatusEffect>::Iterator i = effects.begin(); i != effects.end(); ++i)
{
if (i->GetId() == _id)
{