mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-02 06:23:03 +00:00
Cleanup blank chatbox checking code
This commit is contained in:
parent
e8c83f48be
commit
d9bc478822
1 changed files with 9 additions and 18 deletions
|
@ -946,25 +946,15 @@ void HU_Ticker(void)
|
||||||
|
|
||||||
static boolean teamtalk = false;
|
static boolean teamtalk = false;
|
||||||
|
|
||||||
// Clear spaces so we don't end up with messages only made out of emptiness
|
static boolean HU_chatboxContainsOnlySpaces(void)
|
||||||
static boolean HU_clearChatSpaces(void)
|
|
||||||
{
|
{
|
||||||
size_t i = 0; // Used to just check our message
|
size_t i;
|
||||||
char c; // current character we're iterating.
|
|
||||||
boolean nothingbutspaces = true;
|
|
||||||
|
|
||||||
for (; i < strlen(w_chat); i++) // iterate through message and eradicate all spaces that don't belong.
|
for (i = 0; w_chat[i]; i++)
|
||||||
{
|
if (w_chat[i] != ' ')
|
||||||
c = w_chat[i];
|
return false;
|
||||||
if (!c)
|
|
||||||
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
|
|
||||||
|
|
||||||
if (c != ' ') // Isn't a space
|
return true;
|
||||||
{
|
|
||||||
nothingbutspaces = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nothingbutspaces;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -980,8 +970,9 @@ static void HU_queueChatChar(char c)
|
||||||
size_t ci = 2;
|
size_t ci = 2;
|
||||||
INT32 target = 0;
|
INT32 target = 0;
|
||||||
|
|
||||||
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
|
// if our message was nothing but spaces, don't send it.
|
||||||
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
|
if (HU_chatboxContainsOnlySpaces())
|
||||||
|
return;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
c = w_chat[-2+ci++];
|
c = w_chat[-2+ci++];
|
||||||
|
|
Loading…
Reference in a new issue