Removed magic value, reverted hud.h

This commit is contained in:
LordSk 2018-11-26 17:56:07 +01:00
parent 8c905013b5
commit 1895d1a3fa
3 changed files with 7 additions and 8 deletions

View file

@ -228,7 +228,7 @@ void CBroadcast::OnMessage(int MsgType, void* pRawMsg)
m_aSrvBroadcastColorList[0] = White;
m_SrvBroadcastColorCount = 1;
CBcLineInfo UserLines[3];
CBcLineInfo UserLines[MAX_BROADCAST_LINES];
int UserLineCount = 0;
int LastUserLineStartPoint = 0;
@ -257,7 +257,7 @@ void CBroadcast::OnMessage(int MsgType, void* pRawMsg)
if(*c == CharUtf8 && *c == '\\')
{
if(i+1 < RcvMsgLen && c[1] == 'n' && UserLineCount < 3)
if(i+1 < RcvMsgLen && c[1] == 'n' && UserLineCount < MAX_BROADCAST_LINES)
{
CBcLineInfo Line = { m_aSrvBroadcastMsg+LastUserLineStartPoint,
m_aSrvBroadcastMsgLen-LastUserLineStartPoint, 0 };
@ -310,7 +310,7 @@ void CBroadcast::OnMessage(int MsgType, void* pRawMsg)
// make lines
int CurCharCount = 0;
while(CurCharCount < MsgLen && m_SrvBroadcastLineCount < 3)
while(CurCharCount < MsgLen && m_SrvBroadcastLineCount < MAX_BROADCAST_LINES)
{
const char* RemainingMsg = pBroadcastMsg + CurCharCount;
@ -344,7 +344,7 @@ void CBroadcast::OnMessage(int MsgType, void* pRawMsg)
{
FontSize = BROADCAST_FONTSIZE_SMALL;
for(int i = 0; i < UserLineCount && m_SrvBroadcastLineCount < 3; i++)
for(int i = 0; i < UserLineCount && m_SrvBroadcastLineCount < MAX_BROADCAST_LINES; i++)
{
TextRender()->SetCursor(&Cursor, 0, 0, FontSize, TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = LineMaxWidth;

View file

@ -27,11 +27,12 @@ class CBroadcast : public CComponent
enum {
MAX_BROADCAST_COLORS = 128,
MAX_BROADCAST_MSG_LENGTH = 127
MAX_BROADCAST_MSG_LENGTH = 127,
MAX_BROADCAST_LINES = 3,
};
CBcColor m_aSrvBroadcastColorList[MAX_BROADCAST_COLORS];
CBcLineInfo m_aSrvBroadcastLines[3];
CBcLineInfo m_aSrvBroadcastLines[MAX_BROADCAST_LINES];
char m_aSrvBroadcastMsg[MAX_BROADCAST_MSG_LENGTH+1];
int m_aSrvBroadcastMsgLen;
int m_SrvBroadcastColorCount;

View file

@ -3,7 +3,6 @@
#ifndef GAME_CLIENT_COMPONENTS_HUD_H
#define GAME_CLIENT_COMPONENTS_HUD_H
#include <game/client/component.h>
#include <base/tl/array.h>
class CHud : public CComponent
{
@ -27,7 +26,6 @@ class CHud : public CComponent
void RenderScoreHud();
void RenderSpectatorHud();
void RenderWarmupTimer();
public:
CHud();