diff options
Diffstat (limited to 'pokemod/Item.cpp')
| -rw-r--r-- | pokemod/Item.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index f6658329..43e7066b 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -29,7 +29,7 @@ #include "Pokemod.h" #include "Item.h" -PokeMod::Item::Item(const Pokemod& par, const unsigned _id) : +Item::Item(const Pokemod& par, const unsigned _id) : Object(par, _id), name(""), sellable(false), @@ -39,19 +39,19 @@ PokeMod::Item::Item(const Pokemod& par, const unsigned _id) : { } -PokeMod::Item::Item(const Pokemod& par, const Item& i, const unsigned _id) : +Item::Item(const Pokemod& par, const Item& i, const unsigned _id) : Object(par, _id) { *this = i; } -PokeMod::Item::Item(const Pokemod& par, const QString& fname, const unsigned _id) : +Item::Item(const Pokemod& par, const QString& fname, const unsigned _id) : Object(par, _id) { load(fname, _id); } -bool PokeMod::Item::validate() const +bool Item::validate() const { bool valid = true; pokemod.validationMsg(QString("---Item \"%1\" with id %2---").arg(name).arg(id), Pokemod::V_Msg); @@ -91,7 +91,7 @@ bool PokeMod::Item::validate() const return valid; } -unsigned PokeMod::Item::getNewId() const +unsigned Item::getNewId() const { unsigned i = 0; for (; (i < getEffectCount()) && (getEffectIndex(i) != UINT_MAX); ++i) @@ -99,7 +99,7 @@ unsigned PokeMod::Item::getNewId() const return i; } -void PokeMod::Item::load(const QString& fname, const unsigned _id) throw(Exception) +void Item::load(const QString& fname, const unsigned _id) throw(Exception) { Ini ini(fname); if (_id == UINT_MAX) @@ -122,7 +122,7 @@ void PokeMod::Item::load(const QString& fname, const unsigned _id) throw(Excepti } } -void PokeMod::Item::save() const throw(Exception) +void Item::save() const throw(Exception) { Ini ini; ini.addField("id", id); @@ -136,83 +136,83 @@ void PokeMod::Item::save() const throw(Exception) i.next().save(name); } -void PokeMod::Item::setName(const QString& n) +void Item::setName(const QString& n) { name = n; } -void PokeMod::Item::setSellable(const bool s) +void Item::setSellable(const bool s) { sellable = s; } -void PokeMod::Item::setType(const unsigned t) throw(BoundsException) +void Item::setType(const unsigned t) throw(BoundsException) { if (pokemod.getItemTypeIndex(t) == UINT_MAX) throw(BoundsException("Item", "type")); type = t; } -void PokeMod::Item::setPrice(const unsigned p) +void Item::setPrice(const unsigned p) { price = p; } -void PokeMod::Item::setDescription(const QString& d) +void Item::setDescription(const QString& d) { description = d; } -QString PokeMod::Item::getName() const +QString Item::getName() const { return name; } -bool PokeMod::Item::getSellable() const +bool Item::getSellable() const { return sellable; } -unsigned PokeMod::Item::getType() const +unsigned Item::getType() const { return type; } -unsigned PokeMod::Item::getPrice() const +unsigned Item::getPrice() const { return price; } -QString PokeMod::Item::getDescription() const +QString Item::getDescription() const { return description; } -const PokeMod::ItemEffect& PokeMod::Item::getEffect(const unsigned i) const throw(IndexException) +const ItemEffect& Item::getEffect(const unsigned i) const throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Item")); return effects.at(i); } -PokeMod::ItemEffect& PokeMod::Item::getEffectByID(const unsigned i) throw(IndexException) +ItemEffect& Item::getEffectByID(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Item")); return effects[i]; } -const PokeMod::ItemEffect& PokeMod::Item::getEffectByID(const unsigned i) const throw(IndexException) +const ItemEffect& Item::getEffectByID(const unsigned i) const throw(IndexException) { return getEffect(getEffectIndex(i)); } -PokeMod::ItemEffect& PokeMod::Item::getEffect(const unsigned i) throw(IndexException) +ItemEffect& Item::getEffect(const unsigned i) throw(IndexException) { return getEffect(getEffectIndex(i)); } -unsigned PokeMod::Item::getEffectIndex(const unsigned _id) const +unsigned Item::getEffectIndex(const unsigned _id) const { for (unsigned i = 0; i < getEffectCount(); ++i) { @@ -222,37 +222,37 @@ unsigned PokeMod::Item::getEffectIndex(const unsigned _id) const return UINT_MAX; } -unsigned PokeMod::Item::getEffectCount() const +unsigned Item::getEffectCount() const { return effects.size(); } -PokeMod::ItemEffect& PokeMod::Item::newEffect() +ItemEffect& Item::newEffect() { effects.append(ItemEffect(pokemod, getNewId())); return effects[getEffectCount() - 1]; } -PokeMod::ItemEffect& PokeMod::Item::newEffect(const QString& fname) +ItemEffect& Item::newEffect(const QString& fname) { effects.append(ItemEffect(pokemod, fname, getNewId())); return effects[getEffectCount() - 1]; } -PokeMod::ItemEffect& PokeMod::Item::newEffect(const ItemEffect& e) +ItemEffect& Item::newEffect(const ItemEffect& e) { effects.append(ItemEffect(pokemod, e, getNewId())); return effects[getEffectCount() - 1]; } -void PokeMod::Item::deleteEffect(const unsigned i) throw(IndexException) +void Item::deleteEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Item")); effects.removeAt(i); } -PokeMod::Item& PokeMod::Item::operator=(const Item& rhs) +Item& Item::operator=(const Item& rhs) { if (this == &rhs) return *this; |
