summaryrefslogtreecommitdiff
path: root/src/gui/widgets/emoteshortcutcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-17 16:34:36 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-17 16:34:36 +0300
commitc6c4eef4e49bb4de90845408af9f642a1a4e224b (patch)
tree81d192e85b3c075cb2e52671bea4c3c0499dc3f2 /src/gui/widgets/emoteshortcutcontainer.cpp
parent093e392dd84c920d26bca17d48ac6611393d087c (diff)
downloadmv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.gz
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.bz2
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.xz
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.zip
Improve size calculations.
Diffstat (limited to 'src/gui/widgets/emoteshortcutcontainer.cpp')
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 17d825909..2347edd0c 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -131,17 +131,18 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
graphics->setColor(getForegroundColor());
g->drawText(key, emoteX + 2, emoteY + 2, gcn::Graphics::LEFT);
}
+ unsigned sz = mEmoteImg.size();
for (unsigned i = 0; i < mMaxItems; i++)
{
- if (i < mEmoteImg.size() && mEmoteImg[i] && mEmoteImg[i]->sprite)
+ if (i < sz && mEmoteImg[i] && mEmoteImg[i]->sprite)
{
mEmoteImg[i]->sprite->draw(g, (i % mGridWidth) * mBoxWidth + 2,
(i / mGridWidth) * mBoxHeight + 10);
}
}
- if (mEmoteMoved && mEmoteMoved < static_cast<unsigned>(
- mEmoteImg.size()) + 1 && mEmoteMoved > 0)
+ if (mEmoteMoved && mEmoteMoved < static_cast<unsigned>(sz) + 1
+ && mEmoteMoved > 0)
{
// Draw the emote image being dragged by the cursor.
const EmoteSprite* sprite = mEmoteImg[mEmoteMoved - 1];