diff options
Diffstat (limited to 'pokemod/Item.cpp')
-rw-r--r-- | pokemod/Item.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index d4f31939..5ce51cf8 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -22,7 +22,7 @@ #include "Item.h" -PokeGen::PokeMod::Item::Item(const Pokemod& par, const unsigned _id) : +PokeMod::Item::Item(const Pokemod& par, const unsigned _id) : Object(par, _id), name(""), sellable(false), @@ -32,19 +32,19 @@ PokeGen::PokeMod::Item::Item(const Pokemod& par, const unsigned _id) : { } -PokeGen::PokeMod::Item::Item(const Pokemod& par, const Item& i, const unsigned _id) : +PokeMod::Item::Item(const Pokemod& par, const Item& i, const unsigned _id) : Object(par, _id) { *this = i; } -PokeGen::PokeMod::Item::Item(const Pokemod& par, const QString& fname, const unsigned _id) : +PokeMod::Item::Item(const Pokemod& par, const QString& fname, const unsigned _id) : Object(par, _id) { load(fname, _id); } -bool PokeGen::PokeMod::Item::validate() const +bool PokeMod::Item::validate() const { bool valid = true; pokemod.validationMsg(QString("---Item \"%1\" with id %2---").arg(name).arg(id), Pokemod::V_Msg); @@ -84,7 +84,7 @@ bool PokeGen::PokeMod::Item::validate() const return valid; } -unsigned PokeGen::PokeMod::Item::getNewId() const +unsigned PokeMod::Item::getNewId() const { unsigned i = 0; for (; (i < getEffectCount()) && (getEffectByID(i) != UINT_MAX); ++i) @@ -92,7 +92,7 @@ unsigned PokeGen::PokeMod::Item::getNewId() const return i; } -void PokeGen::PokeMod::Item::load(const QString& fname, const unsigned _id) throw(Exception) +void PokeMod::Item::load(const QString& fname, const unsigned _id) throw(Exception) { Ini ini(fname); if (_id == UINT_MAX) @@ -115,7 +115,7 @@ void PokeGen::PokeMod::Item::load(const QString& fname, const unsigned _id) thro } } -void PokeGen::PokeMod::Item::save() const throw(Exception) +void PokeMod::Item::save() const throw(Exception) { Ini ini; ini.addField("id", id); @@ -129,73 +129,73 @@ void PokeGen::PokeMod::Item::save() const throw(Exception) i.next().save(name); } -void PokeGen::PokeMod::Item::setName(const QString& n) +void PokeMod::Item::setName(const QString& n) { name = n; } -void PokeGen::PokeMod::Item::setSellable(const bool s) +void PokeMod::Item::setSellable(const bool s) { sellable = s; } -void PokeGen::PokeMod::Item::setType(const unsigned t) throw(BoundsException) +void PokeMod::Item::setType(const unsigned t) throw(BoundsException) { if (pokemod.getItemTypeByID(t) == UINT_MAX) throw(BoundsException("Item", "type")); type = t; } -void PokeGen::PokeMod::Item::setPrice(const unsigned p) +void PokeMod::Item::setPrice(const unsigned p) { price = p; } -void PokeGen::PokeMod::Item::setDescription(const QString& d) +void PokeMod::Item::setDescription(const QString& d) { description = d; } -QString PokeGen::PokeMod::Item::getName() const +QString PokeMod::Item::getName() const { return name; } -bool PokeGen::PokeMod::Item::getSellable() const +bool PokeMod::Item::getSellable() const { return sellable; } -unsigned PokeGen::PokeMod::Item::getType() const +unsigned PokeMod::Item::getType() const { return type; } -unsigned PokeGen::PokeMod::Item::getPrice() const +unsigned PokeMod::Item::getPrice() const { return price; } -QString PokeGen::PokeMod::Item::getDescription() const +QString PokeMod::Item::getDescription() const { return description; } -const PokeGen::PokeMod::ItemEffect& PokeGen::PokeMod::Item::getEffect(const unsigned i) const throw(IndexException) +const PokeMod::ItemEffect& PokeMod::Item::getEffect(const unsigned i) const throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Item")); return effects.at(i); } -PokeGen::PokeMod::ItemEffect& PokeGen::PokeMod::Item::getEffect(const unsigned i) throw(IndexException) +PokeMod::ItemEffect& PokeMod::Item::getEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Item")); return effects[i]; } -unsigned PokeGen::PokeMod::Item::getEffectByID(const unsigned _id) const +unsigned PokeMod::Item::getEffectByID(const unsigned _id) const { for (unsigned i = 0; i < getEffectCount(); ++i) { @@ -205,37 +205,37 @@ unsigned PokeGen::PokeMod::Item::getEffectByID(const unsigned _id) const return UINT_MAX; } -unsigned PokeGen::PokeMod::Item::getEffectCount() const +unsigned PokeMod::Item::getEffectCount() const { return effects.size(); } -PokeGen::PokeMod::ItemEffect& PokeGen::PokeMod::Item::newEffect() +PokeMod::ItemEffect& PokeMod::Item::newEffect() { effects.append(ItemEffect(pokemod, getNewId())); return effects[getEffectCount() - 1]; } -PokeGen::PokeMod::ItemEffect& PokeGen::PokeMod::Item::newEffect(const QString& fname) +PokeMod::ItemEffect& PokeMod::Item::newEffect(const QString& fname) { effects.append(ItemEffect(pokemod, fname, getNewId())); return effects[getEffectCount() - 1]; } -PokeGen::PokeMod::ItemEffect& PokeGen::PokeMod::Item::newEffect(const ItemEffect& e) +PokeMod::ItemEffect& PokeMod::Item::newEffect(const ItemEffect& e) { effects.append(ItemEffect(pokemod, e, getNewId())); return effects[getEffectCount() - 1]; } -void PokeGen::PokeMod::Item::deleteEffect(const unsigned i) throw(IndexException) +void PokeMod::Item::deleteEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Item")); effects.removeAt(i); } -PokeGen::PokeMod::Item& PokeGen::PokeMod::Item::operator=(const Item& rhs) +PokeMod::Item& PokeMod::Item::operator=(const Item& rhs) { if (this == &rhs) return *this; |