From d95a1e2ff3d4e57ea6b2ada2d9f3b6d396889e2d Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Fri, 15 Nov 2019 17:50:40 +0100 Subject: [PATCH 1/3] Make the "nodes" command clearer Because literally anyone who isn't a dev has no idea what those fucking numbers even mean... Before: $nodes 00 - Sonic - 01 - 666.66.420.42:5029 01 - Tales - 00 - self 02 - Nukes - 255 03 - Ammie - 255 04 - Fangs - 255 05 - Metal - 255 After: $nodes 00 - Sonic - node 01 - 666.66.420.42:5029 01 - Tales - node 00 - self 02 - Nukes 03 - Ammie 04 - Fangs 05 - Metal --- src/d_clisrv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a92619a34..a35303982 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -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)")); From 53f5d7ffc372f5d4f73a9e42f95b01800e090282 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 5 Mar 2019 14:41:23 -0800 Subject: [PATCH 2/3] Don't confuse node with player in commands (cherry picked from commit 17bdf39dc8372ed9c6c31fa8d00eba03396a55bf) --- src/d_netcmd.c | 4 ++-- src/hu_stuff.c | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 14746265f..7e5bbc17f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3007,7 +3007,7 @@ static void Command_Verify_f(void) if (COM_Argc() != 2) { - CONS_Printf(M_GetText("promote : give admin privileges to a node\n")); + CONS_Printf(M_GetText("promote : give admin privileges to a player\n")); return; } @@ -3063,7 +3063,7 @@ static void Command_RemoveAdmin_f(void) if (COM_Argc() != 2) { - CONS_Printf(M_GetText("demote : remove admin privileges from a node\n")); + CONS_Printf(M_GetText("demote : remove admin privileges from a player\n")); return; } diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 428656bf2..90f4ceedf 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -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 \'.", false); - free(nodenum); + HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", 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 \'.", false); - free(nodenum); + HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", 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! From 8b3e4d122b4b165d296a296b82bcd36596350ced Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sat, 16 Nov 2019 01:42:02 +0100 Subject: [PATCH 3/3] Show player number instead of node when someone joins --- src/d_clisrv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a35303982..92196219d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3225,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')