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/resources/emotedb.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/resources/emotedb.h')
-rw-r--r-- | src/resources/emotedb.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h index cc3b30f7..1ed86a05 100644 --- a/src/resources/emotedb.h +++ b/src/resources/emotedb.h @@ -22,7 +22,6 @@ #ifndef EMOTE_DB_H #define EMOTE_DB_H -#include <map> #include <string> #include "utils/xml.h" @@ -31,13 +30,12 @@ class ImageSprite; struct Emote { + int id; + int effectId; std::string name; ImageSprite *sprite; - int effect; }; -using Emotes = std::map<int, Emote *>; - /** * Emote information database. */ @@ -51,11 +49,10 @@ namespace EmoteDB void unload(); - const Emote *get(int id); - - int getLast(); + const Emote &get(int id); + const Emote &getByIndex(int index); - using EmotesIterator = Emotes::iterator; + int getEmoteCount(); } #endif // EMOTE_DB_H |