summaryrefslogtreecommitdiff
path: root/src/gui/emotepopup.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-15 14:15:27 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-15 14:15:34 +0100
commit278d9aa7eb084bd6f93e6ac1fd84033dc316ab5e (patch)
treee1a095b48e34b844405801f7240501fe89579b38 /src/gui/emotepopup.h
parent2779eb792a04667958feab9b433c1c82392c0bc3 (diff)
downloadmana-278d9aa7eb084bd6f93e6ac1fd84033dc316ab5e.tar.gz
mana-278d9aa7eb084bd6f93e6ac1fd84033dc316ab5e.tar.bz2
mana-278d9aa7eb084bd6f93e6ac1fd84033dc316ab5e.tar.xz
mana-278d9aa7eb084bd6f93e6ac1fd84033dc316ab5e.zip
Fix handling of non-consecutive emote IDs
Previous code was assuming there would be no gaps in the emote IDs. Also cleaned up some confusion where the "emote ID" being passed around in the code was often offset by 1. Now it is only offset in communication with tmwAthena and when saving the shortcuts.
Diffstat (limited to 'src/gui/emotepopup.h')
-rw-r--r--src/gui/emotepopup.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/gui/emotepopup.h b/src/gui/emotepopup.h
index ee905cd6..ef3fffed 100644
--- a/src/gui/emotepopup.h
+++ b/src/gui/emotepopup.h
@@ -28,9 +28,7 @@
#include <guichan/mouselistener.hpp>
#include <list>
-#include <vector>
-class ImageSprite;
class Image;
namespace gcn {
@@ -57,13 +55,14 @@ class EmotePopup : public Popup
*/
void draw(gcn::Graphics *graphics) override;
+ void mouseExited(gcn::MouseEvent &event) override;
void mousePressed(gcn::MouseEvent &event) override;
void mouseMoved(gcn::MouseEvent &event) override;
/**
* Returns the selected emote.
*/
- int getSelectedEmote() const;
+ int getSelectedEmoteId() const;
/**
* Adds a listener to the list that's notified each time a change to
@@ -87,7 +86,7 @@ class EmotePopup : public Popup
/**
* Sets the index of the currently selected emote.
*/
- void setSelectedEmoteIndex(int index);
+ void setSelectedEmoteId(int emoteId);
/**
* Returns the index at the specified coordinates. Returns -1 when
@@ -105,17 +104,14 @@ class EmotePopup : public Popup
*/
void distributeValueChangedEvent();
- std::vector<const ImageSprite*> mEmotes;
Image *mSelectionImage;
- int mSelectedEmoteIndex = -1;
+ int mSelectedEmoteId = -1;
int mHoveredEmoteIndex = -1;
int mRowCount = 1;
int mColumnCount = 1;
- using Listeners = std::list<gcn::SelectionListener *>;
-
- Listeners mListeners;
+ std::list<gcn::SelectionListener *> mListeners;
static const int gridWidth;
static const int gridHeight;