Clean up other paste code a bit

This commit is contained in:
def 2016-05-11 18:00:27 +02:00
parent b7d4beccea
commit b0b2774695
2 changed files with 4 additions and 12 deletions

View file

@ -127,18 +127,14 @@ bool CChat::OnInput(IInput::CEvent Event)
{
if(Text[i] == '\n')
{
int max = i - Begin + 1;
if(max > (int)sizeof(Line))
max = sizeof(Line);
int max = min(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
SayChat(Line);
while(Text[i] == '\n') i++;
}
}
int max = i - Begin + 1;
if(max > (int)sizeof(Line))
max = sizeof(Line);
int max = min(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
m_Input.Add(Line);

View file

@ -108,17 +108,13 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
Begin++;
continue;
}
int max = i - Begin + 1;
if(max > (int)sizeof(Line))
max = sizeof(Line);
int max = min(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
ExecuteLine(Line);
}
}
int max = i - Begin + 1;
if(max > (int)sizeof(Line))
max = sizeof(Line);
int max = min(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
m_Input.Add(Line);