diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2007-05-22 03:51:45 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2007-05-22 03:51:45 +0000 |
| commit | e858d98977a09b3c8faf4df87ada4abc1399e8e5 (patch) | |
| tree | fbe406e42296b784cf03ae65cb9cbccb97aa7fa8 /pokemod/PokemonItem.cpp | |
| parent | 0fec318eac634e5465c30eb73d47ec82aaed9db8 (diff) | |
Added a lot of minor PokéMod modules
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@12 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/PokemonItem.cpp')
| -rw-r--r-- | pokemod/PokemonItem.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
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
|
