diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-04 19:11:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-04 19:11:53 +0300 |
commit | 3a407bb6b73a186eafd99bcec570f88097c4b2e1 (patch) | |
tree | ea57a752c348ba0a883294855ad3c62c16e9749d /src/textmanager.cpp | |
parent | 872fc368f7b253f26714fc47323064f270b62b40 (diff) | |
download | manaverse-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.gz manaverse-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.bz2 manaverse-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.xz manaverse-3a407bb6b73a186eafd99bcec570f88097c4b2e1.zip |
Add const to more classes.
Diffstat (limited to 'src/textmanager.cpp')
-rw-r--r-- | src/textmanager.cpp | 21 |
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(), |