summaryrefslogtreecommitdiffstats
path: root/pokemod/MapWildList.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/MapWildList.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/MapWildList.cpp')
-rw-r--r--pokemod/MapWildList.cpp46
1 files changed, 31 insertions, 15 deletions
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index 90dda382..065aa68a 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -28,10 +28,10 @@ extern PokeGen::PokeMod::Pokemod curPokeMod;
PokeGen::PokeMod::MapWildList::MapWildList(const unsigned _id)
{
LogCtor("MapWildList", _id);
- control = 0;
- value = 0;
+ control = UINT_MAX;
+ value = INT_MAX;
times.clear();
- scope = -1;
+ scope = INT_MAX;
pokemon.clear();
id = _id;
}
@@ -55,9 +55,25 @@ void PokeGen::PokeMod::MapWildList::Validate(const wxListBox &output)
void PokeGen::PokeMod::MapWildList::Validate()
#endif
{
- isValid = true;
LogValidateStart("MapWildList", id);
- // TODO (Validation#1#): MapWildList Validation
+ if (CTRL_END <= control)
+ {
+ LogVarNotValid("MapWildList", id, "control");
+ isValid = true;
+ }
+ else if (control == CTRL_FISHING)
+ {
+ // TODO (Ben#1#): Value validation
+ }
+ for (std::vector<unsigned>::iterator i = times.begin(); i != times.end(); ++i)
+ {
+ if (!curPokeMod.GetTime(*i))
+ {
+ LogVarNotValid("MapWildList", id, "times");
+ isValid = false;
+ }
+ }
+ // TODO (Ben#1#): Scope validation
LogValidateOver("MapWildList", id, isValid);
}
@@ -76,8 +92,8 @@ void PokeGen::PokeMod::MapWildList::ImportIni(Ini &ini, const unsigned _id)
unsigned i;
unsigned j;
times.clear();
- ini.GetValue("control", control, 0);
- ini.GetValue("value", value, 0);
+ ini.GetValue("control", control);
+ ini.GetValue("value", value);
ini.GetValue("numTimes", i, 0);
for (unsigned k = 0; k < i; ++k)
{
@@ -85,7 +101,7 @@ void PokeGen::PokeMod::MapWildList::ImportIni(Ini &ini, const unsigned _id)
if (k != UINT_MAX)
times.push_back(j);
}
- ini.GetValue("scope", scope, -1);
+ ini.GetValue("scope", scope);
LogImportOver("MapWildList", id);
}
@@ -102,7 +118,7 @@ void PokeGen::PokeMod::MapWildList::ExportIni(std::ofstream &fout, const String
exMapWildList.AddField(String("time-%u", i), times[i]);
exMapWildList.AddField("scope", scope);
exMapWildList.Export(fout);
- for (std::vector<MapWildPokemon>::iterator i = pokemon.begin(); i != pokemon.end(); ++i)
+ for (std::vector<MapWildPokemon>::const_iterator i = pokemon.begin(); i != pokemon.end(); ++i)
i->ExportIni(fout, map, id);
LogExportOver("MapWildList", id);
}
@@ -110,7 +126,7 @@ void PokeGen::PokeMod::MapWildList::ExportIni(std::ofstream &fout, const String
void PokeGen::PokeMod::MapWildList::SetControl(const unsigned c)
{
LogSetVar("MapWildList", id, "control", c);
- if ((CTRL_NONE < c) && (c < CTRL_END))
+ if (c < CTRL_END)
control = c;
}
@@ -211,7 +227,7 @@ unsigned PokeGen::PokeMod::MapWildList::GetValue() const
bool PokeGen::PokeMod::MapWildList::GetTime(const unsigned ts) const
{
LogFetchVar("MapWildList", id, String("time[%u]", ts), "???");
- for (std::vector<unsigned>::iterator i = times.begin(); i != times.end(); ++i)
+ for (std::vector<unsigned>::const_iterator i = times.begin(); i != times.end(); ++i)
{
if (*i == ts)
return true;
@@ -233,7 +249,7 @@ int PokeGen::PokeMod::MapWildList::GetScope() const
return scope;
}
-PokeGen::PokeMod::MapWildPokemon *PokeGen::PokeMod::MapWildList::GetMapWildPokemon(const unsigned _id)
+const PokeGen::PokeMod::MapWildPokemon *PokeGen::PokeMod::MapWildList::GetMapWildPokemon(const unsigned _id) const
{
LogSubmoduleFetch("MapWildList", id, "Pokémon", _id);
for (unsigned i = 0; i < GetMapWildPokemonCount(); ++i)
@@ -245,7 +261,7 @@ PokeGen::PokeMod::MapWildPokemon *PokeGen::PokeMod::MapWildList::GetMapWildPokem
return NULL;
}
-PokeGen::PokeMod::MapWildPokemon *PokeGen::PokeMod::MapWildList::GetMapWildPokemon(const String &n)
+const PokeGen::PokeMod::MapWildPokemon *PokeGen::PokeMod::MapWildList::GetMapWildPokemon(const String &n) const
{
LogSubmoduleFetch("MapWildList", id, "Pokémon string", n);
for (unsigned i = 0; i < GetMapWildPokemonCount(); ++i)
@@ -253,7 +269,7 @@ PokeGen::PokeMod::MapWildPokemon *PokeGen::PokeMod::MapWildList::GetMapWildPokem
if (pokemon[i].GetPokemonString() == n)
return &pokemon[i];
}
- LogSubmoduleFetchFail("MapWildList", id, "Pokémon", 0);
+ LogSubmoduleFetchFail("MapWildList", id, "Pokémon", (unsigned)0);
return NULL;
}
@@ -282,7 +298,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<MapWildPokemon>::iterator i = pokemon.begin(); i != pokemon.end(); ++i)
+ for (std::vector<MapWildPokemon>::const_iterator i = pokemon.begin(); i != pokemon.end(); ++i)
{
if (i->GetId() == _id)
{