diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-01 22:02:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-01 22:02:39 +0300 |
commit | 211787e349e0249fc032b3b51f8649af613f5ecf (patch) | |
tree | 71e67c6b58ecf836f47f836c9625e2bcae2a7db9 /src/emap/clif.c | |
parent | 4f35fa5d10ba0a30157205227f25aed6da67f4e1 (diff) | |
download | plugin-211787e349e0249fc032b3b51f8649af613f5ecf.tar.gz plugin-211787e349e0249fc032b3b51f8649af613f5ecf.tar.bz2 plugin-211787e349e0249fc032b3b51f8649af613f5ecf.tar.xz plugin-211787e349e0249fc032b3b51f8649af613f5ecf.zip |
Add hack for avoid npc_str buffer size limitation.
Now for npc_str used global variable. And it cant be used in any functions
except input related buildins.
Diffstat (limited to 'src/emap/clif.c')
-rw-r--r-- | src/emap/clif.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c index 63b7cc0..d3bf523 100644 --- a/src/emap/clif.c +++ b/src/emap/clif.c @@ -37,6 +37,7 @@ #include "emap/struct/sessionext.h" extern bool isInit; +extern char global_npc_str[1001]; static inline void RBUFPOS(const uint8 *p, unsigned short pos, @@ -1739,3 +1740,22 @@ void eclif_party_info_post(struct party_data *p, clif->party_option(p, sd, 2); } } + +/// NPC text input dialog value (CZ_INPUT_EDITDLGSTR). +/// 01d5 <packet len>.W <npc id>.L <string>.?B +void eclif_parse_NpcStringInput(int fd, + struct map_session_data* sd) +{ + int message_len = RFIFOW(fd, 2) - 8; + int npcid = RFIFOL(fd, 4); + const char *message = RFIFOP(fd, 8); + + if (message_len <= 0) + return; // invalid input + + if (message_len > 1000) + message_len = 1000; + + safestrncpy(global_npc_str, message, message_len); + npc->scriptcont(sd, npcid, false); +} |