From f71140fae5218ee9839ffcd4ec83abfded5124f4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 1 Jun 2007 02:54:29 +0000 Subject: 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 --- pokemod/PokemonEvolution.cpp | 46 +++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'pokemod/PokemonEvolution.cpp') diff --git a/pokemod/PokemonEvolution.cpp b/pokemod/PokemonEvolution.cpp index b79984e1..26a40fdc 100644 --- a/pokemod/PokemonEvolution.cpp +++ b/pokemod/PokemonEvolution.cpp @@ -28,10 +28,10 @@ extern PokeGen::PokeMod::Pokemod curPokeMod; PokeGen::PokeMod::PokemonEvolution::PokemonEvolution(const unsigned _id) { LogCtor("PokemonEvolution", _id); - species = -1; - style = 0; + species = UINT_MAX; + style = UINT_MAX; level = 0; - item = -1; + item = UINT_MAX; happiness = 0; id = _id; } @@ -51,7 +51,6 @@ PokeGen::PokeMod::PokemonEvolution::~PokemonEvolution() void PokeGen::PokeMod::PokemonEvolution::Validate() { - isValid = true; LogValidateStart("PokemonEvolution", id); if (!curPokeMod.GetPokemon(species)) { @@ -79,7 +78,6 @@ void PokeGen::PokeMod::PokemonEvolution::Validate() #ifdef PG_DEBUG_WINDOW void PokeGen::PokeMod::PokemonEvolution::Validate(const wxListBox &output) { - isValid = true; LogValidateStart("PokemonEvolution", id); if (!curPokeMod.GetPokemon(species)) { @@ -121,10 +119,10 @@ void PokeGen::PokeMod::PokemonEvolution::ImportIni(Ini &ini, const unsigned _id) } else id = _id; - ini.GetValue("species", species, -1); - ini.GetValue("style", style, 0); + ini.GetValue("species", species); + ini.GetValue("style", style); ini.GetValue("level", level, 0); - ini.GetValue("item", item, -1); + ini.GetValue("item", item); ini.GetValue("happiness", happiness, 0); LogImportOver("PokemonEvolution", id); } @@ -144,10 +142,11 @@ void PokeGen::PokeMod::PokemonEvolution::ExportIni(std::ofstream &fout, const St LogExportOver("PokemonEvolution", id); } -void PokeGen::PokeMod::PokemonEvolution::SetSpecies(const int s) +void PokeGen::PokeMod::PokemonEvolution::SetSpecies(const unsigned s) { LogSetVar("PokemonEvolution", id, "species", s); - species = s; + if (curPokeMod.GetPokemon(s)) + species = s; } void PokeGen::PokeMod::PokemonEvolution::SetSpecies(const String &s) @@ -157,22 +156,25 @@ void PokeGen::PokeMod::PokemonEvolution::SetSpecies(const String &s) species = temp->GetId(); } -void PokeGen::PokeMod::PokemonEvolution::SetStyle(const int s) +void PokeGen::PokeMod::PokemonEvolution::SetStyle(const unsigned s) { LogSetVar("PokemonEvolution", id, "style", s); - style = s; + if (s < STY_END) + style = s; } void PokeGen::PokeMod::PokemonEvolution::SetLevel(const unsigned l) { LogSetVar("PokemonEvolution", id, "level", l); - level = l; + if (l <= curPokeMod.GetMaxLevel()) + level = l; } -void PokeGen::PokeMod::PokemonEvolution::SetItem(const int i) +void PokeGen::PokeMod::PokemonEvolution::SetItem(const unsigned i) { LogSetVar("PokemonEvolution", id, "item", i); - item = i; + if (curPokeMod.GetItem(i)) + item = i; } void PokeGen::PokeMod::PokemonEvolution::SetItem(const String &i) @@ -188,7 +190,7 @@ void PokeGen::PokeMod::PokemonEvolution::SetHappiness(const unsigned h) happiness = h; } -int PokeGen::PokeMod::PokemonEvolution::GetSpecies() const +unsigned PokeGen::PokeMod::PokemonEvolution::GetSpecies() const { LogFetchVar("PokemonEvolution", id, "species", species); return species; @@ -202,19 +204,27 @@ PokeGen::PokeMod::String PokeGen::PokeMod::PokemonEvolution::GetSpeciesString() return ""; } -int PokeGen::PokeMod::PokemonEvolution::GetStyle() const +unsigned PokeGen::PokeMod::PokemonEvolution::GetStyle() const { LogFetchVar("PokemonEvolution", id, "style", style); return style; } +PokeGen::PokeMod::String PokeGen::PokeMod::PokemonEvolution::GetStyleString() const +{ + LogFetchVar("PokemonEvolution", id, "style string", style); + if (style < STY_END) + return StyleStr[style]; + return ""; +} + unsigned PokeGen::PokeMod::PokemonEvolution::GetLevel() const { LogFetchVar("PokemonEvolution", id, "level", level); return level; } -int PokeGen::PokeMod::PokemonEvolution::GetItem() const +unsigned PokeGen::PokeMod::PokemonEvolution::GetItem() const { LogFetchVar("PokemonEvolution", id, "item", item); return item; -- cgit