From 15d15965978d5ce73252e840c3da8ac15b48d858 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Wed, 4 Feb 2009 13:51:22 -0700 Subject: 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 --- src/gui/speechbubble.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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(); -- cgit v1.2.3-70-g09d2