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/MoveEffect.cpp | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'pokemod/MoveEffect.cpp') diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp index 1a778405..ef459680 100644 --- a/pokemod/MoveEffect.cpp +++ b/pokemod/MoveEffect.cpp @@ -29,9 +29,9 @@ PokeGen::PokeMod::MoveEffect::MoveEffect(const unsigned _id) { LogCtor("MoveEffect", _id); chance.Set(1, 1); - effect = -1; - val1 = -1; - val2 = -1; + effect = UINT_MAX; + val1 = INT_MAX; + val2 = UINT_MAX; id = _id; } @@ -54,7 +54,6 @@ void PokeGen::PokeMod::MoveEffect::Validate(const wxListBox &output) void PokeGen::PokeMod::MoveEffect::Validate() #endif { - isValid = true; LogValidateStart("MoveEffect", id); // TODO (Validation#1#): MoveEffect Validation LogValidateOver("MoveEffect", id, isValid); @@ -77,9 +76,9 @@ void PokeGen::PokeMod::MoveEffect::ImportIni(Ini &ini, const unsigned _id) ini.GetValue("chance-n", i, 1); ini.GetValue("chance-d", j, 1); chance.Set(i, j); - ini.GetValue("effect", effect, -1); - ini.GetValue("val1", val1, -1); - ini.GetValue("val2", val2, -1); + ini.GetValue("effect", effect); + ini.GetValue("val1", val1); + ini.GetValue("val2", val2); } void PokeGen::PokeMod::MoveEffect::ExportIni(std::ofstream &fout, const String &move) const @@ -121,44 +120,44 @@ void PokeGen::PokeMod::MoveEffect::SetChanceDenom(const unsigned d) chance.SetDenom(d); } -void PokeGen::PokeMod::MoveEffect::SetEffect(const int e) +void PokeGen::PokeMod::MoveEffect::SetEffect(const unsigned e) { LogSetVar("MoveEffect", id, "effect", e); - effect = e; - val1 = -1; - val2 = -1; + if (e < ME_END) + { + effect = e; + val1 = INT_MAX; + val2 = UINT_MAX; + } } void PokeGen::PokeMod::MoveEffect::SetEffect(const String &e) { - LogSetVar("MoveEffect", id, "effect string", e); - effect = FindIn(ME_END, e, MoveEffectStr); - val1 = -1; - val2 = -1; + SetEffect(FindIn(ME_END, e, MoveEffectStr)); } // TODO (Ben#1#): Effect code void PokeGen::PokeMod::MoveEffect::SetVal1(const int v1) { - PMLog("MoveEffect: Setting val1", PM_DEBUG_DEBUG); + LogSetVar("MoveEffect", id, "val1", v1); val1 = v1; } -void PokeGen::PokeMod::MoveEffect::SetVal2(const int v2) +void PokeGen::PokeMod::MoveEffect::SetVal2(const unsigned v2) { - PMLog("MoveEffect: Setting val2", PM_DEBUG_DEBUG); + LogSetVar("MoveEffect", id, "val2", v2); val2 = v2; } void PokeGen::PokeMod::MoveEffect::SetVal2(const String &v2) { - PMLog("MoveEffect: Setting val2", PM_DEBUG_DEBUG); + LogSetVar("MoveEffect", id, "val2 string", v2); val2 = 0; } PokeGen::PokeMod::Frac PokeGen::PokeMod::MoveEffect::GetChance() const { - LogFetchVar("MoveEffect", id, "chance", chance.GetNum()); + LogFetchVar("MoveEffect", id, "chance", chance.GetNum(), chance.GetDenom()); return chance; } @@ -174,7 +173,7 @@ unsigned PokeGen::PokeMod::MoveEffect::GetChanceDenom() const return chance.GetDenom(); } -int PokeGen::PokeMod::MoveEffect::GetEffect() const +unsigned PokeGen::PokeMod::MoveEffect::GetEffect() const { LogFetchVar("MoveEffect", id, "effect", effect); return effect; @@ -183,7 +182,9 @@ int PokeGen::PokeMod::MoveEffect::GetEffect() const PokeGen::PokeMod::String PokeGen::PokeMod::MoveEffect::GetEffectString() const { LogFetchVar("MoveEffect", id, "effect string", MoveEffectStr[effect]); - return MoveEffectStr[effect]; + if (effect < ME_END) + return MoveEffectStr[effect]; + return ""; } int PokeGen::PokeMod::MoveEffect::GetVal1() const @@ -192,7 +193,7 @@ int PokeGen::PokeMod::MoveEffect::GetVal1() const return val1; } -int PokeGen::PokeMod::MoveEffect::GetVal2() const +unsigned PokeGen::PokeMod::MoveEffect::GetVal2() const { LogFetchVar("MoveEffect", id, "val2", val2); return val2; @@ -201,5 +202,6 @@ int PokeGen::PokeMod::MoveEffect::GetVal2() const PokeGen::PokeMod::String PokeGen::PokeMod::MoveEffect::GetVal2String() const { LogFetchVar("MoveEffect", id, "val2 string", val2); + // TODO (Ben#1#): Val2 string return ""; } -- cgit