mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Cleanup chat code a little
# Conflicts: # src/hu_stuff.c
This commit is contained in:
parent
58a40b7439
commit
2ccb222914
1 changed files with 6 additions and 17 deletions
|
|
@ -1039,11 +1039,8 @@ static boolean HU_chatboxContainsOnlySpaces(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
static void HU_queueChatChar(char c)
|
||||||
//
|
|
||||||
static void HU_queueChatChar(INT32 c)
|
|
||||||
{
|
{
|
||||||
// send automaticly the message (no more chat char)
|
|
||||||
if (c == KEY_ENTER)
|
if (c == KEY_ENTER)
|
||||||
{
|
{
|
||||||
char buf[2+256];
|
char buf[2+256];
|
||||||
|
|
@ -1093,7 +1090,7 @@ static void HU_queueChatChar(INT32 c)
|
||||||
strncpy(playernum, msg+3, 3);
|
strncpy(playernum, msg+3, 3);
|
||||||
|
|
||||||
// check for undesirable characters in our "number"
|
// check for undesirable characters in our "number"
|
||||||
if (((playernum[0] < '0') || (playernum[0] > '9')) || ((playernum[1] < '0') || (playernum[1] > '9')))
|
if (!(isdigit(playernum[0]) && isdigit(playernum[1])))
|
||||||
{
|
{
|
||||||
// check if playernum[1] is a space
|
// check if playernum[1] is a space
|
||||||
if (playernum[1] == ' ')
|
if (playernum[1] == ' ')
|
||||||
|
|
@ -1106,17 +1103,13 @@ static void HU_queueChatChar(INT32 c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// I'm very bad at C, I swear I am, additional checks eww!
|
// I'm very bad at C, I swear I am, additional checks eww!
|
||||||
if (spc != 0)
|
if (spc != 0 && msg[5] != ' ')
|
||||||
{
|
{
|
||||||
if (msg[5] != ' ')
|
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<player num> \'.", false);
|
||||||
{
|
return;
|
||||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<player num> \'.", false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target = atoi(playernum); // turn that into a number
|
target = atoi(playernum); // turn that into a number
|
||||||
//CONS_Printf("%d\n", target);
|
|
||||||
|
|
||||||
// check for target player, if it doesn't exist then we can't send the message!
|
// check for target player, if it doesn't exist then we can't send the message!
|
||||||
if (target < MAXPLAYERS && playeringame[target]) // player exists
|
if (target < MAXPLAYERS && playeringame[target]) // player exists
|
||||||
|
|
@ -1133,11 +1126,7 @@ static void HU_queueChatChar(INT32 c)
|
||||||
}
|
}
|
||||||
if (ci > 3) // don't send target+flags+empty message.
|
if (ci > 3) // don't send target+flags+empty message.
|
||||||
{
|
{
|
||||||
if (teamtalk)
|
buf[0] = teamtalk ? -1 : target; // target
|
||||||
buf[0] = -1; // target
|
|
||||||
else
|
|
||||||
buf[0] = target;
|
|
||||||
|
|
||||||
buf[1] = 0; // flags
|
buf[1] = 0; // flags
|
||||||
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue