summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-17 16:23:15 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-17 16:23:15 +0300
commitfa1bd85d4461a0a35f8843ac0965e2de5fd6b27e (patch)
treef7201baebfa949ece2c93130c89f565c202db6cc /src/being/being.cpp
parenta714d83889a34d30b542c3c6ab7c49228fe71f53 (diff)
downloadmanaverse-fa1bd85d4461a0a35f8843ac0965e2de5fd6b27e.tar.gz
manaverse-fa1bd85d4461a0a35f8843ac0965e2de5fd6b27e.tar.bz2
manaverse-fa1bd85d4461a0a35f8843ac0965e2de5fd6b27e.tar.xz
manaverse-fa1bd85d4461a0a35f8843ac0965e2de5fd6b27e.zip
improve a bit draw speed in over head texts.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 34f6b64ce..2458f33c4 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -500,6 +500,12 @@ void Being::setSpeech(const std::string &text, const std::string &channel,
&userPalette->getColor(UserPalette::PARTICLE),
true);
}
+ else
+ {
+ const bool isShowName = (speech == NAME_IN_BUBBLE);
+ mSpeechBubble->setCaption(isShowName ? mName : "");
+ mSpeechBubble->setText(mSpeech, isShowName);
+ }
}
void Being::takeDamage(Being *const attacker, const int amount,
@@ -1631,14 +1637,10 @@ void Being::drawSpeech(const int offsetX, const int offsetY)
else if (mSpeechTime > 0 && (speech == NAME_IN_BUBBLE ||
speech == NO_NAME_IN_BUBBLE))
{
- const bool isShowName = (speech == NAME_IN_BUBBLE);
-
delete mText;
mText = nullptr;
- mSpeechBubble->setCaption(isShowName ? mName : "");
-
- mSpeechBubble->setText(mSpeech, isShowName);
+ const bool isShowName = (speech == NAME_IN_BUBBLE);
mSpeechBubble->setPosition(px - (mSpeechBubble->getWidth() / 2),
py - getHeight() - (mSpeechBubble->getHeight()));
mSpeechBubble->setVisible(true);