diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-23 18:11:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-23 18:11:19 +0300 |
commit | 82ea830316b90bc4e55f2b34eb3c09df897df44d (patch) | |
tree | 8ad5aa10886708b4881369fe24c1c80e54169f20 | |
parent | 7e25611234272081ae847a0388da84d09be3cb59 (diff) | |
download | manaplus-82ea830316b90bc4e55f2b34eb3c09df897df44d.tar.gz manaplus-82ea830316b90bc4e55f2b34eb3c09df897df44d.tar.bz2 manaplus-82ea830316b90bc4e55f2b34eb3c09df897df44d.tar.xz manaplus-82ea830316b90bc4e55f2b34eb3c09df897df44d.zip |
in npc dialog at first try split long lines by spaces.
-rw-r--r-- | src/gui/widgets/extendedlistbox.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 721a0a591..da9c4521e 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -90,8 +90,19 @@ void ExtendedListBox::draw(gcn::Graphics *graphics) { const int strSize = str.size(); int divPos = strSize / 2; - if (divPos > 0 && (unsigned char)str[divPos - 1] >= 0xc0) + if (divPos > 0 && static_cast<unsigned char>( + str[divPos - 1]) >= 0xc0) + { divPos --; + } + for (int d = divPos; d > 10; d --) + { + if (str[d] == 32) + { + divPos = d + 1; + break; + } + } list.push_back(ExtendedListBoxItem(row, str.substr(0, divPos), useImage, y)); str = str.substr(divPos); |