Minor clean up in clif_displaymessage function (#3957)

* Clean up `clif_displaymessage` function
This commit is contained in:
keitenai 2019-02-22 00:25:58 +08:00 committed by Daegaladh
parent 42920b2794
commit bfb6b831f8

View File

@ -6177,11 +6177,11 @@ void clif_displaymessage(const int fd, const char* mes)
message = aStrdup(mes);
line = strtok(message, "\n");
while(line != NULL) {
#if PACKETVER == 20141022
/** for some reason game client crashes depending on message pattern (only for this packet) **/
/** so we redirect to ZC_NPC_CHAT **/
//clif_messagecolor(&sd->bl, color_table[COLOR_DEFAULT], mes, false, SELF);
while(line != NULL) {
unsigned long color = (color_table[COLOR_DEFAULT] & 0x0000FF) << 16 | (color_table[COLOR_DEFAULT] & 0x00FF00) | (color_table[COLOR_DEFAULT] & 0xFF0000) >> 16; // RGB to BGR
unsigned short len = strnlen(line, CHAT_SIZE_MAX);
@ -6195,7 +6195,6 @@ void clif_displaymessage(const int fd, const char* mes)
WFIFOSET(fd, WFIFOW(fd, 2));
}
#else
while(line != NULL) {
// Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client)
int len = strnlen(line, CHAT_SIZE_MAX);