summaryrefslogtreecommitdiffstats
path: root/pokemod/CoinList.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-06-01 02:54:29 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-06-01 02:54:29 +0000
commitf71140fae5218ee9839ffcd4ec83abfded5124f4 (patch)
tree9af8f2174728cedb93580411223bc59fd9a86d0a /pokemod/CoinList.cpp
parent9e28e6ecd358a9801ad25914d3e8cca7b6d7f4f7 (diff)
downloadsigen-f71140fae5218ee9839ffcd4ec83abfded5124f4.tar.gz
sigen-f71140fae5218ee9839ffcd4ec83abfded5124f4.tar.xz
sigen-f71140fae5218ee9839ffcd4ec83abfded5124f4.zip
Added Map and Tile, added Hat class, and fixed up some other minor things
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@17 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/CoinList.cpp')
-rw-r--r--pokemod/CoinList.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index e2919f8f..becd28f8 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -50,7 +50,6 @@ PokeGen::PokeMod::CoinList::~CoinList()
void PokeGen::PokeMod::CoinList::Validate()
{
- isValid = true;
LogValidateStart("CoinList", id, name);
if (name == "")
{
@@ -77,7 +76,6 @@ void PokeGen::PokeMod::CoinList::Validate()
#ifdef PG_DEBUG_WINDOW
void PokeGen::PokeMod::CoinList::Validate(const wxListBox &output)
{
- isValid = true;
LogValidateStart("CoinList", id, name);
if (name == "")
{
@@ -160,7 +158,7 @@ unsigned PokeGen::PokeMod::CoinList::GetValue() const
return value;
}
-PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const unsigned _id)
+const PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const unsigned _id) const
{
LogSubmoduleFetch("CoinList", id, "item", _id, name);
for (unsigned i = 0; i < GetCoinItemCount(); ++i)
@@ -172,6 +170,18 @@ PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const unsign
return NULL;
}
+const PokeGen::PokeMod::CoinItem *PokeGen::PokeMod::CoinList::GetCoinItem(const String &n) const
+{
+ LogSubmoduleFetch("CoinList", id, "item", n, name);
+ for (unsigned i = 0; i < GetCoinItemCount(); ++i)
+ {
+ if (items[i].GetObjectString() == n)
+ return &items[i];
+ }
+ LogSubmoduleFetchFail("CoinList", id, "item", n, name);
+ return NULL;
+}
+
unsigned PokeGen::PokeMod::CoinList::GetCoinItemCount() const
{
LogSubmoduleCount("CoinList", id, "items", name);
@@ -197,7 +207,7 @@ void PokeGen::PokeMod::CoinList::NewCoinItem(Ini *const ini)
void PokeGen::PokeMod::CoinList::DeleteCoinItem(const unsigned _id)
{
LogSubmoduleRemoveStart("CoinList", id, "item", _id, name);
- for (std::vector<CoinItem>::iterator i = items.begin(); i != items.end(); ++i)
+ for (std::vector<CoinItem>::const_iterator i = items.begin(); i != items.end(); ++i)
{
if (i->GetId() == _id)
{
@@ -207,3 +217,17 @@ void PokeGen::PokeMod::CoinList::DeleteCoinItem(const unsigned _id)
}
LogSubmoduleRemoveFail("CoinList", id, "item", _id, name);
}
+
+void PokeGen::PokeMod::CoinList::DeleteCoinItem(const String &n)
+{
+ LogSubmoduleRemoveStart("CoinList", id, "item", n, name);
+ for (std::vector<CoinItem>::const_iterator i = items.begin(); i != items.end(); ++i)
+ {
+ if (i->GetObjectString() == n)
+ {
+ LogSubmoduleRemoved("CoinList", id, "item", n, name);
+ items.erase(i);
+ }
+ }
+ LogSubmoduleRemoveFail("CoinList", id, "item", n, name);
+}