summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-09-28 21:26:48 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-09-28 21:26:48 +0200
commit3c89797394c83db8bc2204fdf5841dd3068f09d0 (patch)
tree6fc2d3ad06b9d589851397ff723a32b231a100de /src/gui/itempopup.cpp
parent51f0c23ac190c83bebeace8a49cd2ecd1143fa8c (diff)
downloadmana-3c89797394c83db8bc2204fdf5841dd3068f09d0.tar.gz
mana-3c89797394c83db8bc2204fdf5841dd3068f09d0.tar.bz2
mana-3c89797394c83db8bc2204fdf5841dd3068f09d0.tar.xz
mana-3c89797394c83db8bc2204fdf5841dd3068f09d0.zip
Removed getter/setter cruft from ItemInfo
Made the class and the code in general more readable by removing all the needless getters and setters.
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 8208a5d8..7f1dec3b 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -145,7 +145,7 @@ void ItemPopup::setNoItem()
void ItemPopup::setItem(const ItemInfo &item, bool showImage)
{
- if (item.getName() == mItemName->getCaption())
+ if (item.name == mItemName->getCaption())
return;
int space = 0;
@@ -154,7 +154,7 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage)
{
ResourceManager *resman = ResourceManager::getInstance();
auto image = resman->getImageRef(paths.getStringValue("itemIcons") +
- item.getDisplay().image);
+ item.display.image);
mIcon->setImage(image);
if (image)
@@ -168,9 +168,9 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage)
mIcon->setImage(nullptr);
}
- mItemType = item.getItemType();
+ mItemType = item.type;
- std::string caption = item.getName();
+ std::string caption = item.name;
if (!mItemEquipSlot.empty())
caption += " (" + mItemEquipSlot + ")";
@@ -179,10 +179,10 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage)
mItemName->setForegroundColor(getColorFromItemType(mItemType));
mItemName->setPosition(space, 0);
- mItemDesc->setTextWrapped(item.getDescription(), ITEMPOPUP_WRAP_WIDTH);
- mItemEffect->setTextWrapped(join(item.getEffect(), "\n"), ITEMPOPUP_WRAP_WIDTH);
+ mItemDesc->setTextWrapped(item.description, ITEMPOPUP_WRAP_WIDTH);
+ mItemEffect->setTextWrapped(join(item.effect, "\n"), ITEMPOPUP_WRAP_WIDTH);
mItemWeight->setTextWrapped(strprintf(_("Weight: %s"),
- Units::formatWeight(item.getWeight()).c_str()),
+ Units::formatWeight(item.weight).c_str()),
ITEMPOPUP_WRAP_WIDTH);
int minWidth = mItemName->getWidth() + space;
@@ -201,7 +201,7 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage)
int nameHeight = std::max(mItemName->getHeight(), mIcon->getHeight());
nameHeight += getPadding();
- if (item.getEffect().empty())
+ if (item.effect.empty())
{
setContentSize(minWidth, nameHeight + descHeight + weightHeight + getPadding());