summaryrefslogtreecommitdiffstats
path: root/pokemod/Item.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/Item.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/Item.cpp')
-rw-r--r--pokemod/Item.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp
index eeaf5fd1..7a2457d1 100644
--- a/pokemod/Item.cpp
+++ b/pokemod/Item.cpp
@@ -25,15 +25,14 @@
extern PokeGen::PokeMod::Pokemod curPokeMod;
-PokeGen::PokeMod::Item::Item(const unsigned _id)
+PokeGen::PokeMod::Item::Item(const unsigned _id) :
+ name(""),
+ sellable(false),
+ type(UINT_MAX),
+ price(0),
+ description("")
{
LogCtor("Item", _id);
- name = "";
- sellable = false;
- type = -1;
- price = 0;
- description = "";
- effects.clear();
id = _id;
}
@@ -120,18 +119,18 @@ void PokeGen::PokeMod::Item::ImportIni(Ini &ini, const unsigned _id)
LogImportStart("Item");
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("Item");
}
else
id = _id;
- ini.GetValue("name", name, "");
+ ini.GetValue("name", name);
ini.GetValue("sellable", sellable, false);
- ini.GetValue("type", type, -1);
+ ini.GetValue("type", type);
ini.GetValue("price", price, 0);
- ini.GetValue("description", description, "");
+ ini.GetValue("description", description);
effects.clear();
LogImportOver("Item", id, name);
}
@@ -148,7 +147,7 @@ void PokeGen::PokeMod::Item::ExportIni(std::ofstream &fout) const
exItem.AddField("price", price);
exItem.AddField("description", description);
exItem.Export(fout);
- for (std::vector<ItemEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
+ for (std::vector<ItemEffect>::const_iterator i = effects.begin(); i != effects.end(); ++i)
i->ExportIni(fout, name);
LogExportOver("Item", id, name);
}
@@ -165,7 +164,7 @@ void PokeGen::PokeMod::Item::SetSellable(const bool s)
sellable = s;
}
-void PokeGen::PokeMod::Item::SetType(const int t)
+void PokeGen::PokeMod::Item::SetType(const unsigned t)
{
LogSetVar("Item", id, "type", t, name);
if (curPokeMod.GetItemStorage(t))
@@ -175,7 +174,7 @@ void PokeGen::PokeMod::Item::SetType(const int t)
void PokeGen::PokeMod::Item::SetType(const String &t)
{
LogSetVar("Item", id, "type string", t, name);
- if (ItemStorage *i = curPokeMod.GetItemStorage(t))
+ if (const ItemStorage *i = curPokeMod.GetItemStorage(t))
type = i->GetId();
}
@@ -203,7 +202,7 @@ bool PokeGen::PokeMod::Item::GetSellable() const
return sellable;
}
-int PokeGen::PokeMod::Item::GetType() const
+unsigned PokeGen::PokeMod::Item::GetType() const
{
LogFetchVar("Item", id, "type", type, name);
return type;
@@ -212,7 +211,7 @@ int PokeGen::PokeMod::Item::GetType() const
PokeGen::PokeMod::String PokeGen::PokeMod::Item::GetTypeString() const
{
LogFetchVar("Item", id, "type string", type, name);
- if (ItemStorage *i = curPokeMod.GetItemStorage(type))
+ if (const ItemStorage *i = curPokeMod.GetItemStorage(type))
return i->GetName();
return "";
}
@@ -266,7 +265,7 @@ void PokeGen::PokeMod::Item::NewItemEffect(Ini *const ini)
void PokeGen::PokeMod::Item::DeleteItemEffect(const unsigned _id)
{
LogSubmoduleRemoveStart("Item", id, "effect", _id, name);
- for (std::vector<ItemEffect>::const_iterator i = effects.begin(); i != effects.end(); ++i)
+ for (std::vector<ItemEffect>::iterator i = effects.begin(); i != effects.end(); ++i)
{
if (i->GetId() == _id)
{