mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Merge branch 'clearer-nodes-command' into 'master'
Make the "nodes" command clearer See merge request STJr/SRB2Internal!477
This commit is contained in:
commit
8adf564c41
3 changed files with 24 additions and 20 deletions
|
@ -2588,9 +2588,13 @@ static void Command_Nodes(void)
|
|||
if (playeringame[i])
|
||||
{
|
||||
CONS_Printf("%.2u: %*s", i, (int)maxlen, player_names[i]);
|
||||
CONS_Printf(" - %.2d", playernode[i]);
|
||||
if (I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL)
|
||||
CONS_Printf(" - %s", address);
|
||||
|
||||
if (playernode[i] != UINT8_MAX)
|
||||
{
|
||||
CONS_Printf(" - node %.2d", playernode[i]);
|
||||
if (I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL)
|
||||
CONS_Printf(" - %s", address);
|
||||
}
|
||||
|
||||
if (IsPlayerAdmin(i))
|
||||
CONS_Printf(M_GetText(" (verified admin)"));
|
||||
|
@ -3221,10 +3225,10 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
|||
{
|
||||
const char *address;
|
||||
if (I_GetNodeAddress && (address = I_GetNodeAddress(node)) != NULL)
|
||||
HU_AddChatText(va("\x82*%s has joined the game (node %d) (%s)", player_names[newplayernum], node, address), false); // merge join notification + IP to avoid clogging console/chat.
|
||||
HU_AddChatText(va("\x82*%s has joined the game (player %d) (%s)", player_names[newplayernum], newplayernum, address), false); // merge join notification + IP to avoid clogging console/chat.
|
||||
}
|
||||
else
|
||||
HU_AddChatText(va("\x82*%s has joined the game (node %d)", player_names[newplayernum], node), false); // if you don't wanna see the join address.
|
||||
HU_AddChatText(va("\x82*%s has joined the game (player %d)", player_names[newplayernum], newplayernum), false); // if you don't wanna see the join address.
|
||||
}
|
||||
|
||||
if (server && multiplayer && motd[0] != '\0')
|
||||
|
|
|
@ -3003,7 +3003,7 @@ static void Command_Verify_f(void)
|
|||
|
||||
if (COM_Argc() != 2)
|
||||
{
|
||||
CONS_Printf(M_GetText("promote <node>: give admin privileges to a node\n"));
|
||||
CONS_Printf(M_GetText("promote <playernum>: give admin privileges to a player\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3059,7 +3059,7 @@ static void Command_RemoveAdmin_f(void)
|
|||
|
||||
if (COM_Argc() != 2)
|
||||
{
|
||||
CONS_Printf(M_GetText("demote <node>: remove admin privileges from a node\n"));
|
||||
CONS_Printf(M_GetText("demote <playernum>: remove admin privileges from a player\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -498,24 +498,24 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
|||
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
// what we're gonna do now is check if the node exists
|
||||
// what we're gonna do now is check if the player exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
const char *newmsg;
|
||||
char *nodenum = (char*) malloc(3);
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *playernum = (char*) malloc(3);
|
||||
INT32 spc = 1; // used if playernum[1] is a space.
|
||||
|
||||
strncpy(nodenum, msg+3, 3);
|
||||
strncpy(playernum, msg+3, 3);
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
if (((playernum[0] < '0') || (playernum[0] > '9')) || ((playernum[1] < '0') || (playernum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
// check if playernum[1] is a space
|
||||
if (playernum[1] == ' ')
|
||||
spc = 0;
|
||||
// let it slide
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<playernum> \'.", false);
|
||||
free(playernum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -524,14 +524,14 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
|||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<playernum> \'.", false);
|
||||
free(playernum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
target = atoi((const char*) playernum); // turn that into a number
|
||||
free(playernum);
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
|
|
Loading…
Reference in a new issue