mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-05 01:38:13 +00:00
Cleanup blank chatbox checking code
This commit is contained in:
parent
1e9b95e546
commit
0e3a3b2fac
1 changed files with 9 additions and 18 deletions
|
|
@ -1028,25 +1028,15 @@ void HU_Ticker(void)
|
|||
|
||||
static boolean teamtalk = false;
|
||||
|
||||
// Clear spaces so we don't end up with messages only made out of emptiness
|
||||
static boolean HU_clearChatSpaces(void)
|
||||
static boolean HU_chatboxContainsOnlySpaces(void)
|
||||
{
|
||||
size_t i = 0; // Used to just check our message
|
||||
char c; // current character we're iterating.
|
||||
boolean nothingbutspaces = true;
|
||||
size_t i;
|
||||
|
||||
for (; i < strlen(w_chat); i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
{
|
||||
c = w_chat[i];
|
||||
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.
|
||||
for (i = 0; w_chat[i]; i++)
|
||||
if (w_chat[i] != ' ')
|
||||
return false;
|
||||
|
||||
if (c != ' ') // Isn't a space
|
||||
{
|
||||
nothingbutspaces = false;
|
||||
}
|
||||
}
|
||||
return nothingbutspaces;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1062,8 +1052,9 @@ static void HU_queueChatChar(INT32 c)
|
|||
size_t ci = 2;
|
||||
INT32 target = 0;
|
||||
|
||||
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
|
||||
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
|
||||
// if our message was nothing but spaces, don't send it.
|
||||
if (HU_chatboxContainsOnlySpaces())
|
||||
return;
|
||||
|
||||
do {
|
||||
c = w_chat[-2+ci++];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue