summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-05 17:19:22 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-05 17:22:25 +0100
commit2f2274e959f3452e847800d7496458360f21c341 (patch)
treee263a33f85bb95bbb56f1f661adf14228305bafb /src/gui/itempopup.cpp
parent3405b046701e9c08972c1e622259164fc88ac487 (diff)
downloadmana-2f2274e959f3452e847800d7496458360f21c341.tar.gz
mana-2f2274e959f3452e847800d7496458360f21c341.tar.bz2
mana-2f2274e959f3452e847800d7496458360f21c341.tar.xz
mana-2f2274e959f3452e847800d7496458360f21c341.zip
Updated C++ standard to C++17
C++17 should be universal enough by now. This raises the minimum CMake to 3.8, which should also pose no problem since Ubuntu 18.04 already shipped with CMake 3.10. C++17's 'if' initialization statement is now used in an efficient implementation of 'join' for vector<string>, found on StackOverflow.
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 3b3dfcd3..966e2c92 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -195,13 +195,7 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage)
mItemName->setPosition(getPadding() + space, getPadding());
mItemDesc->setTextWrapped(item.getDescription(), ITEMPOPUP_WRAP_WIDTH);
- {
- const std::vector<std::string> &effect = item.getEffect();
- std::string temp = "";
- for (const auto &it : effect)
- temp += temp.empty() ? it : "\n" + it;
- mItemEffect->setTextWrapped(temp, ITEMPOPUP_WRAP_WIDTH);
- }
+ mItemEffect->setTextWrapped(join(item.getEffect(), "\n"), ITEMPOPUP_WRAP_WIDTH);
mItemWeight->setTextWrapped(strprintf(_("Weight: %s"),
Units::formatWeight(item.getWeight()).c_str()),
ITEMPOPUP_WRAP_WIDTH);