From bf9cfc673091decfb7a75cd69eb2a0a8c2aea78f Mon Sep 17 00:00:00 2001
From: bitten2up <575-bitten2up@users.noreply.git.do.srb2.org>
Date: Tue, 3 Oct 2023 15:30:33 +0000
Subject: [PATCH] starting to document netcode

---
 src/hu_stuff.c            | 2 ++
 src/netcode/net_command.c | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index eb2915d80..b95eb3e66 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -641,6 +641,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
 	msg = (char *)*p;
 	SKIPSTRINGL(*p, HU_MAXMSGLEN + 1);
 
+	// check if player is sending a say command while muted
+	// or if they are sending a csay and are not an admin
 	if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum)))
 	{
 		CONS_Alert(CONS_WARNING, cv_mute.value ?
diff --git a/src/netcode/net_command.c b/src/netcode/net_command.c
index 2b3abfd02..b321d727b 100644
--- a/src/netcode/net_command.c
+++ b/src/netcode/net_command.c
@@ -39,7 +39,8 @@ void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum))
 
 void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam)
 {
-	if (localtextcmd[0]+2+nparam > MAXTEXTCMD)
+	// +1 for the size and another +1 for the ID.
+	if (localtextcmd[0] + 2 + nparam > MAXTEXTCMD)
 	{
 		// for future reference: if (cv_debug) != debug disabled.
 		CONS_Alert(CONS_ERROR, M_GetText("NetXCmd buffer full, cannot add netcmd %d! (size: %d, needed: %s)\n"), id, localtextcmd[0], sizeu1(nparam));
@@ -57,7 +58,8 @@ void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam)
 // splitscreen player
 void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam)
 {
-	if (localtextcmd2[0]+2+nparam > MAXTEXTCMD)
+	// +1 for the size and another +1 for the ID.
+	if (localtextcmd2[0] + 2 + nparam > MAXTEXTCMD)
 	{
 		I_Error("No more place in the buffer for netcmd %d\n",id);
 		return;
-- 
GitLab