summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-10-16 01:20:24 +0000
committerIra Rice <irarice@gmail.com>2008-10-16 01:20:24 +0000
commitbe1af40e371845bcad1337cc59e5f5ac0f991f02 (patch)
treeb69af163b0bd59c8a30ebb94629df9091caec242 /src/being.cpp
parent11e74c7299895136b366c2ea344a7ae98b374b96 (diff)
downloadmana-client-be1af40e371845bcad1337cc59e5f5ac0f991f02.tar.gz
mana-client-be1af40e371845bcad1337cc59e5f5ac0f991f02.tar.bz2
mana-client-be1af40e371845bcad1337cc59e5f5ac0f991f02.tar.xz
mana-client-be1af40e371845bcad1337cc59e5f5ac0f991f02.zip
Fixed a width that I accidently messed up earlier, as well as made text
and speech bubble transitions smoother.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 4958700f..f05652f3 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -164,16 +164,6 @@ void Being::setSpeech(const std::string &text, Uint32 time)
{
mSpeech = text;
- if (!config.getValue("speechbubble", 1))
- {
- // don't introduce a memory leak
- delete mText;
-
- mText = new Text(text, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET,
- gcn::Graphics::CENTER, speechFont,
- gcn::Color(255, 255, 255));
- }
-
mSpeechTime = 500;
}
@@ -468,6 +458,12 @@ void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY)
// Draw speech above this being
if (mSpeechTime > 0 && config.getValue("speechbubble", 1))
{
+ if (mText)
+ {
+ delete mText;
+ mText = 0;
+ }
+
mSpeechBubble->setCaption(mName);
mSpeechBubble->setWindowName(mName);
// Not quite centered, but close enough. However, it's not too important to get
@@ -477,6 +473,20 @@ void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY)
(mSpeechBubble->getNumRows()*14));
mSpeechBubble->setVisible(true);
}
+ else if (!config.getValue("speechbubble", 1))
+ {
+ mSpeechBubble->setVisible(false);
+ // don't introduce a memory leak
+ if (mText)
+ {
+ delete mText;
+ mText = 0;
+ }
+
+ mText = new Text(mSpeech, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET,
+ gcn::Graphics::CENTER, speechFont,
+ gcn::Color(255, 255, 255));
+ }
else if (mSpeechTime == 0)
{
mSpeechBubble->setVisible(false);