diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-08 00:17:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-08 00:17:45 +0300 |
commit | 593cccb16074fe9269dd2f278bd79859769eb1fd (patch) | |
tree | d8b3d93001021c59622ea88140dbbef8aee05013 /src/text.cpp | |
parent | b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2 (diff) | |
download | manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.gz manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.bz2 manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.xz manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.zip |
Improve constructors in some classes.
Diffstat (limited to 'src/text.cpp')
-rw-r--r-- | src/text.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/text.cpp b/src/text.cpp index 29bed5375..41b2b01ca 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -44,15 +44,14 @@ Text::Text(const std::string &text, const int x, const int y, const gcn::Graphics::Alignment alignment, const gcn::Color* color, const bool isSpeech, gcn::Font *const font) : + mFont(font ? font : gui->getFont()), + mY(y), + mWidth(mFont->getWidth(text)), + mHeight(mFont->getHeight()), mText(text), mColor(color), mIsSpeech(isSpeech) { - if (!font) - mFont = gui->getFont(); - else - mFont = font; - if (!textManager) { textManager = new TextManager; @@ -74,8 +73,6 @@ Text::Text(const std::string &text, const int x, const int y, } } ++mInstances; - mHeight = mFont->getHeight(); - mWidth = mFont->getWidth(text); switch (alignment) { @@ -92,7 +89,6 @@ Text::Text(const std::string &text, const int x, const int y, break; } mX = x - mXOffset; - mY = y; if (textManager) textManager->addText(this); } |