From 211787e349e0249fc032b3b51f8649af613f5ecf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 1 Sep 2016 22:02:39 +0300 Subject: 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. --- src/emap/clif.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/emap/clif.c') 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 .W .L .?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); +} -- cgit v1.2.3-70-g09d2