diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2007-07-21 01:39:22 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2007-07-21 01:39:22 +0000 |
| commit | e94d9893b8753e72adb92b2c5eb203830ddf641c (patch) | |
| tree | fe283d6ede1cfe1a1613742811fb5b34fb8db68c /pokemod/Item.cpp | |
| parent | 65cc463f1d91fe99acf1c4dd9bce7e0038593022 (diff) | |
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/Item.cpp')
| -rw-r--r-- | pokemod/Item.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index 452f3deb..ff732d2c 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -6,19 +6,18 @@ // Created: Tue Mar 20 18:16:29 2007
// Copyright: ©2007 Ben Boeckel and 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 "Item.h"
@@ -64,9 +63,9 @@ void PokeGen::PokeMod::Item::Validate() }
if (GetItemEffectCount())
{
- std::map<unsigned, unsigned> idChecker;
- std::map<String, unsigned> effectChecker;
- for (std::vector<ItemEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
+ QMap<unsigned, unsigned> idChecker;
+ QMap<QString, unsigned> effectChecker;
+ for (QList<ItemEffect>::Iterator i = effects.begin(); i != effects.end(); ++i)
{
LogSubmoduleIterate("Item", id, "effect", i->GetId(), name);
if (!i->IsValid())
@@ -74,19 +73,19 @@ void PokeGen::PokeMod::Item::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("Item", id, "effect", i->first, name);
+ LogDuplicateId("Item", 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("Item", id, "effect", i->first, name);
+ LogDuplicateSubmodule("Item", id, "effect", i.key(), name);
isValid = false;
}
}
@@ -119,7 +118,7 @@ void PokeGen::PokeMod::Item::ImportIni(Ini &ini, const unsigned _id) LogImportOver("Item", id, name);
}
-void PokeGen::PokeMod::Item::ExportIni(std::ofstream &fout) const
+void PokeGen::PokeMod::Item::ExportIni(QFile &fout) const
{
LogExportStart("Item", id, name);
// Make elements
@@ -131,12 +130,12 @@ void PokeGen::PokeMod::Item::ExportIni(std::ofstream &fout) const exItem.AddField("price", price);
exItem.AddField("description", description);
exItem.Export(fout);
- for (std::vector<ItemEffect>::const_iterator i = effects.begin(); i != effects.end(); ++i)
+ for (QList<ItemEffect>::ConstIterator i = effects.begin(); i != effects.end(); ++i)
i->ExportIni(fout, name);
LogExportOver("Item", id, name);
}
-void PokeGen::PokeMod::Item::SetName(const String &n)
+void PokeGen::PokeMod::Item::SetName(const QString &n)
{
LogSetVar("Item", id, "name", n);
name = n;
@@ -155,7 +154,7 @@ void PokeGen::PokeMod::Item::SetType(const unsigned t) type = t;
}
-void PokeGen::PokeMod::Item::SetType(const String &t)
+void PokeGen::PokeMod::Item::SetType(const QString &t)
{
LogSetVar("Item", id, "type string", t, name);
if (const ItemStorage *i = pokemod->GetItemStorage(t))
@@ -168,13 +167,13 @@ void PokeGen::PokeMod::Item::SetPrice(const unsigned p) price = p;
}
-void PokeGen::PokeMod::Item::SetDescription(const String &d)
+void PokeGen::PokeMod::Item::SetDescription(const QString &d)
{
LogSetVar("Item", id, "description", d, name);
description = d;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::Item::GetName() const
+QString PokeGen::PokeMod::Item::GetName() const
{
LogFetchVar("Item", id, "name", name);
return name;
@@ -192,7 +191,7 @@ unsigned PokeGen::PokeMod::Item::GetType() const return type;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::Item::GetTypeString() const
+QString PokeGen::PokeMod::Item::GetTypeString() const
{
LogFetchVar("Item", id, "type string", type, name);
if (const ItemStorage *i = pokemod->GetItemStorage(type))
@@ -206,7 +205,7 @@ unsigned PokeGen::PokeMod::Item::GetPrice() const return price;
}
-PokeGen::PokeMod::String PokeGen::PokeMod::Item::GetDescription() const
+QString PokeGen::PokeMod::Item::GetDescription() const
{
LogFetchVar("Item", id, "description", description, name);
return description;
@@ -242,13 +241,13 @@ void PokeGen::PokeMod::Item::NewItemEffect(Ini *const ini) if (ini)
newItemEffect.ImportIni(*ini);
LogSubmoduleNew("Item", id, "effect", i, name);
- effects.push_back(newItemEffect);
+ effects.append(newItemEffect);
}
void PokeGen::PokeMod::Item::DeleteItemEffect(const unsigned _id)
{
LogSubmoduleRemoveStart("Item", id, "effect", _id, name);
- for (std::vector<ItemEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
+ for (QList<ItemEffect>::Iterator i = effects.begin(); i != effects.end(); ++i)
{
if (i->GetId() == _id)
{
|
