diff options
author | shennetsind <ind@henn.et> | 2013-05-09 18:45:10 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-05-09 18:45:10 -0300 |
commit | ac3caf50ec83838486e18294a2d1b68794439119 (patch) | |
tree | 4c447cf07acd4f7e2b0d08409f61c5ec6232bfde /src | |
parent | cbda33ca47776479831896a3c3d13cc6253730da (diff) | |
download | hercules-ac3caf50ec83838486e18294a2d1b68794439119.tar.gz hercules-ac3caf50ec83838486e18294a2d1b68794439119.tar.bz2 hercules-ac3caf50ec83838486e18294a2d1b68794439119.tar.xz hercules-ac3caf50ec83838486e18294a2d1b68794439119.zip |
Fixed @go \n problem.
Special Thanks to Yommy, Fatalis.
http://hercules.ws/board/topic/570-problem-on-go-text/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 24 | ||||
-rw-r--r-- | src/map/clif.c | 36 | ||||
-rw-r--r-- | src/map/clif.h | 1 |
3 files changed, 45 insertions, 16 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 9c14f3dbd..63d20d70d 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -876,9 +876,8 @@ ACMD(option) // notify the user of the requirement to enter an option clif->message(fd, msg_txt(921)); // Please enter at least one option. - if( text ) - {// send the help text associated with this command - clif->message( fd, text ); + if( text ) {// send the help text associated with this command + clif->messageln( fd, text ); } return false; @@ -969,7 +968,7 @@ ACMD(jobchange) if (!found) { text = atcommand_help_string(info); if (text) - clif->message(fd, text); + clif->messageln(fd, text); return false; } } @@ -992,7 +991,7 @@ ACMD(jobchange) } else { text = atcommand_help_string(info); if (text) - clif->message(fd, text); + clif->messageln(fd, text); return false; } @@ -1767,9 +1766,8 @@ ACMD(go) clif->message(fd, msg_txt(38)); // Invalid location number, or name. - if( text ) - {// send the text to the client - clif->message( fd, text ); + if( text ) {// send the text to the client + clif->messageln( fd, text ); } return false; @@ -3122,9 +3120,8 @@ ACMD(questskill) // send the error message as always clif->message(fd, msg_txt(1027)); // Please enter a quest skill number. - if( text ) - {// send the skill ID list associated with this command - clif->message( fd, text ); + if( text ) {// send the skill ID list associated with this command + clif->messageln( fd, text ); } return false; @@ -3166,9 +3163,8 @@ ACMD(lostskill) // send the error message as always clif->message(fd, msg_txt(1027)); // Please enter a quest skill number. - if( text ) - {// send the skill ID list associated with this command - clif->message( fd, text ); + if( text ) {// send the skill ID list associated with this command + clif->messageln( fd, text ); } return false; diff --git a/src/map/clif.c b/src/map/clif.c index 9b9780a05..f801c7c99 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5657,6 +5657,39 @@ void clif_displaymessage(const int fd, const char* mes) { } } } +void clif_displaymessage2(const int fd, const char* mes) { + // invalid pointer? + nullpo_retv(mes); + + //Scrapped, as these are shared by disconnected players =X [Skotlex] + if (fd == 0) + ; + else { + // Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client) + char *message, *line; + + message = aStrdup(mes); + line = strtok(message, "\n"); + while(line != NULL) { + // Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client) + int len = strnlen(line, 255); + + if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line. + if( fd == -2 ) { + ShowInfo("HCP: %s\n",line); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; // 4 + len + NULL teminate + safestrncpy((char *)WFIFOP(fd,4), line, len + 1); + WFIFOSET(fd, 5 + len); + } + } + line = strtok(NULL, "\n"); + } + aFree(message); + } +} /// Send broadcast message in yellow or blue without font formatting (ZC_BROADCAST). /// 009a <packet len>.W <message>.?B @@ -9838,11 +9871,9 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) } else if ( sd->fontcolor && !sd->chatID ) { char mout[200]; unsigned char mylen = 1; - ShowDebug("Hi1:%d\n",sd->disguise); if( sd->disguise == -1 ) { pc_disguise(sd,sd->status.class_); - ShowDebug("Hi2:%d\n",sd->disguise); sd->fontcolor_tid = add_timer(gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != INVALID_TIMER ) { const struct TimerData *timer; @@ -17369,6 +17400,7 @@ void clif_defaults(void) { clif->msgtable = clif_msgtable; clif->msgtable_num = clif_msgtable_num; clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; clif->colormes = clif_colormes; clif->process_message = clif_process_message; clif->wisexin = clif_wisexin; diff --git a/src/map/clif.h b/src/map/clif.h index 8c1147ceb..2aec3350a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -677,6 +677,7 @@ struct clif_interface { void (*msgtable) (int fd, int line); void (*msgtable_num) (int fd, int line, int num); void (*message) (const int fd, const char* mes); + void (*messageln) (const int fd, const char* mes); int (*colormes) (int fd, enum clif_colors color, const char* msg); bool (*process_message) (struct map_session_data* sd, int format, char** name_, int* namelen_, char** message_, int* messagelen_); void (*wisexin) (struct map_session_data *sd,int type,int flag); |