summaryrefslogtreecommitdiff
path: root/src/textmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-24 14:32:36 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-24 14:32:36 +0300
commit0c3d18a076b2ac999f47500a76f5ebf3b1a722ed (patch)
tree4f474688d3937f84cbd490af265a6fa918b0ec52 /src/textmanager.cpp
parente0b255453f189f80aab146574bdcb873771801c6 (diff)
downloadplus-0c3d18a076b2ac999f47500a76f5ebf3b1a722ed.tar.gz
plus-0c3d18a076b2ac999f47500a76f5ebf3b1a722ed.tar.bz2
plus-0c3d18a076b2ac999f47500a76f5ebf3b1a722ed.tar.xz
plus-0c3d18a076b2ac999f47500a76f5ebf3b1a722ed.zip
improve textmanager class.
Diffstat (limited to 'src/textmanager.cpp')
-rw-r--r--src/textmanager.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index 29081769d..04e60d587 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -39,7 +39,7 @@ void TextManager::addText(Text *const text)
mTextList.push_back(text);
}
-void TextManager::moveText(Text *const text, const int x, const int y)
+void TextManager::moveText(Text *const text, const int x, const int y) const
{
text->mX = x;
text->mY = y;
@@ -72,7 +72,7 @@ void TextManager::draw(Graphics *const graphics,
}
void TextManager::place(const Text *const textObj, const Text *const omit,
- const int &x A_UNUSED, int &y, const int h)
+ const int &x A_UNUSED, int &y, const int h) const
{
const int xLeft = textObj->mX;
const int xRight1 = xLeft + textObj->mWidth;
@@ -88,12 +88,13 @@ void TextManager::place(const Text *const textObj, const Text *const omit,
for (TextList::const_iterator ptr = mTextList.begin(),
pEnd = mTextList.end(); ptr != pEnd && cnt < nBeings; ++ptr, cnt ++)
{
- if (*ptr != omit &&
- (*ptr)->mX + 1 <= xRight1 &&
- (*ptr)->mX + (*ptr)->mWidth > xLeft)
+ const Text *const text = *ptr;
+
+ if (text != omit && text->mX + 1 <= xRight1
+ && text->mX + text->mWidth > xLeft)
{
- int from = (*ptr)->mY - occupiedTop;
- int to = from + (*ptr)->mHeight - 1;
+ int from = text->mY - occupiedTop;
+ int to = from + text->mHeight - 1;
if (to < 0 || from >= TEST) // out of range considered
continue;
if (from < 0)