Merge branch 'clearer-nodes-command' into 'master'

Make the "nodes" command clearer

See merge request STJr/SRB2Internal!477
This commit is contained in:
MascaraSnake 2019-11-16 12:53:31 -05:00
commit 8adf564c41
3 changed files with 24 additions and 20 deletions

View File

@ -2588,9 +2588,13 @@ static void Command_Nodes(void)
if (playeringame[i]) if (playeringame[i])
{ {
CONS_Printf("%.2u: %*s", i, (int)maxlen, player_names[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) if (playernode[i] != UINT8_MAX)
CONS_Printf(" - %s", address); {
CONS_Printf(" - node %.2d", playernode[i]);
if (I_GetNodeAddress && (address = I_GetNodeAddress(playernode[i])) != NULL)
CONS_Printf(" - %s", address);
}
if (IsPlayerAdmin(i)) if (IsPlayerAdmin(i))
CONS_Printf(M_GetText(" (verified admin)")); CONS_Printf(M_GetText(" (verified admin)"));
@ -3221,10 +3225,10 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
{ {
const char *address; const char *address;
if (I_GetNodeAddress && (address = I_GetNodeAddress(node)) != NULL) 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 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') if (server && multiplayer && motd[0] != '\0')

View File

@ -3003,7 +3003,7 @@ static void Command_Verify_f(void)
if (COM_Argc() != 2) 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; return;
} }
@ -3059,7 +3059,7 @@ static void Command_RemoveAdmin_f(void)
if (COM_Argc() != 2) 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; return;
} }

View File

@ -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 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: // with that logic, characters 4 and 5 are our numbers:
const char *newmsg; const char *newmsg;
char *nodenum = (char*) malloc(3); char *playernum = (char*) malloc(3);
INT32 spc = 1; // used if nodenum[1] is a space. 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" // 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 // check if playernum[1] is a space
if (nodenum[1] == ' ') if (playernum[1] == ' ')
spc = 0; spc = 0;
// let it slide // let it slide
else else
{ {
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false); HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<playernum> \'.", false);
free(nodenum); free(playernum);
return; return;
} }
} }
@ -524,14 +524,14 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
{ {
if (msg[5] != ' ') if (msg[5] != ' ')
{ {
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false); HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<playernum> \'.", false);
free(nodenum); free(playernum);
return; return;
} }
} }
target = atoi((const char*) nodenum); // turn that into a number target = atoi((const char*) playernum); // turn that into a number
free(nodenum); free(playernum);
//CONS_Printf("%d\n", target); //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!