From 2f2274e959f3452e847800d7496458360f21c341 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 5 Feb 2024 17:19:22 +0100 Subject: 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, found on StackOverflow. --- src/gui/itempopup.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/gui') 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 &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); -- cgit v1.2.3-70-g09d2