mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Changed the server greeting buffer from 256 to 1024
* Changed the server greeting buffer size to accept longer strings * Added comment explaining character limit for greeting buffer * Moved chat constants to header file to allow access from includes
This commit is contained in:
@@ -24,11 +24,6 @@
|
||||
#include "../platform/platform.h"
|
||||
#include "../util/util.h"
|
||||
|
||||
#define CHAT_HISTORY_SIZE 10
|
||||
#define CHAT_INPUT_SIZE 256
|
||||
#define CHAT_MAX_MESSAGE_LENGTH 200
|
||||
#define CHAT_MAX_WINDOW_WIDTH 600
|
||||
|
||||
bool gChatOpen = false;
|
||||
char _chatCurrentLine[CHAT_MAX_MESSAGE_LENGTH];
|
||||
char _chatHistory[CHAT_HISTORY_SIZE][CHAT_INPUT_SIZE];
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
#include "../common.h"
|
||||
#include "../drawing/drawing.h"
|
||||
|
||||
#define CHAT_HISTORY_SIZE 10
|
||||
#define CHAT_INPUT_SIZE 1024
|
||||
#define CHAT_MAX_MESSAGE_LENGTH 200
|
||||
#define CHAT_MAX_WINDOW_WIDTH 600
|
||||
|
||||
extern bool gChatOpen;
|
||||
|
||||
void chat_open();
|
||||
|
||||
@@ -2152,13 +2152,13 @@ void network_chat_show_server_greeting()
|
||||
{
|
||||
const char* greeting = gConfigNetwork.server_greeting;
|
||||
if (!str_is_null_or_empty(greeting)) {
|
||||
static char greeting_formatted[256];
|
||||
static char greeting_formatted[CHAT_INPUT_SIZE];
|
||||
char* lineCh = greeting_formatted;
|
||||
greeting_formatted[0] = 0;
|
||||
lineCh = utf8_write_codepoint(lineCh, FORMAT_OUTLINE);
|
||||
lineCh = utf8_write_codepoint(lineCh, FORMAT_GREEN);
|
||||
char* ptrtext = lineCh;
|
||||
safe_strcpy(lineCh, greeting, 240);
|
||||
safe_strcpy(lineCh, greeting, CHAT_INPUT_SIZE - 24); // Limit to 1000 characters so we don't overflow the buffer
|
||||
utf8_remove_format_codes((utf8*)ptrtext, true);
|
||||
chat_history_add(greeting_formatted);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user