src/network/network_chat_gui.cpp
changeset 10207 c291a21b304e
parent 10134 213b85713d03
child 10276 b60b7e17db62
equal deleted inserted replaced
10206:0050610c0368 10207:c291a21b304e
    25 #include "network_internal.h"
    25 #include "network_internal.h"
    26 #include "network_client.h"
    26 #include "network_client.h"
    27 
    27 
    28 #include "table/strings.h"
    28 #include "table/strings.h"
    29 
    29 
    30 /* The draw buffer must be able to contain the chat message, player name and the "[All]" message,
    30 /* The draw buffer must be able to contain the chat message, client name and the "[All]" message,
    31  * some spaces and possible translations of [All] to other languages. */
    31  * some spaces and possible translations of [All] to other languages. */
    32 assert_compile((int)DRAW_STRING_BUFFER >= (int)NETWORK_CHAT_LENGTH + NETWORK_NAME_LENGTH + 40);
    32 assert_compile((int)DRAW_STRING_BUFFER >= (int)NETWORK_CHAT_LENGTH + NETWORK_NAME_LENGTH + 40);
    33 
    33 
    34 enum {
    34 enum {
    35 	NETWORK_CHAT_LINE_HEIGHT = 13,
    35 	NETWORK_CHAT_LINE_HEIGHT = 13,
    97 
    97 
    98 	for (bufp = buf; lines != 0; lines--) {
    98 	for (bufp = buf; lines != 0; lines--) {
    99 		ChatMessage *cmsg = &_chatmsg_list[msg_count++];
    99 		ChatMessage *cmsg = &_chatmsg_list[msg_count++];
   100 		ttd_strlcpy(cmsg->message, bufp, sizeof(cmsg->message));
   100 		ttd_strlcpy(cmsg->message, bufp, sizeof(cmsg->message));
   101 
   101 
   102 		/* The default colour for a message is player colour. Replace this with
   102 		/* The default colour for a message is company colour. Replace this with
   103 		 * white for any additional lines */
   103 		 * white for any additional lines */
   104 		cmsg->color = (bufp == buf && color & IS_PALETTE_COLOR) ? color : (0x1D - 15) | IS_PALETTE_COLOR;
   104 		cmsg->color = (bufp == buf && color & IS_PALETTE_COLOR) ? color : (0x1D - 15) | IS_PALETTE_COLOR;
   105 		cmsg->end_date = _date + duration;
   105 		cmsg->end_date = _date + duration;
   106 
   106 
   107 		bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string
   107 		bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string