diff options
author | jak1 <jak1@germantmw.de> | 2020-03-18 19:17:03 +0100 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-02-26 23:47:19 -0300 |
commit | 178aae86aa6ac3e59797ff4e33523db5c6e1261d (patch) | |
tree | 11d2243eca9492f447e57e75c4352b1e3dc35416 /src | |
parent | 642df3995a5caf6d78f05102361d447328116bcc (diff) | |
download | mv-178aae86aa6ac3e59797ff4e33523db5c6e1261d.tar.gz mv-178aae86aa6ac3e59797ff4e33523db5c6e1261d.tar.bz2 mv-178aae86aa6ac3e59797ff4e33523db5c6e1261d.tar.xz mv-178aae86aa6ac3e59797ff4e33523db5c6e1261d.zip |
added newline for every effect in itempopups
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/popups/itempopup.cpp | 16 | ||||
-rw-r--r-- | src/gui/popups/itempopup.h | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index 3cb80b7ac..f7898d91a 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -270,8 +270,8 @@ void ItemPopup::setItem(const ItemInfo &item, mItemName->adjustSize(); setLabelColor(mItemName, mItemType); mItemName->setPosition(space, 0); - - mItemEffect->setTextWrapped(item.getEffect(), 196); + const std::string readableEffect = replaceChar((char*)item.getEffect().c_str(), '/', '\n'); + mItemEffect->setTextWrapped(readableEffect, 196); // TRANSLATORS: popup label mItemWeight->setTextWrapped(strprintf(_("Weight: %s"), UnitsDb::formatWeight(item.getWeight()).c_str()), 196); @@ -466,3 +466,15 @@ void ItemPopup::resetPopup() mLastColor = ItemColor_one; mLastId = 0; } + +char* ItemPopup::replaceChar(char* str, char find, char replace) +{ + char *currentPos = str; + while ((currentPos = strchr(currentPos, find)) != NULL) + { + *currentPos = ' '; + *currentPos++; + *currentPos = replace; + } + return str; +} diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h index d42bee103..b6cfd2e37 100644 --- a/src/gui/popups/itempopup.h +++ b/src/gui/popups/itempopup.h @@ -97,6 +97,8 @@ class ItemPopup final : public Popup void setLabelColor(Label *label, const ItemDbTypeT type) const A_NONNULL(2); + + char* replaceChar(char* str ,char find,char replace); }; extern ItemPopup *itemPopup; |