From e94d9893b8753e72adb92b2c5eb203830ddf641c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 21 Jul 2007 01:39:22 +0000 Subject: 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 --- pokemod/CoinList.cpp | 55 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'pokemod/CoinList.cpp') diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp index 73f611cb..15c61169 100644 --- a/pokemod/CoinList.cpp +++ b/pokemod/CoinList.cpp @@ -7,19 +7,18 @@ // Created: Wed Feb 28 21: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 . ///////////////////////////////////////////////////////////////////////////// #include "CoinList.h" @@ -57,10 +56,10 @@ void PokeGen::PokeMod::CoinList::Validate() } if (GetCoinItemCount()) { - std::map idChecker; - std::map itemChecker; - std::map pokemonChecker; - for (std::vector::iterator i = items.begin(); i != items.end(); ++i) + QMap idChecker; + QMap itemChecker; + QMap pokemonChecker; + for (QList::Iterator i = items.begin(); i != items.end(); ++i) { LogSubmoduleIterate("CoinList", id, "item", i->GetId(), name); if (!i->IsValid()) @@ -71,27 +70,27 @@ void PokeGen::PokeMod::CoinList::Validate() else if (i->GetType() == CIT_POKEMON) ++pokemonChecker[i->GetObjectString()]; } - for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) + for (QMap::ConstIterator i = idChecker.begin(); i != idChecker.end(); ++i) { - if (1 < i->second) + if (1 < i.value()) { - LogDuplicateId("CoinList", id, "coin item", i->first, name); + LogDuplicateId("CoinList", id, "coin item", i.key(), name); isValid = false; } } - for (std::map::const_iterator i = itemChecker.begin(); i != itemChecker.end(); ++i) + for (QMap::ConstIterator i = itemChecker.begin(); i != itemChecker.end(); ++i) { - if (1 < i->second) + if (1 < i.value()) { - LogDuplicateSubmodule("CoinList", id, "item", i->first, name); + LogDuplicateSubmodule("CoinList", id, "item", i.key(), name); isValid = false; } } - for (std::map::const_iterator i = pokemonChecker.begin(); i != pokemonChecker.end(); ++i) + for (QMap::ConstIterator i = pokemonChecker.begin(); i != pokemonChecker.end(); ++i) { - if (1 < i->second) + if (1 < i.value()) { - LogDuplicateSubmodule("CoinList", id, "Pokémon", i->first, name); + LogDuplicateSubmodule("CoinList", id, "Pokémon", i.key(), name); isValid = false; } } @@ -121,7 +120,7 @@ void PokeGen::PokeMod::CoinList::ImportIni(Ini &ini, const unsigned _id) LogImportOver("CoinList", id, name); } -void PokeGen::PokeMod::CoinList::ExportIni(std::ofstream &fout) const +void PokeGen::PokeMod::CoinList::ExportIni(QFile &fout) const { LogExportStart("CoinList", id, name); Ini exCoinList("coinList"); @@ -129,12 +128,12 @@ void PokeGen::PokeMod::CoinList::ExportIni(std::ofstream &fout) const exCoinList.AddField("name", name); exCoinList.AddField("value", value); exCoinList.Export(fout); - for (std::vector::const_iterator i = items.begin(); i != items.end(); ++i) + for (QList::ConstIterator i = items.begin(); i != items.end(); ++i) i->ExportIni(fout, name); LogExportOver("CoinList", id, name); } -void PokeGen::PokeMod::CoinList::SetName(const String &n) +void PokeGen::PokeMod::CoinList::SetName(const QString &n) { LogSetVar("CoinList", id, "name", n, name); name = n; @@ -146,7 +145,7 @@ void PokeGen::PokeMod::CoinList::SetValue(const unsigned v) value = v; } -PokeGen::PokeMod::String PokeGen::PokeMod::CoinList::GetName() const +QString PokeGen::PokeMod::CoinList::GetName() const { LogFetchVar("CoinList", id, "name", name, name); return name; @@ -170,7 +169,7 @@ const PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const return NULL; } -const PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const String &n) const +const PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const QString &n) const { LogSubmoduleFetch("CoinList", id, "item", n, name); for (unsigned i = 0; i < GetCoinItemCount(); ++i) @@ -200,13 +199,13 @@ void PokeGen::PokeMod::CoinList::NewCoinItem(Ini *const ini) if (ini) newCoinItem.ImportIni(*ini); LogSubmoduleNew("CoinList", id, "item", i, name); - items.push_back(newCoinItem); + items.append(newCoinItem); } void PokeGen::PokeMod::CoinList::DeleteCoinItem(const unsigned _id) { LogSubmoduleRemoveStart("CoinList", id, "item", _id, name); - for (std::vector::iterator i = items.begin(); i != items.end(); ++i) + for (QList::Iterator i = items.begin(); i != items.end(); ++i) { if (i->GetId() == _id) { @@ -217,10 +216,10 @@ void PokeGen::PokeMod::CoinList::DeleteCoinItem(const unsigned _id) LogSubmoduleRemoveFail("CoinList", id, "item", _id, name); } -void PokeGen::PokeMod::CoinList::DeleteCoinItem(const String &n) +void PokeGen::PokeMod::CoinList::DeleteCoinItem(const QString &n) { LogSubmoduleRemoveStart("CoinList", id, "item", n, name); - for (std::vector::iterator i = items.begin(); i != items.end(); ++i) + for (QList::Iterator i = items.begin(); i != items.end(); ++i) { if (i->GetObjectString() == n) { -- cgit