From c9afda3ab74614fb36986f96b7972c082f275eca Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 2 Jun 2007 18:12:48 +0000 Subject: Finished off all PokeMod classes, added move validations, fixed up some GUI, various other fixes git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@18 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- pokemod/MapWildList.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'pokemod/MapWildList.cpp') diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp index 065aa68a..d7dab5f5 100644 --- a/pokemod/MapWildList.cpp +++ b/pokemod/MapWildList.cpp @@ -25,14 +25,12 @@ extern PokeGen::PokeMod::Pokemod curPokeMod; -PokeGen::PokeMod::MapWildList::MapWildList(const unsigned _id) +PokeGen::PokeMod::MapWildList::MapWildList(const unsigned _id) : + control(UINT_MAX), + value(INT_MAX), + scope(INT_MAX) { LogCtor("MapWildList", _id); - control = UINT_MAX; - value = INT_MAX; - times.clear(); - scope = INT_MAX; - pokemon.clear(); id = _id; } @@ -65,7 +63,7 @@ void PokeGen::PokeMod::MapWildList::Validate() { // TODO (Ben#1#): Value validation } - for (std::vector::iterator i = times.begin(); i != times.end(); ++i) + for (std::vector::const_iterator i = times.begin(); i != times.end(); ++i) { if (!curPokeMod.GetTime(*i)) { @@ -82,7 +80,7 @@ void PokeGen::PokeMod::MapWildList::ImportIni(Ini &ini, const unsigned _id) LogImportStart("MapWildList"); if (_id == UINT_MAX) { - ini.GetValue("id", id, UINT_MAX); + ini.GetValue("id", id); // Was there an id associated with the element? if (id == UINT_MAX) LogIdNotFound("MapWildList"); @@ -135,11 +133,11 @@ void PokeGen::PokeMod::MapWildList::SetValue(const unsigned v) unsigned i = 0; unsigned j = 0; LogSetVar("MapWildList", id, "value", v); - if (Item *item = curPokeMod.GetItem(v)) + if (const Item *item = curPokeMod.GetItem(v)) { while (i < item->GetItemEffectCount()) { - if (ItemEffect *effect = item->GetItemEffect(j++)) + if (const ItemEffect *effect = item->GetItemEffect(j++)) { ++i; if (effect->GetEffect() == IE_FISH) @@ -155,7 +153,7 @@ void PokeGen::PokeMod::MapWildList::SetValue(const unsigned v) void PokeGen::PokeMod::MapWildList::SetValue(const String &v) { LogSetVar("MapWildList", id, "value string", v); - if (Item *i = curPokeMod.GetItem(v)) + if (const Item *i = curPokeMod.GetItem(v)) SetValue(i->GetId()); } @@ -191,11 +189,11 @@ void PokeGen::PokeMod::MapWildList::SetScope(const unsigned s) LogSetVar("MapWildList", id, "scope", s); unsigned i = 0; unsigned j = 0; - if (Item *item = curPokeMod.GetItem(s)) + if (const Item *item = curPokeMod.GetItem(s)) { while (i < item->GetItemEffectCount()) { - if (ItemEffect *effect = item->GetItemEffect(j++)) + if (const ItemEffect *effect = item->GetItemEffect(j++)) { ++i; if (effect->GetEffect() == IE_SCOPE) @@ -208,7 +206,7 @@ void PokeGen::PokeMod::MapWildList::SetScope(const unsigned s) void PokeGen::PokeMod::MapWildList::SetScope(const String &s) { LogSetVar("MapWildList", id, "scope string", s); - if (Item *i = curPokeMod.GetItem(s)) + if (const Item *i = curPokeMod.GetItem(s)) SetScope(i->GetId()); } @@ -218,7 +216,7 @@ unsigned PokeGen::PokeMod::MapWildList::GetControl() const return control; } -unsigned PokeGen::PokeMod::MapWildList::GetValue() const +int PokeGen::PokeMod::MapWildList::GetValue() const { LogFetchVar("MapWildList", id, "value", value); return value; @@ -238,7 +236,7 @@ bool PokeGen::PokeMod::MapWildList::GetTime(const unsigned ts) const bool PokeGen::PokeMod::MapWildList::GetTime(const String &ts) const { LogFetchVar("MapWildList", id, String("time[%u] string", ts.c_str()), ts); - if (Time *t = curPokeMod.GetTime(ts)) + if (const Time *t = curPokeMod.GetTime(ts)) return GetTime(t->GetId()); return false; } @@ -298,7 +296,7 @@ void PokeGen::PokeMod::MapWildList::NewMapWildPokemon(Ini *const ini) void PokeGen::PokeMod::MapWildList::DeleteMapWildPokemon(const unsigned _id) { LogSubmoduleRemoveStart("MapWildList", id, "Pokémon", _id); - for (std::vector::const_iterator i = pokemon.begin(); i != pokemon.end(); ++i) + for (std::vector::iterator i = pokemon.begin(); i != pokemon.end(); ++i) { if (i->GetId() == _id) { -- cgit