diff options
author | Haru <haru@dotalux.com> | 2015-10-04 22:50:36 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-10-04 22:50:36 +0200 |
commit | acbbba21c888c7e8c9a6c31652dfd61c90ca6ac8 (patch) | |
tree | 3758e0d16b4090f31271682f86133f34598cee97 /src/map/clif.c | |
parent | 4db986b93566d673c226971fa045f1dc99645242 (diff) | |
download | hercules-acbbba21c888c7e8c9a6c31652dfd61c90ca6ac8.tar.gz hercules-acbbba21c888c7e8c9a6c31652dfd61c90ca6ac8.tar.bz2 hercules-acbbba21c888c7e8c9a6c31652dfd61c90ca6ac8.tar.xz hercules-acbbba21c888c7e8c9a6c31652dfd61c90ca6ac8.zip |
Added clif->packet() to retrieve info about a packet.
- As per Malufett/Michieru request, in order to make it possible for a
plugin to obtain information about a packet.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 243aa6a43..59c8a7197 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -18680,6 +18680,19 @@ int clif_parse(int fd) { return 0; } +/** + * Returns information about the given packet ID. + * + * @param packet_id The packet ID. + * @return The corresponding packet_db entry, if any. + */ +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < MIN_PACKET_DB || packet_id > MAX_PACKET_DB || packet_db[packet_id].len == 0) + return NULL; + return &packet_db[packet_id]; +} + static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { va_list va; int i; @@ -18815,6 +18828,7 @@ void clif_defaults(void) { clif->parse = clif_parse; clif->parse_cmd = clif_parse_cmd_optional; clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; /* auth */ clif->authok = clif_authok; clif->authrefuse = clif_authrefuse; |