Merge pull request #7363 from furo321/correct-chat-limit

Change chat input size to 256
This commit is contained in:
Robert Müller 2023-10-23 20:48:02 +00:00 committed by GitHub
commit 565f9d1b59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -19,7 +19,7 @@
#include "chat.h"
char CChat::ms_aDisplayText[512] = {'\0'};
char CChat::ms_aDisplayText[MAX_LINE_LENGTH] = {'\0'};
CChat::CChat()
{
@ -326,7 +326,7 @@ bool CChat::OnInput(const IInput::CEvent &Event)
// insert the command
if(pCompletionCommand)
{
char aBuf[256];
char aBuf[MAX_LINE_LENGTH];
// add part before the name
str_truncate(aBuf, sizeof(aBuf), m_Input.GetString(), m_PlaceholderOffset);
@ -387,7 +387,7 @@ bool CChat::OnInput(const IInput::CEvent &Event)
// insert the name
if(pCompletionString)
{
char aBuf[256];
char aBuf[MAX_LINE_LENGTH];
// add part before the name
str_truncate(aBuf, sizeof(aBuf), m_Input.GetString(), m_PlaceholderOffset);
@ -594,7 +594,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
else if(pEnd == 0)
pEnd = pStrOld;
if(++Length >= 256)
if(++Length >= MAX_LINE_LENGTH)
{
*(const_cast<char *>(pStr)) = 0;
break;

View file

@ -15,17 +15,17 @@
class CChat : public CComponent
{
CLineInputBuffered<512> m_Input;
static constexpr float CHAT_WIDTH = 200.0f;
static constexpr float CHAT_HEIGHT_FULL = 200.0f;
static constexpr float CHAT_HEIGHT_MIN = 50.0f;
enum
{
MAX_LINES = 25
MAX_LINES = 25,
MAX_LINE_LENGTH = 256
};
CLineInputBuffered<MAX_LINE_LENGTH> m_Input;
struct CLine
{
int64_t m_Time;
@ -36,7 +36,7 @@ class CChat : public CComponent
bool m_Whisper;
int m_NameColor;
char m_aName[64];
char m_aText[512];
char m_aText[MAX_LINE_LENGTH];
bool m_Friend;
bool m_Highlighted;
@ -82,10 +82,10 @@ class CChat : public CComponent
bool m_Show;
bool m_CompletionUsed;
int m_CompletionChosen;
char m_aCompletionBuffer[256];
char m_aCompletionBuffer[MAX_LINE_LENGTH];
int m_PlaceholderOffset;
int m_PlaceholderLength;
static char ms_aDisplayText[512];
static char ms_aDisplayText[MAX_LINE_LENGTH];
struct CRateablePlayer
{
int ClientID;