From e858d98977a09b3c8faf4df87ada4abc1399e8e5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 22 May 2007 03:51:45 +0000 Subject: Added a lot of minor PokéMod modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@12 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- pokemod/PokemonItem.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'pokemod/PokemonItem.cpp') diff --git a/pokemod/PokemonItem.cpp b/pokemod/PokemonItem.cpp index 3ff1e273..7c47ee4d 100644 --- a/pokemod/PokemonItem.cpp +++ b/pokemod/PokemonItem.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: PokemonItem.cpp +// Name: pokemod/PokemonItem.cpp // Purpose: Define an item that a Pokémon can be found with in the wild // Author: Ben Boeckel // Modified by: Ben Boeckel @@ -126,36 +126,30 @@ void PokeGen::PokeMod::PokemonItem::SetItem(int i) void PokeGen::PokeMod::PokemonItem::SetItem(const String &i) { - if (Item *itemId = curPokeMod.GetItem(i)) - { - LogSetVar("PokemonItem", id, "item", itemId->GetName()); - item = itemId->GetId(); - } - else - LogOutOfRange("PokemonItem", id, "item", UINT_MAX, ""); + LogSetVar("PokemonItem", id, "item", i); + if (Item *temp = curPokeMod.GetItem(i)) + item = temp->GetId(); } void PokeGen::PokeMod::PokemonItem::SetWeight(unsigned w) { + LogSetVar("PokemonItem", id, "weight", w); if (w) - { - LogSetVar("PokemonItem", id, "weight", w); weight = w; - } - else - LogOutOfRange("PokemonItem", id, "weight", w, ""); } int PokeGen::PokeMod::PokemonItem::GetItem() const { - LogFetchVar("PokemonItem", id, "item", item, GetItemString()); + LogFetchVar("PokemonItem", id, "item", item); return item; } PokeGen::PokeMod::String PokeGen::PokeMod::PokemonItem::GetItemString() const { - LogFetchVar("PokemonItem", id, "item", GetItemString()); - return curPokeMod.GetItem(item)->GetName(); + LogFetchVar("PokemonItem", id, "item string", item); + if (Item *i = curPokeMod.GetItem(i)) + return i->GetName(); + return ""; } unsigned PokeGen::PokeMod::PokemonItem::GetWeight() const -- cgit