summaryrefslogtreecommitdiffstats
path: root/pokemod/MapWildPokemon.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-06-02 18:12:48 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-06-02 18:12:48 +0000
commitc9afda3ab74614fb36986f96b7972c082f275eca (patch)
tree1b7c0b31950597d6ed562d94158dd3f8701496da /pokemod/MapWildPokemon.cpp
parentf71140fae5218ee9839ffcd4ec83abfded5124f4 (diff)
downloadsigen-c9afda3ab74614fb36986f96b7972c082f275eca.tar.gz
sigen-c9afda3ab74614fb36986f96b7972c082f275eca.tar.xz
sigen-c9afda3ab74614fb36986f96b7972c082f275eca.zip
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
Diffstat (limited to 'pokemod/MapWildPokemon.cpp')
-rw-r--r--pokemod/MapWildPokemon.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/pokemod/MapWildPokemon.cpp b/pokemod/MapWildPokemon.cpp
index e81bb2ef..07a4dee3 100644
--- a/pokemod/MapWildPokemon.cpp
+++ b/pokemod/MapWildPokemon.cpp
@@ -25,12 +25,12 @@
extern PokeGen::PokeMod::Pokemod curPokeMod;
-PokeGen::PokeMod::MapWildPokemon::MapWildPokemon(const unsigned _id)
+PokeGen::PokeMod::MapWildPokemon::MapWildPokemon(const unsigned _id) :
+ pokemon(UINT_MAX),
+ level(1),
+ weight(1)
{
LogCtor("MapWildPokemon", _id);
- pokemon = -1;
- level = 1;
- weight = 1;
id = _id;
}
@@ -55,7 +55,7 @@ void PokeGen::PokeMod::MapWildPokemon::Validate()
LogVarNotValid("MapWildPokemon", id, "pokemon");
isValid = false;
}
- if (curPokeMod.GetMaxLevel() <= level)
+ if (!level || (curPokeMod.GetMaxLevel() <= level))
{
LogVarNotValid("MapWildPokemon", id, "level", GetPokemonString());
isValid = false;
@@ -99,14 +99,14 @@ void PokeGen::PokeMod::MapWildPokemon::ImportIni(Ini &ini, const unsigned _id)
LogImportStart("MapWildPokemon");
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("MapWildPokemon");
}
else
id = _id;
- ini.GetValue("pokemon", pokemon, -1);
+ ini.GetValue("pokemon", pokemon);
ini.GetValue("level", level, 1);
ini.GetValue("weight", weight, 1);
LogImportOver("MapWildPokemon", id);
@@ -125,7 +125,7 @@ void PokeGen::PokeMod::MapWildPokemon::ExportIni(std::ofstream &fout, const Stri
LogExportOver("MapWildPokemon", id);
}
-void PokeGen::PokeMod::MapWildPokemon::SetPokemon(const int p)
+void PokeGen::PokeMod::MapWildPokemon::SetPokemon(const unsigned p)
{
LogSetVar("MapWildPokemon", id, "pokemon", p);
if (curPokeMod.GetPokemon(p))
@@ -135,7 +135,7 @@ void PokeGen::PokeMod::MapWildPokemon::SetPokemon(const int p)
void PokeGen::PokeMod::MapWildPokemon::SetPokemon(const String &p)
{
LogSetVar("MapWildPokemon", id, "pokemon string", p);
- if (Pokemon *temp = curPokeMod.GetPokemon(p))
+ if (const Pokemon *temp = curPokeMod.GetPokemon(p))
pokemon = temp->GetId();
}
@@ -152,7 +152,7 @@ void PokeGen::PokeMod::MapWildPokemon::SetWeight(const unsigned w)
weight = w;
}
-int PokeGen::PokeMod::MapWildPokemon::GetPokemon() const
+unsigned PokeGen::PokeMod::MapWildPokemon::GetPokemon() const
{
LogFetchVar("MapWildPokemon", id, "pokemon", pokemon);
return pokemon;
@@ -161,7 +161,7 @@ int PokeGen::PokeMod::MapWildPokemon::GetPokemon() const
PokeGen::PokeMod::String PokeGen::PokeMod::MapWildPokemon::GetPokemonString() const
{
LogFetchVar("MapWildPokemon", id, "pokemon string", pokemon);
- if (Pokemon *p = curPokeMod.GetPokemon(pokemon))
+ if (const Pokemon *p = curPokeMod.GetPokemon(pokemon))
return p->GetName();
return "";
}