summaryrefslogtreecommitdiff
path: root/src/textmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-04 19:11:53 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-04 19:11:53 +0300
commit3a407bb6b73a186eafd99bcec570f88097c4b2e1 (patch)
treeea57a752c348ba0a883294855ad3c62c16e9749d /src/textmanager.cpp
parent872fc368f7b253f26714fc47323064f270b62b40 (diff)
downloadmanaplus-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.gz
manaplus-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.bz2
manaplus-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.xz
manaplus-3a407bb6b73a186eafd99bcec570f88097c4b2e1.zip
Add const to more classes.
Diffstat (limited to 'src/textmanager.cpp')
-rw-r--r--src/textmanager.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index 3cd36e449..bb0112978 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -33,20 +33,20 @@ TextManager::TextManager()
{
}
-void TextManager::addText(Text *text)
+void TextManager::addText(Text *const text)
{
place(text, nullptr, text->mX, text->mY, text->mHeight);
mTextList.push_back(text);
}
-void TextManager::moveText(Text *text, int x, int y)
+void TextManager::moveText(Text *const text, const int x, const int y)
{
text->mX = x;
text->mY = y;
place(text, text, text->mX, text->mY, text->mHeight);
}
-void TextManager::removeText(const Text *text)
+void TextManager::removeText(const Text *const text)
{
for (TextList::iterator ptr = mTextList.begin(),
pEnd = mTextList.end(); ptr != pEnd; ++ptr)
@@ -63,7 +63,8 @@ TextManager::~TextManager()
{
}
-void TextManager::draw(gcn::Graphics *graphics, int xOff, int yOff)
+void TextManager::draw(gcn::Graphics *const graphics,
+ const int xOff, const int yOff)
{
for (TextList::const_iterator bPtr = mTextList.begin(),
ePtr = mTextList.end();
@@ -73,17 +74,17 @@ void TextManager::draw(gcn::Graphics *graphics, int xOff, int yOff)
}
}
-void TextManager::place(const Text *textObj, const Text *omit,
- int &x A_UNUSED, int &y, int h)
+void TextManager::place(const Text *const textObj, const Text *const omit,
+ const int &x A_UNUSED, int &y, const int h)
{
- int xLeft = textObj->mX;
- int xRight1 = xLeft + textObj->mWidth;
+ const int xLeft = textObj->mX;
+ const int xRight1 = xLeft + textObj->mWidth;
const int TEST = 50; // Number of lines to test for text
const int nBeings = 50;
bool occupied[TEST]; // is some other text obscuring this line?
std::memset(&occupied, 0, sizeof(occupied)); // set all to false
- int wantedTop = (TEST - h) / 2; // Entry in occupied at top of text
- int occupiedTop = y - wantedTop; // Line in map representing to of occupied
+ const int wantedTop = (TEST - h) / 2; // Entry in occupied at top of text
+ const int occupiedTop = y - wantedTop; // Line in map representing to of occupied
int cnt = 0;
for (TextList::const_iterator ptr = mTextList.begin(),