diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-12-27 23:22:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-12-27 23:22:46 +0300 |
commit | cff45e3874cb71ed89f97d04f04bcb5da93ab010 (patch) | |
tree | 15d38ae257f8a54b3ed86011f6abdf6690142097 /src | |
parent | 07c8e54506f12d15044e0ded3e0da8b2114aeed7 (diff) | |
download | manaplus-cff45e3874cb71ed89f97d04f04bcb5da93ab010.tar.gz manaplus-cff45e3874cb71ed89f97d04f04bcb5da93ab010.tar.bz2 manaplus-cff45e3874cb71ed89f97d04f04bcb5da93ab010.tar.xz manaplus-cff45e3874cb71ed89f97d04f04bcb5da93ab010.zip |
Add restrict keyword in emotheshortcutcontainer.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 36 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.h | 26 |
2 files changed, 37 insertions, 25 deletions
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 455a657b5..bdefb6b49 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -48,7 +48,8 @@ static const int MAX_ITEMS = 48; -EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *const widget) : +EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *restrict const + widget) : ShortcutContainer(widget), mEmoteImg(), mEmoteClicked(false), @@ -72,14 +73,15 @@ EmoteShortcutContainer::~EmoteShortcutContainer() { } -void EmoteShortcutContainer::setWidget2(const Widget2 *const widget) +void EmoteShortcutContainer::setWidget2(const Widget2 *restrict const widget) + restrict2 { Widget2::setWidget2(widget); mForegroundColor = getThemeColor(ThemeColorId::TEXT); mForegroundColor2 = getThemeColor(ThemeColorId::TEXT_OUTLINE); } -void EmoteShortcutContainer::draw(Graphics *graphics) +void EmoteShortcutContainer::draw(Graphics *restrict graphics) restrict2 { if (!emoteShortcut) return; @@ -100,10 +102,10 @@ void EmoteShortcutContainer::draw(Graphics *graphics) sz = mMaxItems; for (unsigned i = 0; i < sz; i++) { - const EmoteSprite *const emoteImg = mEmoteImg[i]; + const EmoteSprite *restrict const emoteImg = mEmoteImg[i]; if (emoteImg) { - const AnimatedSprite *const sprite = emoteImg->sprite; + const AnimatedSprite *restrict const sprite = emoteImg->sprite; if (sprite) { sprite->draw(graphics, @@ -131,7 +133,7 @@ void EmoteShortcutContainer::draw(Graphics *graphics) BLOCK_END("EmoteShortcutContainer::draw") } -void EmoteShortcutContainer::safeDraw(Graphics *graphics) +void EmoteShortcutContainer::safeDraw(Graphics *restrict graphics) restrict2 { if (!emoteShortcut) return; @@ -152,10 +154,10 @@ void EmoteShortcutContainer::safeDraw(Graphics *graphics) sz = mMaxItems; for (unsigned i = 0; i < sz; i++) { - const EmoteSprite *const emoteImg = mEmoteImg[i]; + const EmoteSprite *restrict const emoteImg = mEmoteImg[i]; if (emoteImg) { - const AnimatedSprite *const sprite = emoteImg->sprite; + const AnimatedSprite *restrict const sprite = emoteImg->sprite; if (sprite) { sprite->draw(graphics, @@ -183,11 +185,12 @@ void EmoteShortcutContainer::safeDraw(Graphics *graphics) BLOCK_END("EmoteShortcutContainer::draw") } -void EmoteShortcutContainer::mouseDragged(MouseEvent &event A_UNUSED) +void EmoteShortcutContainer::mouseDragged(MouseEvent &restrict event A_UNUSED) + restrict2 { } -void EmoteShortcutContainer::mousePressed(MouseEvent &event) +void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2 { if (!emoteShortcut) return; @@ -210,7 +213,8 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &event) } } -void EmoteShortcutContainer::mouseReleased(MouseEvent &event) +void EmoteShortcutContainer::mouseReleased(MouseEvent &restrict event) + restrict2 { if (!emoteShortcut) return; @@ -242,7 +246,7 @@ void EmoteShortcutContainer::mouseReleased(MouseEvent &event) } } -void EmoteShortcutContainer::mouseMoved(MouseEvent &event) +void EmoteShortcutContainer::mouseMoved(MouseEvent &restrict event) restrict2 { if (!emoteShortcut || !textPopup) return; @@ -256,19 +260,21 @@ void EmoteShortcutContainer::mouseMoved(MouseEvent &event) if (static_cast<size_t>(index) < mEmoteImg.size() && mEmoteImg[index]) { - const EmoteSprite *const sprite = mEmoteImg[index]; + const EmoteSprite *restrict const sprite = mEmoteImg[index]; textPopup->show(viewport->mMouseX, viewport->mMouseY, strprintf("%s, %d", sprite->name.c_str(), sprite->id)); } } -void EmoteShortcutContainer::mouseExited(MouseEvent &event A_UNUSED) +void EmoteShortcutContainer::mouseExited(MouseEvent &restrict event A_UNUSED) + restrict2 { if (textPopup) textPopup->setVisible(Visible_false); } -void EmoteShortcutContainer::widgetHidden(const Event &event A_UNUSED) +void EmoteShortcutContainer::widgetHidden(const Event &restrict event A_UNUSED) + restrict2 { if (textPopup) textPopup->setVisible(Visible_false); diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index a4e52b2bf..2dcb72f4b 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -37,7 +37,7 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - explicit EmoteShortcutContainer(Widget2 *const widget); + explicit EmoteShortcutContainer(Widget2 *restrict const widget); A_DELETE_COPY(EmoteShortcutContainer) @@ -49,32 +49,38 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(Graphics *graphics) override final A_NONNULL(2); + void draw(Graphics *restrict graphics) + restrict2 override final A_NONNULL(2); - void safeDraw(Graphics *graphics) override final A_NONNULL(2); + void safeDraw(Graphics *restrict graphics) + restrict2 override final A_NONNULL(2); /** * Handles mouse when dragged. */ - void mouseDragged(MouseEvent &event) override final A_CONST; + void mouseDragged(MouseEvent &restrict event) + restrict2 override final A_CONST; /** * Handles mouse when pressed. */ - void mousePressed(MouseEvent &event) override final; + void mousePressed(MouseEvent &restrict event) restrict2 override final; /** * Handles mouse release. */ - void mouseReleased(MouseEvent &event) override final; + void mouseReleased(MouseEvent &restrict event) + restrict2 override final; - void mouseMoved(MouseEvent &event) override final; + void mouseMoved(MouseEvent &restrict event) restrict2 override final; - void mouseExited(MouseEvent &event) override final; + void mouseExited(MouseEvent &restrict event) restrict2 override final; - void widgetHidden(const Event &event) override final; + void widgetHidden(const Event &restrict event) + restrict2 override final; - void setWidget2(const Widget2 *const widget) override final; + void setWidget2(const Widget2 *restrict const widget) + restrict2 override final; private: std::vector<const EmoteSprite*> mEmoteImg; |