summaryrefslogtreecommitdiff
path: root/src/gui/speechbubble.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-04 13:51:22 -0700
committerIra Rice <irarice@gmail.com>2009-02-04 13:51:22 -0700
commit15d15965978d5ce73252e840c3da8ac15b48d858 (patch)
treee59fe3866ce720ec450f6380c20883cf4f9ea22f /src/gui/speechbubble.cpp
parente72f04528e93273af138375a68b09b5907fce964 (diff)
downloadmana-15d15965978d5ce73252e840c3da8ac15b48d858.tar.gz
mana-15d15965978d5ce73252e840c3da8ac15b48d858.tar.bz2
mana-15d15965978d5ce73252e840c3da8ac15b48d858.tar.xz
mana-15d15965978d5ce73252e840c3da8ac15b48d858.zip
On the offchance that a player's name is longer than 130 pixels, set the
mininum width for the text wrapping code to be the length of the player's name instead. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/speechbubble.cpp')
-rw-r--r--src/gui/speechbubble.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index b2c66ff2..f14dcd52 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -69,11 +69,11 @@ void SpeechBubble::setCaption(const std::string &name, const gcn::Color &color)
void SpeechBubble::setText(std::string mText)
{
- mSpeechBox->setTextWrapped(mText, 130);
+ int width = mCaption->getWidth() + 3;
+ mSpeechBox->setTextWrapped(mText, 130 > width ? 130 : width);
const int fontHeight = getFont()->getHeight();
const int numRows = mSpeechBox->getNumberOfRows() + 1;
- int width = mCaption->getWidth() + 3;
if (width < mSpeechBox->getMinWidth())
width = mSpeechBox->getMinWidth();