From 3c89797394c83db8bc2204fdf5841dd3068f09d0 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 28 Sep 2024 21:26:48 +0200 Subject: Removed getter/setter cruft from ItemInfo Made the class and the code in general more readable by removing all the needless getters and setters. --- src/gui/widgets/browserbox.cpp | 2 +- src/gui/widgets/chattab.cpp | 6 +++--- src/gui/widgets/itemcontainer.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 96feddb9..40c9b66a 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -102,7 +102,7 @@ void BrowserBox::addRow(const std::string &row) { const int id = atoi(link.link.c_str()); if (id) - link.caption = itemDb->get(id).getName(); + link.caption = itemDb->get(id).name; else link.caption = link.link; } diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 5097bffa..663464a8 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -282,12 +282,12 @@ void ChatTab::chatInput(const std::string &message) std::string temp = msg.substr(start + 1, end - start - 1); - const ItemInfo itemInfo = itemDb->get(temp); - if (itemInfo.getId() != 0) + const ItemInfo &itemInfo = itemDb->get(temp); + if (itemInfo.id != 0) { msg.insert(end, "@@"); msg.insert(start + 1, "|"); - msg.insert(start + 1, toString(itemInfo.getId())); + msg.insert(start + 1, toString(itemInfo.id)); msg.insert(start + 1, "@@"); } } diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 37a61c80..940c69f4 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -101,7 +101,7 @@ void ItemContainer::draw(gcn::Graphics *graphics) if (!mFilter.empty()) { - if (normalize(item->getInfo().getName()).find(mFilter) == std::string::npos) + if (normalize(item->getInfo().name).find(mFilter) == std::string::npos) continue; mFilteredMap[currentIndex] = item; currentIndex++; @@ -286,7 +286,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) // put item name into chat window if (mDescItems) { - chatWindow->addItemText(item->getInfo().getName()); + chatWindow->addItemText(item->getInfo().name); } if (mSelectedIndex == index) @@ -298,7 +298,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) mSelectionStatus = SEL_SELECTING; itemShortcut->setItemSelected(item->getId()); - if (item->getInfo().getEquippable()) + if (item->isEquippable()) outfitWindow->setItemSelected(item->getId()); } else -- cgit v1.2.3-70-g09d2