From fa1bd85d4461a0a35f8843ac0965e2de5fd6b27e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 17 Dec 2013 16:23:15 +0300 Subject: improve a bit draw speed in over head texts. --- src/being/being.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/being') 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); -- cgit v1.2.3-70-g09d2