summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-11-15 04:01:03 +0100
committerGitHub <noreply@github.com>2018-11-15 04:01:03 +0100
commit47d6523817646f2d4f081b93ec44a971a01fce25 (patch)
tree39f5f62367fed1efe1dd734a2f3a588f2e44a9f4 /src/map/atcommand.c
parent3b93418544f84f142ea2a6e2bcdf1621267ff989 (diff)
parent1f237031a63567d8c96bca4a28ab9557ebe1459e (diff)
downloadhercules-47d6523817646f2d4f081b93ec44a971a01fce25.tar.gz
hercules-47d6523817646f2d4f081b93ec44a971a01fce25.tar.bz2
hercules-47d6523817646f2d4f081b93ec44a971a01fce25.tar.xz
hercules-47d6523817646f2d4f081b93ec44a971a01fce25.zip
Merge pull request #2321 from 4144/packetlen
Add complete packet len table
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index c8cca2aea..179b96c32 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -62,6 +62,7 @@
#include "common/memmgr.h"
#include "common/mmo.h" // MAX_CARTS
#include "common/nullpo.h"
+#include "common/packets.h"
#include "common/random.h"
#include "common/showmsg.h"
#include "common/socket.h"
@@ -262,12 +263,15 @@ ACMD(send)
if (len) {
// show packet length
- safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,904), type, clif->packet(type)->len); // Packet 0x%x length: %d
+ Assert_retr(false, type <= MAX_PACKET_DB && type >= MIN_PACKET_DB);
+ len = packets->db[type];
+ safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,904), type, len); // Packet 0x%x length: %d
clif->message(fd, atcmd_output);
return true;
}
- len = clif->packet(type)->len;
+ Assert_retr(false, type <= MAX_PACKET_DB && type >= MIN_PACKET_DB);
+ len = packets->db[type];
if (len == -1) {
// dynamic packet
@@ -415,7 +419,7 @@ ACMD(send)
SKIP_VALUE(message);
}
- if (clif->packet(type)->len == -1) { // send dynamic packet
+ if (packets->db[type] == -1) { // send dynamic packet
WFIFOW(sd->fd,2)=TOW(off);
WFIFOSET(sd->fd,off);
} else {// send static packet