From e07305962e94fb82835e7664dcf5aefd6518aea0 Mon Sep 17 00:00:00 2001
From: Yukita Mayako <catgirl@goddess.moe>
Date: Tue, 23 Feb 2016 09:34:16 -0500
Subject: [PATCH] Some cleaning up~

---
 src/d_clisrv.h |  1 +
 src/d_enet.c   | 17 +++++++----------
 src/d_enet.h   |  3 ---
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/src/d_clisrv.h b/src/d_clisrv.h
index d02bd8c0f2..4831df6010 100644
--- a/src/d_clisrv.h
+++ b/src/d_clisrv.h
@@ -270,6 +270,7 @@ void SV_ResetServer(void);
 void CL_AddSplitscreenPlayer(void);
 void CL_RemoveSplitscreenPlayer(void);
 void CL_Reset(void);
+void D_SaveBan(void); // in the middle of frikking nowhere
 void CL_ClearPlayer(INT32 playernum);
 void CL_UpdateServerList(boolean internetsearch, INT32 room);
 // is there a game running
diff --git a/src/d_enet.c b/src/d_enet.c
index c52d88872f..14b385ff85 100644
--- a/src/d_enet.c
+++ b/src/d_enet.c
@@ -21,6 +21,7 @@ enum {
 	DISCONNECT_UNKNOWN = 0,
 	DISCONNECT_SHUTDOWN,
 	DISCONNECT_FULL,
+	DISCONNECT_VERSION,
 
 	CLIENT_ASKMSINFO = 0,
 	CLIENT_JOIN,
@@ -55,7 +56,12 @@ static void ServerHandlePacket(UINT8 node, DataWrap data)
 		UINT16 version = data->ReadUINT16(data);
 		UINT16 subversion = data->ReadUINT16(data);
 		if (version != VERSION || subversion != SUBVERSION)
+		{
 			CONS_Printf("NETWORK: Version mismatch!?\n");
+			nodeleaving[node] = true;
+			enet_peer_disconnect(nodetopeer[node], DISCONNECT_VERSION);
+			break;
+		}
 		char *name = data->ReadStringn(data, MAXPLAYERNAME);
 		CONS_Printf("NETWORK: Player '%s' joining...\n", name);
 		net_playercount++;
@@ -193,15 +199,6 @@ void Net_AckTicker(void)
 		}
 }
 
-boolean Net_AllAckReceived(void)
-{
-	return true;
-}
-
-void D_SetDoomcom(void)
-{
-}
-
 void D_NetOpen(void)
 {
 	ENetAddress address = { ENET_HOST_ANY, 5029 };
@@ -301,7 +298,7 @@ void D_CloseConnection(void)
 
 	if (ClientHost)
 	{
-		enet_peer_disconnect(nodetopeer[servernode], 0);
+		enet_peer_disconnect(nodetopeer[servernode], DISCONNECT_SHUTDOWN);
 		while (enet_host_service(ServerHost, &e, 3000) > 0)
 		{
 			if (e.type == ENET_EVENT_TYPE_DISCONNECT)
diff --git a/src/d_enet.h b/src/d_enet.h
index 7a2833834a..2d498cdd76 100644
--- a/src/d_enet.h
+++ b/src/d_enet.h
@@ -10,9 +10,6 @@ extern boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
 
 boolean Net_GetNetStat(void);
 void Net_AckTicker(void);
-boolean Net_AllAckReceived(void);
-void D_SetDoomcom(void);
-void D_SaveBan(void);
 boolean D_CheckNetGame(void);
 void D_CloseConnection(void);
 void Net_CloseConnection(INT32 node);
-- 
GitLab