diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-02-15 14:15:27 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-02-15 14:15:34 +0100 |
commit | 278d9aa7eb084bd6f93e6ac1fd84033dc316ab5e (patch) | |
tree | e1a095b48e34b844405801f7240501fe89579b38 /src/emoteshortcut.h | |
parent | 2779eb792a04667958feab9b433c1c82392c0bc3 (diff) | |
download | mana-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/emoteshortcut.h')
-rw-r--r-- | src/emoteshortcut.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/emoteshortcut.h b/src/emoteshortcut.h index 0d64e6da..598cc124 100644 --- a/src/emoteshortcut.h +++ b/src/emoteshortcut.h @@ -45,7 +45,7 @@ class EmoteShortcut * @param index Index of the shortcut Emote. */ int getEmote(int index) const - { return mEmotes[index]; } + { return mEmotes[index] - 1; } /** * Returns the amount of shortcut Emotes. @@ -65,7 +65,7 @@ class EmoteShortcut * @param index Index of the emotes. */ void setEmote(int index) - { mEmotes[index] = mEmoteSelected; } + { setEmotes(index, mEmoteSelected); } /** * Adds a emoticon to the emotes store specified by the index. @@ -74,7 +74,7 @@ class EmoteShortcut * @param emoteId ID of the emote. */ void setEmotes(int index, int emoteId) - { mEmotes[index] = emoteId; } + { mEmotes[index] = emoteId + 1; } /** * Set the Emote that is selected. @@ -87,8 +87,8 @@ class EmoteShortcut /** * A flag to check if the Emote is selected. */ - bool isEmoteSelected() - { return mEmoteSelected; } + bool isEmoteSelected() const + { return mEmoteSelected != -1; } /** * Remove a Emote from the shortcut. @@ -110,7 +110,7 @@ class EmoteShortcut void save(); int mEmotes[SHORTCUT_EMOTES]; /**< The emote stored. */ - int mEmoteSelected; /**< The emote held by cursor. */ + int mEmoteSelected = -1; /**< The emote held by cursor. */ }; |